Nebula
Loading...
Searching...
No Matches
svgpagewriter.h
Go to the documentation of this file.
1#pragma once
2#ifndef HTTP_SVGPAGEWRITER_H
3#define HTTP_SVGPAGEWRITER_H
4//------------------------------------------------------------------------------
14#include "io/streamwriter.h"
15#include "io/xmlwriter.h"
16#include "math/vec2.h"
17
18//------------------------------------------------------------------------------
19namespace Http
20{
22{
24public:
28 virtual ~SvgPageWriter();
32 void SetUnitDimensions(SizeT w, SizeT h);
34 virtual bool Open();
36 virtual void Close();
37
39 void WriteContent(const Util::String& text);
41 void BeginNode(const Util::String& nodeName);
43 void EndNode();
45 void SetString(const Util::String& name, const Util::String& value);
46
48 void BeginTransformGroup(const Math::vec2& translate, float rotate, const Math::vec2& scale);
50 void BeginPaintGroup(const Util::String& fillColor, const Util::String& strokeColor, int strokeWidth);
52 void BeginTextGroup(int fontSize, const Util::String& textColor);
54 void EndGroup();
55
57 void Rect(float x, float y, float w, float h);
59 void Circle(float x, float y, float r);
61 void Ellipse(float x, float y, float rx, float ry);
63 void Line(float x1, float y1, float x2, float y2);
65 void PolyLine(const Util::Array<Math::vec2>& points);
67 void Polygon(const Util::Array<Math::vec2>& points);
69 void Text(float x, float y, const Util::String& text);
70
71protected:
77};
78
79//------------------------------------------------------------------------------
82inline void
84{
85 this->canvasWidth = w;
86 this->canvasHeight = h;
87}
88
89//------------------------------------------------------------------------------
92inline void
94{
95 this->unitWidth = w;
96 this->unitHeight = h;
97}
98
99} // namespace Http
100//------------------------------------------------------------------------------
101#endif
102
A stream writer to generate simple SVG pages.
Definition svgpagewriter.h:22
SizeT canvasWidth
Definition svgpagewriter.h:73
void EndGroup()
end the most recent group
Definition svgpagewriter.cc:162
void PolyLine(const Util::Array< Math::vec2 > &points)
draw a poly-line, all units are in pixels
Definition svgpagewriter.cc:228
__DeclareClass(SvgPageWriter)
void Line(float x1, float y1, float x2, float y2)
draw a line, all units are in pixels
Definition svgpagewriter.cc:212
void BeginNode(const Util::String &nodeName)
begin a new node under the current node
Definition svgpagewriter.cc:91
void Rect(float x, float y, float w, float h)
draw a rectangle, all units are in pixels
Definition svgpagewriter.cc:171
void BeginTextGroup(int fontSize, const Util::String &textColor)
begin a text group
Definition svgpagewriter.cc:151
virtual bool Open()
begin writing to the stream
Definition svgpagewriter.cc:41
void SetCanvasDimensions(SizeT w, SizeT h)
set width and height of canvas in pixels
Definition svgpagewriter.h:83
void Circle(float x, float y, float r)
draw a circle, all units are in pixels
Definition svgpagewriter.cc:185
SvgPageWriter()
constructor
Definition svgpagewriter.cc:20
SizeT unitHeight
Definition svgpagewriter.h:76
void SetString(const Util::String &name, const Util::String &value)
set string attribute on current node
Definition svgpagewriter.cc:109
void EndNode()
end current node, set current node to parent
Definition svgpagewriter.cc:100
virtual ~SvgPageWriter()
destructor
Definition svgpagewriter.cc:32
virtual void Close()
end writing to the stream
Definition svgpagewriter.cc:69
void Polygon(const Util::Array< Math::vec2 > &points)
draw a polygon, all units are in pixels
Definition svgpagewriter.cc:254
void WriteContent(const Util::String &text)
write content text
Definition svgpagewriter.cc:291
void BeginTransformGroup(const Math::vec2 &translate, float rotate, const Math::vec2 &scale)
begin a transformation group
Definition svgpagewriter.cc:118
Ptr< IO::XmlWriter > xmlWriter
Definition svgpagewriter.h:72
SizeT canvasHeight
Definition svgpagewriter.h:74
void SetUnitDimensions(SizeT w, SizeT h)
set width and height in draw units
Definition svgpagewriter.h:93
SizeT unitWidth
Definition svgpagewriter.h:75
void Ellipse(float x, float y, float rx, float ry)
draw an ellipse, all units are in pixels
Definition svgpagewriter.cc:198
void BeginPaintGroup(const Util::String &fillColor, const Util::String &strokeColor, int strokeWidth)
begin a paint group
Definition svgpagewriter.cc:136
Stream writer classes provide a specialized write-interface for a stream.
Definition streamwriter.h:22
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Nebula's dynamic array class.
Definition array.h:60
This file was generated with Nebula Trifid's idlc compiler tool.
Definition defaulthttprequesthandler.cc:15
vec3 rotate(quat const &q, vec3 const &v)
Rotate a vector by a quaternion.
Definition quat.h:547
A 2-component float vector class.
Definition vec2.h:21
Nebula's universal string class.
Definition string.h:50
int SizeT
Definition types.h:49