libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
PaintEngine::Impl Class Reference

Abstract implementation backend for PaintEngine. More...

#include <paintengine.h>

Collaboration diagram for PaintEngine::Impl:

Public Member Functions

virtual ~Impl ()
 Virtual destructor.
 
const PixelFormatpixelFormat () const
 Returns the pixel format used by this implementation.
 
virtual bool blit (const Point2Di32 &destTopLeft, const Image &src, const Point2Di32 &srcTopLeft, const Size2Du32 &srcSize) const
 Blits a rectangular region from a source image onto the surface.
 
virtual Pixel createPixel (const uint16_t *comps, size_t compCount) const
 Creates a Pixel value from component values.
 
virtual size_t drawPoints (const Pixel &pixel, const Point2Di32 *points, size_t pointCount) const
 Draws a set of points onto the surface.
 
virtual size_t compositePoints (const Pixel &pixel, const Point2Di32 *points, const float *alphas, size_t pointCount) const
 Composites a set of points onto the surface with per-point alpha.
 
virtual bool fill (const Pixel &pixel) const
 Fills the entire surface with a single pixel value.
 
virtual size_t drawLines (const Pixel &pixel, const Line2Di32 *lines, size_t count) const
 Draws a set of line segments onto the surface.
 
virtual size_t drawRect (const Pixel &pixel, const Rect< int32_t > &rect) const
 Draws a rectangle outline.
 
virtual size_t fillRect (const Pixel &pixel, const Rect< int32_t > &rect) const
 Fills a rectangle with a solid color.
 
virtual size_t drawCircle (const Pixel &pixel, const Point2Di32 &center, int radius) const
 Draws a circle outline.
 
virtual size_t fillCircle (const Pixel &pixel, const Point2Di32 &center, int radius) const
 Fills a circle with a solid color.
 
virtual size_t drawEllipse (const Pixel &pixel, const Point2Di32 &center, const Size2Du32 &size) const
 Draws an ellipse outline.
 
virtual size_t fillEllipse (const Pixel &pixel, const Point2Di32 &center, const Size2Du32 &size) const
 Fills an ellipse with a solid color.
 

Protected Attributes

const PixelFormat_pixelFormat = nullptr
 Pixel format for this implementation.
 

Detailed Description

Abstract implementation backend for PaintEngine.

Subclass this to provide pixel-format-specific drawing operations. The PaintEngine facade delegates every call to the active Impl instance.

Member Function Documentation

◆ blit()

virtual bool PaintEngine::Impl::blit ( const Point2Di32 destTopLeft,
const Image src,
const Point2Di32 srcTopLeft,
const Size2Du32 srcSize 
) const
virtual

Blits a rectangular region from a source image onto the surface.

Parameters
destTopLeftTop-left corner on the destination surface.
srcSource image to copy from.
srcTopLeftTop-left corner of the source region.
srcSizeSize of the source region to copy.
Returns
true on success, false on failure.

◆ compositePoints()

virtual size_t PaintEngine::Impl::compositePoints ( const Pixel pixel,
const Point2Di32 points,
const float alphas,
size_t  pointCount 
) const
virtual

Composites a set of points onto the surface with per-point alpha.

The default implementation simply calls drawPoints() without compositing. Reimplement in your surface-specific subclass to support true alpha compositing.

Parameters
pixelThe pixel value to composite.
pointsArray of points to composite.
alphasArray of alpha values, one per point.
pointCountNumber of points in the arrays.
Returns
The number of points actually composited.

◆ createPixel()

virtual Pixel PaintEngine::Impl::createPixel ( const uint16_t comps,
size_t  compCount 
) const
virtual

Creates a Pixel value from component values.

The returned Pixel is in a format specific to the underlying data layout and may contain pre-packed component values for fast drawing. Do not modify the returned Pixel unless you know the underlying packing format.

Parameters
compsArray of component values.
compCountNumber of components in the array.
Returns
A Pixel suitable for use with this engine's draw calls.

◆ drawCircle()

virtual size_t PaintEngine::Impl::drawCircle ( const Pixel pixel,
const Point2Di32 center,
int  radius 
) const
virtual

Draws a circle outline.

Default implementation uses the midpoint circle algorithm.

Parameters
pixelThe pixel value to draw with.
centerCenter of the circle.
radiusRadius in pixels.
Returns
The number of points drawn.

◆ drawEllipse()

virtual size_t PaintEngine::Impl::drawEllipse ( const Pixel pixel,
const Point2Di32 center,
const Size2Du32 size 
) const
virtual

Draws an ellipse outline.

Default implementation uses the midpoint ellipse algorithm.

Parameters
pixelThe pixel value to draw with.
centerCenter of the ellipse.
sizeHalf-widths (rx, ry) of the ellipse.
Returns
The number of points drawn.

◆ drawLines()

virtual size_t PaintEngine::Impl::drawLines ( const Pixel pixel,
const Line2Di32 lines,
size_t  count 
) const
virtual

Draws a set of line segments onto the surface.

The default implementation rasterizes each line into a point list and calls drawPoints(). Reimplement for a natively faster line-drawing path.

Parameters
pixelThe pixel value to draw with.
linesArray of line segments to draw.
countNumber of line segments in the array.
Returns
The number of points drawn.

◆ drawPoints()

virtual size_t PaintEngine::Impl::drawPoints ( const Pixel pixel,
const Point2Di32 points,
size_t  pointCount 
) const
virtual

Draws a set of points onto the surface.

Parameters
pixelThe pixel value to draw.
pointsArray of points to draw.
pointCountNumber of points in the array.
Returns
The number of points actually drawn.

◆ drawRect()

virtual size_t PaintEngine::Impl::drawRect ( const Pixel pixel,
const Rect< int32_t > &  rect 
) const
virtual

Draws a rectangle outline.

Default implementation rasterizes the outline into a point list and calls drawPoints().

Parameters
pixelThe pixel value to draw with.
rectThe rectangle to draw.
Returns
The number of points drawn.

◆ fill()

virtual bool PaintEngine::Impl::fill ( const Pixel pixel) const
virtual

Fills the entire surface with a single pixel value.

Parameters
pixelThe pixel value to fill with.
Returns
true on success, false on failure.

◆ fillCircle()

virtual size_t PaintEngine::Impl::fillCircle ( const Pixel pixel,
const Point2Di32 center,
int  radius 
) const
virtual

Fills a circle with a solid color.

Default implementation uses the midpoint circle algorithm with horizontal scanline fill.

Parameters
pixelThe pixel value to fill with.
centerCenter of the circle.
radiusRadius in pixels.
Returns
The number of points drawn.

◆ fillEllipse()

virtual size_t PaintEngine::Impl::fillEllipse ( const Pixel pixel,
const Point2Di32 center,
const Size2Du32 size 
) const
virtual

Fills an ellipse with a solid color.

Default implementation uses the midpoint ellipse algorithm with horizontal scanline fill.

Parameters
pixelThe pixel value to fill with.
centerCenter of the ellipse.
sizeHalf-widths (rx, ry) of the ellipse.
Returns
The number of points drawn.

◆ fillRect()

virtual size_t PaintEngine::Impl::fillRect ( const Pixel pixel,
const Rect< int32_t > &  rect 
) const
virtual

Fills a rectangle with a solid color.

Default implementation rasterizes all interior points.

Parameters
pixelThe pixel value to fill with.
rectThe rectangle to fill.
Returns
The number of points drawn.

◆ pixelFormat()

const PixelFormat * PaintEngine::Impl::pixelFormat ( ) const
inline

Returns the pixel format used by this implementation.

Returns
Pointer to the PixelFormat, or nullptr if unset.

The documentation for this class was generated from the following file: