|
AeonGUI
A portable video game graphic user interface library.
|
Skia-based Canvas implementation. More...
#include </d/a/AeonGUI/AeonGUI/include/aeongui/SkiaCanvas.hpp>
Public Member Functions | |
| SkiaCanvas () | |
| Construct an empty (zero-size) SkiaCanvas. | |
| SkiaCanvas (uint32_t aWidth, uint32_t aHeight) | |
| Construct a SkiaCanvas with the given viewport dimensions. | |
| void | ResizeViewport (uint32_t aWidth, uint32_t aHeight) final |
| Resize the rendering viewport. | |
| const uint8_t * | GetPixels () const final |
| Get a pointer to the raw pixel data. | |
| size_t | GetWidth () const final |
| Get the width of the canvas in pixels. | |
| size_t | GetHeight () const final |
| Get the height of the canvas in pixels. | |
| size_t | GetStride () const final |
| Get the stride (bytes per row) of the pixel buffer. | |
| void | Clear () final |
| Clear the canvas to transparent. | |
| void | Draw (const Path &aPath) final |
| Draw a path using the current fill and stroke settings. | |
| 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. | |
| void | DrawText (const std::string &aText, double aX, double aY, const std::string &aFontFamily, double aFontSize, int aFontWeight, int aFontStyle) final |
| double | MeasureText (const std::string &aText, const std::string &aFontFamily, double aFontSize, int aFontWeight, int aFontStyle) const final |
| void | DrawTextOnPath (const std::string &aText, const Path &aPath, double aStartOffset, const std::string &aFontFamily, double aFontSize, int aFontWeight, int aFontStyle, bool aReverse=false, bool aClosed=false) final |
| void | SetFillColor (const ColorAttr &aColor) final |
| Set the fill color. | |
| const ColorAttr & | GetFillColor () const final |
| Get the current fill color. | |
| void | SetStrokeColor (const ColorAttr &aColor) final |
| Set the stroke color. | |
| const ColorAttr & | GetStrokeColor () const final |
| Get the current stroke color. | |
| void | SetStrokeWidth (double aWidth) final |
| Set the stroke width. | |
| double | GetStrokeWidth () const final |
| Get the current stroke width. | |
| void | SetStrokeOpacity (double aWidth) final |
| Set the stroke opacity. | |
| double | GetStrokeOpacity () const final |
| Get the current stroke opacity. | |
| void | SetFillOpacity (double aWidth) final |
| Set the fill opacity. | |
| double | GetFillOpacity () const final |
| Get the current fill opacity. | |
| void | SetOpacity (double aWidth) final |
| Set the global opacity. | |
| double | GetOpacity () const final |
| Get the current global opacity. | |
| void | SetViewBox (const ViewBox &aViewBox, const PreserveAspectRatio &aPreserveAspectRatio) final |
| Set the SVG viewBox and preserveAspectRatio. | |
| void | SetTransform (const Matrix2x3 &aMatrix) final |
| Replace the current transformation matrix. | |
| void | Transform (const Matrix2x3 &aMatrix) final |
| Pre-multiply the current transformation matrix. | |
| void | Save () final |
| Save the current graphics state (transform, clipping, etc.). | |
| void | Restore () final |
| Restore the previously saved graphics state. | |
| void * | GetNativeSurface () const final |
| Get the native rendering surface handle. | |
| void | PushGroup () final |
| Begin an offscreen group for filter/compositing. | |
| void | PopGroup () final |
| End an offscreen group and composite back. | |
| void | ApplyDropShadow (double aDx, double aDy, double aStdDeviationX, double aStdDeviationY, const Color &aFloodColor, double aFloodOpacity) final |
| Apply a drop-shadow filter to the current group content. | |
| uint8_t | PickAtPoint (double aX, double aY) const final |
| Read the pick ID at the given viewport coordinates. | |
| void | ResetPick () final |
| Clear the pick buffer and reset for a new frame. | |
| void | SetClipRect (double aX, double aY, double aWidth, double aHeight) final |
| Set a device-space clip rectangle on both render and pick surfaces. | |
| std::unique_ptr< Path > | CreatePath () const final |
| Create a new Path object suitable for this canvas backend. | |
| Public Member Functions inherited from AeonGUI::Canvas | |
| void | SetHitTesting (bool aHitTesting) |
| Enable or disable hit-testing mode. | |
| bool | IsHitTesting () const |
| Query whether the canvas is in hit-testing mode. | |
| void | SetPickId (uint8_t aPickId) |
| Set the current pick ID for subsequent Draw calls. | |
| virtual | ~Canvas ()=0 |
| Virtual destructor. | |
| const PickBounds & | GetPickBounds (uint8_t aId) const |
| Get the cached device-space bounds for a pick ID. | |
Additional Inherited Members | |
| Protected Attributes inherited from AeonGUI::Canvas | |
| bool | mHitTesting {false} |
| True when in hit-testing mode. | |
| uint8_t | mPickId {0} |
| Current pick ID for Draw calls. | |
| std::array< PickBounds, 256 > | mPickBounds {} |
| Cached device-space bounds per pick ID. | |
Skia-based Canvas implementation.
Renders 2D geometry, text, and images into a CPU-side pixel buffer using Google Skia. Selected at build time with -DAEONGUI_BACKEND=Skia.
| AeonGUI::SkiaCanvas::SkiaCanvas | ( | uint32_t | aWidth, |
| uint32_t | aHeight ) |
Construct a SkiaCanvas with the given viewport dimensions.
| aWidth | Viewport width in pixels. |
| aHeight | Viewport height in pixels. |
|
finalvirtual |
Apply a drop-shadow filter to the current group content.
Must be called between PushGroup() and PopGroup(). The implementation captures the group, creates a blurred shadow, offsets it, and composites it under the original content.
| aDx | Horizontal offset of the shadow. |
| aDy | Vertical offset of the shadow. |
| aStdDeviationX | Horizontal Gaussian blur standard deviation. |
| aStdDeviationY | Vertical Gaussian blur standard deviation. |
| aFloodColor | Shadow color. |
| aFloodOpacity | Shadow opacity [0.0, 1.0]. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Clear the canvas to transparent.
Implements AeonGUI::Canvas.
|
finalvirtual |
Create a new Path object suitable for this canvas backend.
Implements AeonGUI::Canvas.
|
finalvirtual |
Draw a path using the current fill and stroke settings.
| aPath | The path to draw. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Draw a raster image.
| aPixels | Pointer to source BGRA pixel data. |
| aImageWidth | Width of the source image in pixels. |
| aImageHeight | Height of the source image in pixels. |
| aImageStride | Stride of the source image in bytes. |
| aX | Destination X coordinate. |
| aY | Destination Y coordinate. |
| aWidth | Destination width in user units. |
| aHeight | Destination height in user units. |
| aOpacity | Opacity for the image [0.0, 1.0]. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Draw text at the given position using the specified font description and size.
| aText | The UTF-8 text string to render. |
| aX | The x coordinate for the text start position. |
| aY | The y coordinate for the text baseline. |
| aFontFamily | Font family name (e.g. "sans-serif"). |
| aFontSize | Font size in CSS pixels. |
| aFontWeight | CSS font weight (400 = normal, 700 = bold). |
| aFontStyle | 0 = normal, 1 = italic, 2 = oblique. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Draw text along a path. Each glyph is positioned and rotated to follow the path.
| aText | The UTF-8 text string to render. |
| aPath | The path to follow. |
| aStartOffset | Starting distance along the path in user units. |
| aFontFamily | Font family name. |
| aFontSize | Font size in CSS pixels. |
| aFontWeight | CSS font weight (400 = normal, 700 = bold). |
| aFontStyle | 0 = normal, 1 = italic, 2 = oblique. |
| aReverse | If true, render glyph order against the path direction. |
| aClosed | If true, treat the path as closed for offset wrapping. |
Implements AeonGUI::Canvas.
|
finalvirtual |
|
finalvirtual |
|
finalvirtual |
|
finalvirtual |
Get the native rendering surface handle.
Implements AeonGUI::Canvas.
|
finalvirtual |
|
finalvirtual |
Get a pointer to the raw pixel data.
Implements AeonGUI::Canvas.
|
finalvirtual |
Get the stride (bytes per row) of the pixel buffer.
Implements AeonGUI::Canvas.
|
finalvirtual |
Get the current stroke color.
Implements AeonGUI::Canvas.
|
finalvirtual |
|
finalvirtual |
|
finalvirtual |
|
finalvirtual |
Measure the width of text with the given font parameters.
| aText | The UTF-8 text string to measure. |
| aFontFamily | Font family name. |
| aFontSize | Font size in CSS pixels. |
| aFontWeight | CSS font weight. |
| aFontStyle | Font style (0=normal, 1=italic, 2=oblique). |
Implements AeonGUI::Canvas.
|
finalvirtual |
Read the pick ID at the given viewport coordinates.
| aX | X coordinate in viewport pixels. |
| aY | Y coordinate in viewport pixels. |
Implements AeonGUI::Canvas.
|
finalvirtual |
End an offscreen group and composite back.
Pops the group pushed by PushGroup() and paints it back to the underlying surface.
Implements AeonGUI::Canvas.
|
finalvirtual |
Begin an offscreen group for filter/compositing.
All subsequent drawing is redirected to a temporary surface. Call PopGroup() to retrieve and composite the result.
Implements AeonGUI::Canvas.
|
finalvirtual |
Clear the pick buffer and reset for a new frame.
Implements AeonGUI::Canvas.
|
finalvirtual |
Resize the rendering viewport.
| aWidth | New width in pixels. |
| aHeight | New height in pixels. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Restore the previously saved graphics state.
Implements AeonGUI::Canvas.
|
finalvirtual |
Save the current graphics state (transform, clipping, etc.).
Implements AeonGUI::Canvas.
|
finalvirtual |
Set a device-space clip rectangle on both render and pick surfaces.
Must be called between Save() and Restore().
| aX | X of clip rect (device pixels). |
| aY | Y of clip rect (device pixels). |
| aWidth | Width (device pixels). |
| aHeight | Height (device pixels). |
Implements AeonGUI::Canvas.
|
finalvirtual |
|
finalvirtual |
Set the fill opacity.
| aWidth | Opacity value in the range [0.0, 1.0]. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Set the global opacity.
| aWidth | Opacity value in the range [0.0, 1.0]. |
Implements AeonGUI::Canvas.
|
finalvirtual |
|
finalvirtual |
Set the stroke opacity.
| aWidth | Opacity value in the range [0.0, 1.0]. |
Implements AeonGUI::Canvas.
|
finalvirtual |
|
finalvirtual |
Replace the current transformation matrix.
| aMatrix | The new 2x3 transformation matrix. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Set the SVG viewBox and preserveAspectRatio.
| aViewBox | The viewBox rectangle. |
| aPreserveAspectRatio | How to align and scale. |
Implements AeonGUI::Canvas.
|
finalvirtual |
Pre-multiply the current transformation matrix.
| aMatrix | The matrix to concatenate. |
Implements AeonGUI::Canvas.