2D drawing engine for rendering primitives onto images. More...
#include <paintengine.h>
Classes | |
| class | Impl |
| Abstract implementation backend for PaintEngine. More... | |
Public Types | |
| using | Ptr = SharedPtr< PaintEngine > |
| Shared pointer type for PaintEngine. | |
| using | Pixel = List< uint8_t > |
| Opaque pixel value optimized for the underlying format. | |
| using | PointList = List< Point2Di32 > |
| List of 2D points used for batch drawing operations. | |
| using | AlphaList = List< float > |
| List of per-point alpha values used for compositing. | |
Public Member Functions | |
| PaintEngine () | |
| Constructs a PaintEngine with a default (no-op) implementation. | |
| PaintEngine (Impl *impl) | |
| Constructs a PaintEngine that takes ownership of the given Impl. | |
| const PixelFormat * | pixelFormat () const |
| Returns the pixel format of the underlying implementation. | |
| Pixel | createPixel (const uint16_t *comps, size_t compCount) const |
| Creates a Pixel from an array of component values. | |
| Pixel | createPixel (uint16_t c1) const |
| Creates a Pixel from a single component value. | |
| Pixel | createPixel (uint16_t c1, uint16_t c2) const |
| Creates a Pixel from two component values. | |
| Pixel | createPixel (uint16_t c1, uint16_t c2, uint16_t c3) const |
| Creates a Pixel from three component values. | |
| Pixel | createPixel (uint16_t c1, uint16_t c2, uint16_t c3, uint16_t c4) const |
| Creates a Pixel from four component values. | |
| size_t | drawPoints (const Pixel &pixel, const Point2Di32 *points, size_t pointCount) const |
| Draws points onto the surface. | |
| size_t | drawPoints (const Pixel &pixel, const PointList &points) const |
| Draws points from a PointList onto the surface. | |
| size_t | compositePoints (const Pixel &pixel, const Point2Di32 *points, const float *alphas, size_t pointCount) const |
| Composites points onto the surface with per-point alpha. | |
| size_t | compositePoints (const Pixel &pixel, const PointList &points, const AlphaList &alphas) const |
| Composites points from lists onto the surface with per-point alpha. | |
| size_t | drawLines (const Pixel &pixel, const Line2Di32 *lines, size_t lineCount) const |
| Draws multiple line segments onto the surface. | |
| size_t | drawLine (const Pixel &pixel, const Line2Di32 &line) const |
| Draws a single line segment onto the surface. | |
| size_t | drawLine (const Pixel &pixel, int x1, int y1, int x2, int y2) const |
| Draws a single line segment specified by endpoint coordinates. | |
| bool | fill (const Pixel &pixel) |
| Fills the entire surface with a single pixel value. | |
| size_t | drawRect (const Pixel &pixel, const Rect< int32_t > &rect) const |
| Draws a rectangle outline. | |
| size_t | fillRect (const Pixel &pixel, const Rect< int32_t > &rect) const |
| Fills a rectangle with a solid color. | |
| size_t | drawCircle (const Pixel &pixel, const Point2Di32 ¢er, int radius) const |
| Draws a circle outline. | |
| size_t | fillCircle (const Pixel &pixel, const Point2Di32 ¢er, int radius) const |
| Fills a circle with a solid color. | |
| size_t | drawEllipse (const Pixel &pixel, const Point2Di32 ¢er, const Size2Du32 &size) const |
| Draws an ellipse outline. | |
| size_t | fillEllipse (const Pixel &pixel, const Point2Di32 ¢er, const Size2Du32 &size) const |
| Fills an ellipse with a solid color. | |
| bool | blit (const Point2Di32 &destTopLeft, const Image &src, const Point2Di32 &srcTopLeft=Point2Di32(0, 0), const Size2Du32 &srcSize=Size2Du32()) const |
| Blits a rectangular region from a source image onto the surface. | |
Static Public Member Functions | |
| static PointList | plotLine (int x1, int y1, int x2, int y2) |
| Plots a line using Bresenham's algorithm. | |
2D drawing engine for rendering primitives onto images.
PaintEngine provides a pixel-format-aware interface for drawing points, lines, filling surfaces, and blitting images. It delegates to a polymorphic Impl that is specific to the underlying pixel format.
|
inline |
Constructs a PaintEngine that takes ownership of the given Impl.
| impl | Pointer to a heap-allocated Impl subclass. |
|
inline |
Blits a rectangular region from a source image onto the surface.
| destTopLeft | Top-left corner on the destination surface. |
| src | Source image to copy from. |
| srcTopLeft | Top-left corner of the source region (default: origin). |
| srcSize | Size of the source region (default: entire source). |
Creates a Pixel from an array of component values.
| comps | Array of component values. |
| compCount | Number of components in the array. |
Creates a Pixel from a single component value.
| c1 | The component value. |
Creates a Pixel from two component values.
| c1 | First component value. |
| c2 | Second component value. |
Creates a Pixel from three component values.
| c1 | First component value. |
| c2 | Second component value. |
| c3 | Third component value. |
Creates a Pixel from four component values.
| c1 | First component value. |
| c2 | Second component value. |
| c3 | Third component value. |
| c4 | Fourth component value. |
|
inline |
Draws a circle outline.
| pixel | The pixel value to draw with. |
| center | Center of the circle. |
| radius | Radius in pixels. |
|
inline |
Draws an ellipse outline.
| pixel | The pixel value to draw with. |
| center | Center of the ellipse. |
| size | Half-widths (rx, ry) of the ellipse. |
Draws a single line segment onto the surface.
| pixel | The pixel value to draw with. |
| line | The line segment to draw. |
Draws a single line segment specified by endpoint coordinates.
| pixel | The pixel value to draw with. |
| x1 | X coordinate of the start point. |
| y1 | Y coordinate of the start point. |
| x2 | X coordinate of the end point. |
| y2 | Y coordinate of the end point. |
|
inline |
Draws multiple line segments onto the surface.
| pixel | The pixel value to draw with. |
| lines | Array of line segments. |
| lineCount | Number of line segments in the array. |
|
inline |
Draws points onto the surface.
| pixel | The pixel value to draw. |
| points | Array of points to draw. |
| pointCount | Number of points in the array. |
Draws points from a PointList onto the surface.
| pixel | The pixel value to draw. |
| points | List of points to draw. |
Draws a rectangle outline.
| pixel | The pixel value to draw with. |
| rect | The rectangle to draw. |
Fills the entire surface with a single pixel value.
| pixel | The pixel value to fill with. |
|
inline |
Fills a circle with a solid color.
| pixel | The pixel value to fill with. |
| center | Center of the circle. |
| radius | Radius in pixels. |
|
inline |
Fills an ellipse with a solid color.
| pixel | The pixel value to fill with. |
| center | Center of the ellipse. |
| size | Half-widths (rx, ry) of the ellipse. |
Fills a rectangle with a solid color.
| pixel | The pixel value to fill with. |
| rect | The rectangle to fill. |
|
inline |
Returns the pixel format of the underlying implementation.
Plots a line using Bresenham's algorithm.
| x1 | X coordinate of the start point. |
| y1 | Y coordinate of the start point. |
| x2 | X coordinate of the end point. |
| y2 | Y coordinate of the end point. |