trase
|
Public Member Functions | |
BackendSVG (std::ostream &out) | |
create a new backend which will write out an animated SVG to the output stream out | |
void | init (const vfloat2_t &pixels, const char *name, float time_span=0.f) noexcept |
Initialise the backend. More... | |
void | finalise () noexcept |
Finalise the backend. More... | |
bool | is_interactive () |
returns false | |
bool | should_close () |
returns true | |
vfloat2_t | begin_frame () |
not used (only used for interactive backends) | |
void | end_frame () |
not used (only used for interactive backends) | |
vfloat2_t | get_mouse_pos () |
this backend is not interactive so return value is undefined | |
float | get_time () |
not used (only used for interactive backends) | |
bool | mouse_dragging () |
not used (only used for interactive backends) | |
vfloat2_t | mouse_drag_delta () |
not used (only used for interactive backends) | |
void | mouse_drag_reset_delta () |
not used (only used for interactive backends) | |
void | scissor (const bfloat2_t &x) |
all subsequent drawing calls will be cut to within this box | |
void | reset_scissor () |
resets any previous calls to scissor() | |
void | rotate (const float angle) |
rotates the drawing transform by an angle given by angle | |
void | reset_transform () |
resets the drawing transform to identity More... | |
void | translate (const vfloat2_t &v) |
translates the drawing transform by an amount given by v | |
void | begin_path () |
begin a drawing path More... | |
void | move_to (const vfloat2_t &x) |
move the "pen" to the point x without drawing a line More... | |
void | line_to (const vfloat2_t &x) |
draw a line to the point x More... | |
void | close_path () |
draw a line to the first point of the path More... | |
void | stroke () |
finalise a drawing path with a drawn line along the path More... | |
void | fill () |
finalise a drawing path with a drawn line and a filled enclosed domain More... | |
void | begin_animated_path () |
begin an animated path More... | |
void | add_animated_path (const float time) |
finalise the current path and add a new path at time time More... | |
void | end_animated_path (const float time) |
finalise the current animated path More... | |
void | rounded_rect (const bfloat2_t &x, float r) noexcept |
draw a rectangle with rounded corners More... | |
void | rect (const bfloat2_t &x, float r=0.f) noexcept |
draw a rectangle, optionally with rounded corners More... | |
void | add_animated_rect (const bfloat2_t &x, float time) |
start/continue an animated rectangle. More... | |
void | add_animated_stroke (const RGBA &color) |
Used in conjunction with add_animated_path, add_animated_rect, add_animated_circle, to provide animated stroke color/opacity. More... | |
void | add_animated_fill (const RGBA &color) |
Used in conjunction with add_animated_path, add_animated_rect, add_animated_circle, to provide animated fill color/opacity. More... | |
void | end_animated_rect () |
end an animated rectangle | |
void | circle (const vfloat2_t ¢re, float r) noexcept |
draw a circle More... | |
void | add_animated_circle (const vfloat2_t ¢re, float radius, float time) |
start/continue an animated circle subsequent calls to this method will add extra keyframe to the animation. More... | |
void | end_animated_circle () |
end an animated circle | |
void | circle_with_text (const vfloat2_t ¢re, float radius, const char *string) |
draw a circle with with a string label More... | |
void | arc (const vfloat2_t ¢re, const float radius, const float angle0, const float angle1) |
draw an arc More... | |
void | stroke_color (const RGBA &color) |
set the current stroke color | |
void | stroke_color (const RGBA &color, const RGBA &color_mouseover) |
set the current stroke color, with a different color to display on mouseover | |
void | tooltip (const vfloat2_t &x, const char *string) |
Set a tooltip. More... | |
void | clear_tooltip () |
Unset the tooltip. More... | |
void | stroke_width (const float lw) |
sets the current stroke width | |
void | fill_color (const RGBA &color) |
set the current fill color | |
void | fill_color (const RGBA &color, const RGBA &color_mouseover) |
set the current fill color, with a different color on mouseover | |
void | font_size (float size) |
set the current font height | |
void | font_face (const char *face) |
sets the current font | |
void | import_web_font (const std::string &url) |
sets a web font More... | |
void | font_blur (const float blur) |
set the amount of font blur on text | |
void | text_align (const unsigned int align) |
sets the current text alignment | |
void | text (const vfloat2_t &x, const char *string, const char *end) |
draws text to a given position More... | |
![]() | |
virtual void | accept (Drawable &drawable)=0 |
![]() | |
virtual void | accept (Drawable &drawable, float time)=0 |
Static Public Member Functions | |
static void | set_mouse_down (const vfloat2_t &mouse_pos) |
not used (only used for interactive backends) | |
static void | set_mouse_up () |
not used (only used for interactive backends) | |
void BackendSVG::add_animated_circle | ( | const vfloat2_t & | centre, |
float | radius, | ||
float | time | ||
) |
start/continue an animated circle subsequent calls to this method will add extra keyframe to the animation.
centre | the centre of the circle |
radius | the radius of the circle |
color | the color of the circle |
time | the time of the keyframe |
void BackendSVG::add_animated_fill | ( | const RGBA & | color | ) |
Used in conjunction with add_animated_path, add_animated_rect, add_animated_circle, to provide animated fill color/opacity.
Must by called once for each of the above methods
color | the fill color of the current keyframe |
void BackendSVG::add_animated_path | ( | const float | time | ) |
finalise the current path and add a new path at time time
Note that filled paths are not currently supported by the animated path
void BackendSVG::add_animated_rect | ( | const bfloat2_t & | x, |
float | time | ||
) |
start/continue an animated rectangle.
subsequent calls to this method will add extra keyframe to the animation.
x | the bounding box of the rectangle |
stroke | the stroke color of the circle |
fill | the fill color of the circle |
time | the time of the keyframe |
void BackendSVG::add_animated_stroke | ( | const RGBA & | color | ) |
Used in conjunction with add_animated_path, add_animated_rect, add_animated_circle, to provide animated stroke color/opacity.
Must by called once for each of the above methods
color | the stroke color of the current keyframe |
void BackendSVG::arc | ( | const vfloat2_t & | centre, |
const float | radius, | ||
const float | angle0, | ||
const float | angle1 | ||
) |
draw an arc
centre | the centre of the arc radius the radius of the arc |
angle0 | the start angle of the arc |
angle1 | the end angle of the arc |
void trase::BackendSVG::begin_animated_path | ( | ) |
begin an animated path
must be called before move_to(), line_to(), add_animated_path(), or end_animated_path()
void BackendSVG::begin_path | ( | ) |
begin a drawing path
must be called before move_to(), line_to(), or close_path()
|
noexcept |
draw a circle
centre | coordinates of the centre of the circle |
r | the radius of the circle |
void BackendSVG::circle_with_text | ( | const vfloat2_t & | centre, |
float | radius, | ||
const char * | string | ||
) |
draw a circle with with a string label
centre | the centre of the circle |
radius | the radius of the circle |
string | the string text |
void BackendSVG::clear_tooltip | ( | ) |
Unset the tooltip.
void BackendSVG::close_path | ( | ) |
draw a line to the first point of the path
void BackendSVG::end_animated_path | ( | const float | time | ) |
finalise the current animated path
Note that filled paths are not currently supported by the animated path
void BackendSVG::fill | ( | ) |
finalise a drawing path with a drawn line and a filled enclosed domain
|
noexcept |
Finalise the backend.
This function must be called after all drawing is complete
void BackendSVG::import_web_font | ( | const std::string & | url | ) |
sets a web font
must be called before init()
|
noexcept |
Initialise the backend.
This function must be called before any other drawing calls
pixels | the image resolution in pixels |
name | the name of the image |
time_span | the total time span of the animated svg |
void BackendSVG::line_to | ( | const vfloat2_t & | x | ) |
draw a line to the point x
void BackendSVG::move_to | ( | const vfloat2_t & | x | ) |
move the "pen" to the point x
without drawing a line
|
noexcept |
draw a rectangle, optionally with rounded corners
x | the bounding box of the rectangle |
r | the radius of the circle used to round the corners, default 0.f |
void trase::BackendSVG::reset_transform | ( | ) |
resets the drawing transform to identity
|
noexcept |
draw a rectangle with rounded corners
x | the bounding box of the rectangle |
r | the radius of the circle used to round the corners |
void BackendSVG::stroke | ( | ) |
finalise a drawing path with a drawn line along the path
void BackendSVG::text | ( | const vfloat2_t & | x, |
const char * | string, | ||
const char * | end | ||
) |
draws text to a given position
x | the text position (see text_align()) |
string | a pointer to the text string |
end | points to the end of the string. Use nullptr to write entire string |
void BackendSVG::tooltip | ( | const vfloat2_t & | x, |
const char * | string | ||
) |