Represents a frame of a 2D animation.
More...
#include <frame2d.h>
|
void | add_line (const CoordinateBuffer &coordinates, const Color &line_color=Colors::Black, float line_width=1.0f, const Color &fill_color=Color::None(), bool close_path=false, const std::string &layer_id="") |
| Add a line to the frame. More...
|
|
void | add_rectangle (float x, float y, float w, float h, const Color &line_color=Colors::Black, float line_width=1.0f, const Color &fill_color=Color::None(), const std::string &layer_id="") |
| Add a rectangle to the frame. More...
|
|
void | add_circle (float x, float y, float radius, const Color &line_color=Colors::Black, float line_width=1.0f, const Color &fill_color=Color::None(), const std::string &layer_id="") |
| Add a circle to the frame. More...
|
|
void | add_image (const std::string &image_id, const std::string &position_type="fit", float x=0.0f, float y=0.0f, float scale=1.0f, bool smoothed=false, const std::string &layer_id="") |
| Add an image to the frame. More...
|
|
void | add_video (const std::string &position_type="fit", float x=0.0f, float y=0.0f, float scale=1.0f, bool smoothed=false, const std::string &layer_id="") |
| Add a video to the frame. More...
|
|
void | add_text (const std::string &text, float left, float bottom, const Color &color=Colors::White, float size_in_pixels=12.0f, const std::string &font_family="sans-serif", const std::string &layer_id="") |
| Add some text to the frame. More...
|
|
std::uint16_t | num_coordinates () const |
| The number of coordinates in the buffer. More...
|
|
std::string | to_string () const |
| Return a JSON string representing the object. More...
|
|
JsonValue | to_json () const |
| Convert this object into ScenePic json. More...
|
|
Represents a frame of a 2D animation.
◆ add_circle()
void scenepic::Frame2D::add_circle |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
radius, |
|
|
const Color & |
line_color = Colors::Black , |
|
|
float |
line_width = 1.0f , |
|
|
const Color & |
fill_color = Color::None() , |
|
|
const std::string & |
layer_id = "" |
|
) |
| |
Add a circle to the frame.
- Parameters
-
x | the center x coordinate |
y | the center y coordinate |
radius | the radius of the circle |
line_color | the color of the line |
line_width | the width of the line |
fill_color | the fill color to use |
layer_id | the unique ID of the layer for this primitive |
◆ add_image()
void scenepic::Frame2D::add_image |
( |
const std::string & |
image_id, |
|
|
const std::string & |
position_type = "fit" , |
|
|
float |
x = 0.0f , |
|
|
float |
y = 0.0f , |
|
|
float |
scale = 1.0f , |
|
|
bool |
smoothed = false , |
|
|
const std::string & |
layer_id = "" |
|
) |
| |
Add an image to the frame.
- Parameters
-
image_id | the unique identifier of the image |
position_type | one of "fit", "fill", "stretch", or "manual" |
x | x coordinate to draw image at if position_type == "manual". |
y | y coordinate to draw image at if position_type == "manual". |
scale | scale factor to draw image by if position_type == "manual". |
smoothed | whether to draw an image with smoothing or using nearest neighbor. |
layer_id | the unique ID of the layer for this primitive |
◆ add_line()
void scenepic::Frame2D::add_line |
( |
const CoordinateBuffer & |
coordinates, |
|
|
const Color & |
line_color = Colors::Black , |
|
|
float |
line_width = 1.0f , |
|
|
const Color & |
fill_color = Color::None() , |
|
|
bool |
close_path = false , |
|
|
const std::string & |
layer_id = "" |
|
) |
| |
Add a line to the frame.
- Parameters
-
coordinates | the coordinates of the line |
line_color | the color of the line |
line_width | the width of the line |
fill_color | the fill color to use |
close_path | whether to close the path |
layer_id | the unique ID of the layer for this primitive |
◆ add_rectangle()
void scenepic::Frame2D::add_rectangle |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
w, |
|
|
float |
h, |
|
|
const Color & |
line_color = Colors::Black , |
|
|
float |
line_width = 1.0f , |
|
|
const Color & |
fill_color = Color::None() , |
|
|
const std::string & |
layer_id = "" |
|
) |
| |
Add a rectangle to the frame.
- Parameters
-
x | the upper left corner x coordinate |
y | the upper left corner y coordinate |
w | the width of the rectangle |
h | the height of the rectangle |
line_color | the color of the line |
line_width | the width of the line |
fill_color | the fill color to use |
layer_id | the unique ID of the layer for this primitive |
◆ add_text()
void scenepic::Frame2D::add_text |
( |
const std::string & |
text, |
|
|
float |
left, |
|
|
float |
bottom, |
|
|
const Color & |
color = Colors::White , |
|
|
float |
size_in_pixels = 12.0f , |
|
|
const std::string & |
font_family = "sans-serif" , |
|
|
const std::string & |
layer_id = "" |
|
) |
| |
Add some text to the frame.
- Parameters
-
text | the text to display |
left | the pixel position of the left side of the text |
bottom | the pixel position of the bottom of the text |
color | the color of the text |
size_in_pixels | the vertical size of the text in pixels |
font_family | the font to use for the text |
layer_id | the unique ID of the layer for this primitive |
◆ add_video()
void scenepic::Frame2D::add_video |
( |
const std::string & |
position_type = "fit" , |
|
|
float |
x = 0.0f , |
|
|
float |
y = 0.0f , |
|
|
float |
scale = 1.0f , |
|
|
bool |
smoothed = false , |
|
|
const std::string & |
layer_id = "" |
|
) |
| |
Add a video to the frame.
The image shown will be the corresponding frame from the video.
- Parameters
-
position_type | one of "fit", "fill", "stretch", or "manual" |
x | x coordinate to draw the video frame at if position_type == "manual". |
y | y coordinate to draw the video frame at if position_type == "manual". |
scale | scale factor to draw the video frame by if position_type == "manual". |
smoothed | whether to draw the video frame with smoothing or using nearest neighbor. |
layer_id | the unique ID of the layer for this primitive |
◆ num_coordinates()
std::uint16_t scenepic::Frame2D::num_coordinates |
( |
| ) |
const |
The number of coordinates in the buffer.
◆ to_json()
JsonValue scenepic::Frame2D::to_json |
( |
| ) |
const |
Convert this object into ScenePic json.
- Returns
- a json value
◆ to_string()
std::string scenepic::Frame2D::to_string |
( |
| ) |
const |
Return a JSON string representing the object.
◆ Canvas2D
The documentation for this class was generated from the following file: