16#ifndef AEONGUI_CAIROCANVAS_H
17#define AEONGUI_CAIROCANVAS_H
20#include "aeongui/Canvas.hpp"
23typedef struct _cairo_surface cairo_surface_t;
25typedef struct _cairo cairo_t;
43 DLL
CairoCanvas ( uint32_t aWidth, uint32_t aHeight );
46 DLL
void ResizeViewport ( uint32_t aWidth, uint32_t aHeight ) final;
47 DLL const uint8_t*
GetPixels() const final;
51 DLL
void Clear() final;
52 DLL
void Draw ( const
Path& aPath ) final;
53 DLL
void DrawImage ( const uint8_t* aPixels,
61 double aOpacity ) final;
62 DLL
void DrawText ( const std::
string& aText,
double aX,
double aY,
63 const std::
string& aFontFamily,
double aFontSize,
64 int aFontWeight,
int aFontStyle ) final;
66 const std::
string& aFontFamily,
double aFontSize,
67 int aFontWeight,
int aFontStyle ) const final;
85 cairo_surface_t* mCairoSurface{};
86 cairo_t* mCairoContext{};
87 ColorAttr mFillColor{};
88 ColorAttr mStrokeColor{};
89 double mStrokeWidth{1};
90 double mStrokeOpacity{1};
91 double mFillOpacity{1};
void DrawText(const std::string &aText, double aX, double aY, const std::string &aFontFamily, double aFontSize, int aFontWeight, int aFontStyle) final
Definition CairoCanvas.cpp:316
void SetStrokeColor(const ColorAttr &aColor) final
Set the stroke color.
Definition CairoCanvas.cpp:106
void SetViewBox(const ViewBox &aViewBox, const PreserveAspectRatio &aPreserveAspectRatio) final
Set the SVG viewBox and preserveAspectRatio.
Definition CairoCanvas.cpp:412
const ColorAttr & GetStrokeColor() const final
Get the current stroke color.
Definition CairoCanvas.cpp:111
double GetStrokeOpacity() const final
Get the current stroke opacity.
Definition CairoCanvas.cpp:131
void SetOpacity(double aWidth) final
Set the global opacity.
Definition CairoCanvas.cpp:146
void SetStrokeOpacity(double aWidth) final
Set the stroke opacity.
Definition CairoCanvas.cpp:126
void Clear() final
Clear the canvas to transparent.
Definition CairoCanvas.cpp:77
CairoCanvas()
Default constructor. Creates an empty canvas.
void Draw(const Path &aPath) final
Draw a path using the current fill and stroke settings.
Definition CairoCanvas.cpp:156
void * GetNativeSurface() const final
Get the native rendering surface handle.
Definition CairoCanvas.cpp:483
void ResizeViewport(uint32_t aWidth, uint32_t aHeight) final
Resize the rendering viewport.
Definition CairoCanvas.cpp:38
void DrawImage(const uint8_t *aPixels, size_t aImageWidth, size_t aImageHeight, size_t aImageStride, double aX, double aY, double aWidth, double aHeight, double aOpacity) final
Draw a raster image.
Definition CairoCanvas.cpp:185
void SetTransform(const Matrix2x3 &aMatrix) final
Replace the current transformation matrix.
Definition CairoCanvas.cpp:463
double GetOpacity() const final
Get the current global opacity.
Definition CairoCanvas.cpp:151
double GetFillOpacity() const final
Get the current fill opacity.
Definition CairoCanvas.cpp:141
size_t GetWidth() const final
Get the width of the canvas in pixels.
Definition CairoCanvas.cpp:65
size_t GetStride() const final
Get the stride (bytes per row) of the pixel buffer.
Definition CairoCanvas.cpp:73
void SetFillColor(const ColorAttr &aColor) final
Set the fill color.
Definition CairoCanvas.cpp:96
const uint8_t * GetPixels() const final
Get a pointer to the raw pixel data.
Definition CairoCanvas.cpp:56
void Transform(const Matrix2x3 &aMatrix) final
Pre-multiply the current transformation matrix.
Definition CairoCanvas.cpp:473
double MeasureText(const std::string &aText, const std::string &aFontFamily, double aFontSize, int aFontWeight, int aFontStyle) const final
Definition CairoCanvas.cpp:383
size_t GetHeight() const final
Get the height of the canvas in pixels.
Definition CairoCanvas.cpp:69
void SetStrokeWidth(double aWidth) final
Set the stroke width.
Definition CairoCanvas.cpp:116
double GetStrokeWidth() const final
Get the current stroke width.
Definition CairoCanvas.cpp:121
void SetFillOpacity(double aWidth) final
Set the fill opacity.
Definition CairoCanvas.cpp:136
~CairoCanvas() final
Destructor. Releases Cairo resources.
Definition CairoCanvas.cpp:84
const ColorAttr & GetFillColor() const final
Get the current fill color.
Definition CairoCanvas.cpp:101
Abstract 2D rendering surface.
Definition Canvas.hpp:39
2x3 affine transformation matrix.
Definition Matrix2x3.hpp:37
Abstract base class for renderable path data.
Definition Path.hpp:32
SVG preserveAspectRatio attribute.
Definition Attribute.hpp:44
SVG viewBox attribute value.
Definition Attribute.hpp:31