NDEVR
API Documentation
ScenePaintEngine

A QPaintEngine that 'paints' the widgets by turning them into 3D Model objects. More...

Collaboration diagram for ScenePaintEngine:
[legend]

Public Member Functions

 ScenePaintEngine (Model &scene)
 Constructs a scene paint engine rooted at the given model.
Material createCurrentMaterial (PrimitiveProperty property, bool is_text)
 Creates a new material for the given property type using current paint state.
Material currentMaterial (PrimitiveProperty property, bool is_text)
 Retrieves or creates the current material for the given property type.
void finishShape (bool is_solid)
 Finalizes the current shape model after geometry creation.
Matrix< fltp08getTransform (bool is_text) const
 Computes the current transform matrix for painting.
bool hasOutline () const
 Checks whether the current paint state has an outline pen.
bool hasSolid () const
 Checks whether the current paint state has a solid brush.
bool isFlat () const
 Checks whether the engine is in flat (2D) mode.
void popModel ()
 Pops the current model from the model stack, returning to the parent.
void pushModel ()
 Pushes a new child model onto the model stack for nested painting.
void resetExtraDepth ()
 Resets the extra depth counter used for z-ordering painted elements.
void setCurrentName (const String &current_name)
 Sets the current name used for naming new child models.
void setIsFlat (bool is_flat)
 Sets whether the output should be flat (2D) or hierarchical.
void setRoot (Model &new_root)
 Sets the root model for the paint engine.
void setupShapeModel (Model &model, bool has_solid=true, bool is_text=false)
 Sets up a model for a painted shape with appropriate materials.
void updateClipping (Model &model)
 Updates the clipping region for the given model.

Static Public Member Functions

static void AutoWidgetsToPDF (File file, WidgetIterator reports, QSize size=QSize(), bool send_file=false)
 Converts widget reports to a PDF file and optionally sends the file.
static void ModelsToPDF (const File &file, DesignObjectLookup &lookup, const Buffer< UUID > &camera_ids, fltp08 dpi, fltp04 margins=20.0f)
 Renders 3D model views to a PDF file.
static void PrepareWidgetsToModel (const Buffer< QWidget * > &widgets, QSize size=QSize())
 Prepares widgets for model conversion by resizing and laying out.
static Buffer< UUIDPrepareWidgetsViews (DesignObjectLookup &lookup, const Buffer< QWidget * > &widgets, QSize size=QSize())
 Prepares camera views from widgets for rendering.
static Buffer< UUIDPrepareWidgetsViews (DesignObjectLookup &lookup, const WidgetIterator &reports, QSize size=QSize())
 Prepares camera views from widget reports for rendering.
static QPalette ScenePalette ()
 Retrieves the palette used for scene painting.
static PaintEngineFeatures SceneRenderFeatures ()
 Retrieves the supported paint engine features for scene rendering.
static QStyle * SceneStyle ()
 Retrieves the style used for scene painting.
static Buffer< QSize > WidgetsToModel (const WidgetIterator &reports, Model &model, QSize size=QSize(), bool is_flat=false)
 Converts widget reports into 3D model objects.
static void WidgetsToPDF (const File &file, const Buffer< QWidget * > &widgets, QSize size=QSize())
 Renders widgets directly to a PDF file.

Protected Attributes

String m_current_image
 The current image resource identifier being drawn.
uint04 m_extra_depth = 0
 Extra depth offset for z-ordering painted elements.
uint04 m_geometry_depth = 0
 The current geometry depth in the hierarchy.
bool m_is_clipping
 Whether clipping is currently active.
bool m_is_flat = false
 Whether the engine is in flat (2D) mode.
Dictionary< UUID, Materialm_materials
 Cache of materials created during painting.
Buffer< Modelm_models
 Stack of models for nested painting.
Model m_root
 The root model of the paint hierarchy.

Detailed Description

A QPaintEngine that 'paints' the widgets by turning them into 3D Model objects.


Definition at line 95 of file ScenePaintEngine.h.

Constructor & Destructor Documentation

◆ ScenePaintEngine()

ScenePaintEngine::ScenePaintEngine ( Model & scene)
explicit

Constructs a scene paint engine rooted at the given model.

Parameters
[in]sceneThe root model for the paint hierarchy.

Member Function Documentation

◆ AutoWidgetsToPDF()

void ScenePaintEngine::AutoWidgetsToPDF ( File file,
WidgetIterator reports,
QSize size = QSize(),
bool send_file = false )
static

Converts widget reports to a PDF file and optionally sends the file.

Parameters
[in]fileThe output PDF file path.
[in]reportsThe widget iterator providing report pages.
[in]sizeThe page size, or default if empty.
[in]send_fileWhether to open or send the file after creation.

◆ createCurrentMaterial()

Material ScenePaintEngine::createCurrentMaterial ( PrimitiveProperty property,
bool is_text )

Creates a new material for the given property type using current paint state.

Parameters
[in]propertyThe primitive property (solid or outline).
[in]is_textWhether the material is for text.
Returns
The newly created Material.

◆ currentMaterial()

Material ScenePaintEngine::currentMaterial ( PrimitiveProperty property,
bool is_text )

Retrieves or creates the current material for the given property type.

Parameters
[in]propertyThe primitive property (solid or outline).
[in]is_textWhether the material is for text.
Returns
The current Material.

◆ finishShape()

void ScenePaintEngine::finishShape ( bool is_solid)

Finalizes the current shape model after geometry creation.

Parameters
[in]is_solidWhether the shape has solid fill.

◆ getTransform()

Matrix< fltp08 > ScenePaintEngine::getTransform ( bool is_text) const

Computes the current transform matrix for painting.

Parameters
[in]is_textWhether the transform is for text rendering.
Returns
The current transform matrix.

Referenced by resetExtraDepth(), and SceneStyle().

◆ hasOutline()

bool ScenePaintEngine::hasOutline ( ) const
nodiscard

Checks whether the current paint state has an outline pen.

Returns
True if an outline is active.

◆ hasSolid()

bool ScenePaintEngine::hasSolid ( ) const
nodiscard

Checks whether the current paint state has a solid brush.

Returns
True if a solid fill is active.

◆ isFlat()

bool ScenePaintEngine::isFlat ( ) const
inline

Checks whether the engine is in flat (2D) mode.

Returns
True if in flat mode.

Definition at line 447 of file ScenePaintEngine.h.

References m_is_flat.

◆ ModelsToPDF()

void ScenePaintEngine::ModelsToPDF ( const File & file,
DesignObjectLookup & lookup,
const Buffer< UUID > & camera_ids,
fltp08 dpi,
fltp04 margins = 20.0f )
static

Renders 3D model views to a PDF file.

Parameters
[in]fileThe output PDF file path.
[in]lookupThe design object lookup.
[in]camera_idsThe camera UUIDs to capture.
[in]dpiThe DPI resolution for the output.
[in]marginsThe page margins in points.

◆ PrepareWidgetsToModel()

void ScenePaintEngine::PrepareWidgetsToModel ( const Buffer< QWidget * > & widgets,
QSize size = QSize() )
static

Prepares widgets for model conversion by resizing and laying out.

Parameters
[in]widgetsThe widgets to prepare.
[in]sizeThe target size, or default if empty.

◆ PrepareWidgetsViews() [1/2]

Buffer< UUID > ScenePaintEngine::PrepareWidgetsViews ( DesignObjectLookup & lookup,
const Buffer< QWidget * > & widgets,
QSize size = QSize() )
static

Prepares camera views from widgets for rendering.

Parameters
[in]lookupThe design object lookup for creating objects.
[in]widgetsThe widgets to convert.
[in]sizeThe page size, or default if empty.
Returns
A buffer of camera UUIDs for the prepared views.

◆ PrepareWidgetsViews() [2/2]

Buffer< UUID > ScenePaintEngine::PrepareWidgetsViews ( DesignObjectLookup & lookup,
const WidgetIterator & reports,
QSize size = QSize() )
static

Prepares camera views from widget reports for rendering.

Parameters
[in]lookupThe design object lookup for creating objects.
[in]reportsThe widget iterator providing report pages.
[in]sizeThe page size, or default if empty.
Returns
A buffer of camera UUIDs for the prepared views.

◆ ScenePalette()

QPalette ScenePaintEngine::ScenePalette ( )
static

Retrieves the palette used for scene painting.

Returns
The QPalette for scene widgets.

◆ SceneRenderFeatures()

PaintEngineFeatures ScenePaintEngine::SceneRenderFeatures ( )
static

Retrieves the supported paint engine features for scene rendering.

Returns
The set of supported PaintEngineFeatures.

◆ SceneStyle()

QStyle * ScenePaintEngine::SceneStyle ( )
static

Retrieves the style used for scene painting.

Returns
A pointer to the QStyle for scene widgets.

References cast(), Geometry::e_cartesian_3F, e_points, getTransform(), m_is_flat, m_models, name, Position, setupShapeModel(), and transform.

◆ setCurrentName()

void ScenePaintEngine::setCurrentName ( const String & current_name)

Sets the current name used for naming new child models.

Parameters
[in]current_nameThe name to use.

◆ setIsFlat()

void ScenePaintEngine::setIsFlat ( bool is_flat)
inline

Sets whether the output should be flat (2D) or hierarchical.

Parameters
[in]is_flatWhether to use flat mode.

Definition at line 442 of file ScenePaintEngine.h.

References m_is_flat.

◆ setRoot()

void ScenePaintEngine::setRoot ( Model & new_root)

Sets the root model for the paint engine.

Parameters
[in]new_rootThe new root model.

◆ setupShapeModel()

void ScenePaintEngine::setupShapeModel ( Model & model,
bool has_solid = true,
bool is_text = false )

Sets up a model for a painted shape with appropriate materials.

Parameters
[in]modelThe model to configure.
[in]has_solidWhether the shape has solid fill.
[in]is_textWhether the shape is text.

Referenced by resetExtraDepth(), and SceneStyle().

◆ updateClipping()

void ScenePaintEngine::updateClipping ( Model & model)

Updates the clipping region for the given model.

Parameters
[in]modelThe model to update clipping for.

◆ WidgetsToModel()

Buffer< QSize > ScenePaintEngine::WidgetsToModel ( const WidgetIterator & reports,
Model & model,
QSize size = QSize(),
bool is_flat = false )
static

Converts widget reports into 3D model objects.

Parameters
[in]reportsThe widget iterator providing report pages.
[in]modelThe root model to add the widget models under.
[in]sizeThe page size, or default if empty.
[in]is_flatWhether to flatten the model hierarchy.
Returns
A buffer of sizes for each generated page.

◆ WidgetsToPDF()

void ScenePaintEngine::WidgetsToPDF ( const File & file,
const Buffer< QWidget * > & widgets,
QSize size = QSize() )
static

Renders widgets directly to a PDF file.

Parameters
[in]fileThe output PDF file path.
[in]widgetsThe widgets to render.
[in]sizeThe page size, or default if empty.

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