Canvas.hpp
Manage an HTML canvas object.
-
class Canvas : public internal::WidgetFacet<Canvas>
- #include <Canvas.hpp>
Manage an HTML Canvas object.
Public Types
-
using INFO_TYPE = CanvasInfo
Public Functions
-
inline Canvas(double w, double h, const std::string &in_id = "")
Create a new canvas with the specified size and optional HTML identifier.
-
inline Canvas()
-
inline virtual ~Canvas()
-
inline double GetWidth() const
Get the pixel width of this Canvas.
-
inline double GetHeight() const
Get the pixel height of this Canvas.
-
inline void SetWidth(double w)
Set a new width for this Canvas.
-
inline void SetHeight(double h)
Set a new height for this Canvas.
-
inline void SetSize(double w, double h)
Set Canvas size.
-
template<typename ...Ts>
inline Canvas &Circle(Point center, double _r, Ts&&... vals) Add a Circle to this canvas; provide constructor for the CanvasCircle with a position and radius as well as optional face color, line color, and line width.
-
template<typename ...Ts>
inline Canvas &Rect(Point corner, double w, double h, Ts&&... vals) Add a Rectangle to this canvas at x,y with width w and heigh h. Optional face color and line color.
-
template<typename ...Ts>
inline Canvas &Image(const RawImage &image, Point corner, Ts&&... vals) Add an Image to this canvas at x,y with width w and heigh h.
-
template<typename ...Ts>
inline Canvas &Image(const RawImage &image, double x, double y, Ts&&... vals)
-
template<typename ...Ts>
inline Canvas &Line(double x1, double y1, double x2, double y2, Ts&&... vals) Add a Line from x1,y1 to x2,y2. Optional face color and line color.
-
template<typename ...Ts>
inline Canvas &MultiLine(Point p1, const vector<Point> &points, Ts&&... vals) Add a Line from x1,y1 to x2,y2. Optional face color and line color.
-
template<typename ...Ts>
inline Canvas &Text(Point p, Ts&&... vals) Add a string to this canvas at x,y with specified text. Optional face color and line color.
-
template<typename ...Ts>
inline Canvas &CenterText(Point p, Ts&&... vals) Add a string to this canvas centered at x,y with specified text. Optional face color and line color.
-
inline Canvas &Draw(const Circle &circle, const std::string &fc = "", const std::string &lc = "")
Draw a circle onto this canvas.
-
inline Canvas &Draw(const CanvasShape &shape)
Draw an arbitrary shape onto this canvas.
-
inline void DownloadPNG() const
Download a PNG image of a canvas.
Protected Functions
-
inline CanvasInfo *Info()
-
inline const CanvasInfo *Info() const
-
inline Canvas(CanvasInfo *in_info)
Friends
- friend class CanvasInfo
-
using INFO_TYPE = CanvasInfo