bWidgets
Core widget toolkit designed for Blender
bWidgets::bwPaintEngine Class Referenceabstract

Main interface to implement any drawing of geometry or text. More...

#include <bwPaintEngine.h>

Public Member Functions

virtual ~bwPaintEngine ()=default
 
virtual void setupViewport (const bwRectanglePixel &rect, const class bwColor &clear_color)=0
 
virtual void enableMask (const bwRectanglePixel &rect)=0
 
virtual void drawPolygon (const class bwPainter &painter, const class bwPolygon &polygon)=0
 
virtual void drawText (const class bwPainter &painter, const std::string &text, const bwRectanglePixel &rect, const TextAlignment alignment)=0
 
virtual void drawIcon (const class bwPainter &painter, const class bwIconInterface &icon_interface, const bwRectanglePixel &rect)=0
 

Detailed Description

Main interface to implement any drawing of geometry or text.

bwPaintEngine mainly gives us two benefits:

  • Abstracting away any drawing to the application, out of bWidgets.
  • Support multiple drawing backends (e.g. OpenGL and Vulcan).

Having support for multiple drawing backends is not only useful for supporting multiple graphics libraries (as in OpenGL, DirectX, Vulcan, etc.), but also to draw on different mediums. E.g. for drawing into textures or exporting as HTML & CSS code.

Creating a paint-engine is done by subclassing this class and implementing the abstract functions.

Note
Even though the name may suggest this is the equivalent to Qt's QPaintEngine, this is more of a combination of both, QPaintEngine and QPaintDevice.

Constructor & Destructor Documentation

◆ ~bwPaintEngine()

virtual bWidgets::bwPaintEngine::~bwPaintEngine ( )
virtualdefault

Member Function Documentation

◆ drawIcon()

virtual void bWidgets::bwPaintEngine::drawIcon ( const class bwPainter painter,
const class bwIconInterface icon_interface,
const bwRectanglePixel rect 
)
pure virtual

Draw the icon referenced by icon_interface.

Parameters
painterProvides all aditional information needed for drawing (e.g. color for theme controlled monochrome icons etc.).
rectThe bounding-box to draw the icon into.

◆ drawPolygon()

virtual void bWidgets::bwPaintEngine::drawPolygon ( const class bwPainter painter,
const class bwPolygon polygon 
)
pure virtual

The main polygon draw function which is used to draw all geometry of widgets.

Parameters
painterProvides all aditional information needed for drawing (color, draw-style, etc.).

◆ drawText()

virtual void bWidgets::bwPaintEngine::drawText ( const class bwPainter painter,
const std::string &  text,
const bwRectanglePixel rect,
const TextAlignment  alignment 
)
pure virtual

The main text draw function which is used to draw all text of widgets.

Parameters
painterProvides all aditional information needed for drawing (color, draw-style, etc.).
rectThe bounding-box to draw the text into.

◆ enableMask()

virtual void bWidgets::bwPaintEngine::enableMask ( const bwRectanglePixel rect)
pure virtual

◆ setupViewport()

virtual void bWidgets::bwPaintEngine::setupViewport ( const bwRectanglePixel rect,
const class bwColor clear_color 
)
pure virtual

Setup function for application to prepare viewport (prepare matrices, clear background, etc.) for drawing.

Note
bWidgets doesn't call this itself, this is just a utility for the application to use.
Parameters
rectThe rectangle defining the viewport location and size.
clear_colorColor to be used for buffer clearing.

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