LibreOffice Module canvas (master) 1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dxcanvas::CanvasHelper Class Reference

Helper class for basic canvas functionality. More...

#include <dx_canvashelper.hxx>

Inheritance diagram for dxcanvas::CanvasHelper:
[legend]
Collaboration diagram for dxcanvas::CanvasHelper:
[legend]

Public Member Functions

 CanvasHelper ()
 
 CanvasHelper (const CanvasHelper &)=delete
 make noncopyable More...
 
const CanvasHelperoperator= (const CanvasHelper &)=delete
 
void disposing ()
 Release all references. More...
 
void setDevice (css::rendering::XGraphicDevice &rDevice)
 Initialize canvas helper. More...
 
void setTarget (const GraphicsProviderSharedPtr &rTarget)
 Set the target for rendering operations. More...
 
void setTarget (const GraphicsProviderSharedPtr &rTarget, const ::basegfx::B2ISize &rOutputOffset)
 Set the target for rendering operations. More...
 
void clear ()
 
void drawPoint (const css::rendering::XCanvas *pCanvas, const css::geometry::RealPoint2D &aPoint, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
void drawLine (const css::rendering::XCanvas *pCanvas, const css::geometry::RealPoint2D &aStartPoint, const css::geometry::RealPoint2D &aEndPoint, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
void drawBezier (const css::rendering::XCanvas *pCanvas, const css::geometry::RealBezierSegment2D &aBezierSegment, const css::geometry::RealPoint2D &aEndPoint, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
css::uno::Reference< css::rendering::XCachedPrimitive > drawPolyPolygon (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
css::uno::Reference< css::rendering::XCachedPrimitive > strokePolyPolygon (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const css::rendering::StrokeAttributes &strokeAttributes)
 
css::uno::Reference< css::rendering::XCachedPrimitive > strokeTexturedPolyPolygon (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const css::uno::Sequence< css::rendering::Texture > &textures, const css::rendering::StrokeAttributes &strokeAttributes)
 
css::uno::Reference< css::rendering::XCachedPrimitive > strokeTextureMappedPolyPolygon (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const css::uno::Sequence< css::rendering::Texture > &textures, const css::uno::Reference< css::geometry::XMapping2D > &xMapping, const css::rendering::StrokeAttributes &strokeAttributes)
 
css::uno::Reference< css::rendering::XPolyPolygon2D > queryStrokeShapes (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const css::rendering::StrokeAttributes &strokeAttributes)
 
css::uno::Reference< css::rendering::XCachedPrimitive > fillPolyPolygon (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
css::uno::Reference< css::rendering::XCachedPrimitive > fillTexturedPolyPolygon (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const css::uno::Sequence< css::rendering::Texture > &textures)
 
css::uno::Reference< css::rendering::XCachedPrimitive > fillTextureMappedPolyPolygon (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XPolyPolygon2D > &xPolyPolygon, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const css::uno::Sequence< css::rendering::Texture > &textures, const css::uno::Reference< css::geometry::XMapping2D > &xMapping)
 
css::uno::Reference< css::rendering::XCanvasFont > createFont (const css::rendering::XCanvas *pCanvas, const css::rendering::FontRequest &fontRequest, const css::uno::Sequence< css::beans::PropertyValue > &extraFontProperties, const css::geometry::Matrix2D &fontMatrix)
 
css::uno::Sequence< css::rendering::FontInfo > queryAvailableFonts (const css::rendering::XCanvas *pCanvas, const css::rendering::FontInfo &aFilter, const css::uno::Sequence< css::beans::PropertyValue > &aFontProperties)
 
css::uno::Reference< css::rendering::XCachedPrimitive > drawText (const css::rendering::XCanvas *pCanvas, const css::rendering::StringContext &text, const css::uno::Reference< css::rendering::XCanvasFont > &xFont, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, sal_Int8 textDirection)
 
css::uno::Reference< css::rendering::XCachedPrimitive > drawTextLayout (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XTextLayout > &laidOutText, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
css::uno::Reference< css::rendering::XCachedPrimitive > drawBitmap (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XBitmap > &xBitmap, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
css::uno::Reference< css::rendering::XCachedPrimitive > drawBitmapModulated (const css::rendering::XCanvas *pCanvas, const css::uno::Reference< css::rendering::XBitmap > &xBitmap, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
css::uno::Reference< css::rendering::XGraphicDevice > getDevice ()
 
void flush () const
 
void modifying ()
 Called from XCanvas base classes, to notify that content is about to change. More...
 

Protected Member Functions

bool needOutput () const
 
void setupGraphicsState (GraphicsSharedPtr const &rGraphics, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
Gdiplus::CompositingMode calcCompositingMode (sal_Int8 nMode)
 

Protected Attributes

GDIPlusUserSharedPtr mpGdiPlusUser
 Refcounted global GDI+ state container. More...
 
css::rendering::XGraphicDevice * mpDevice
 Phyical output device. More...
 
GraphicsProviderSharedPtr mpGraphicsProvider
 Provides the Gdiplus::Graphics to render into. More...
 
::basegfx::B2ISize maOutputOffset
 Current (transformation-independent) output buffer offset. More...
 

Detailed Description

Helper class for basic canvas functionality.

Also offers optional backbuffer painting, when providing it with a second HDC to render into.

Definition at line 40 of file dx_canvashelper.hxx.

Constructor & Destructor Documentation

◆ CanvasHelper() [1/2]

dxcanvas::CanvasHelper::CanvasHelper ( )

Definition at line 126 of file dx_canvashelper.cxx.

References createInstance().

◆ CanvasHelper() [2/2]

dxcanvas::CanvasHelper::CanvasHelper ( const CanvasHelper )
delete

make noncopyable

Member Function Documentation

◆ calcCompositingMode()

Gdiplus::CompositingMode dxcanvas::CanvasHelper::calcCompositingMode ( sal_Int8  nMode)
protected

Definition at line 683 of file dx_canvashelper.cxx.

References ENSURE_OR_THROW.

◆ clear()

void dxcanvas::CanvasHelper::clear ( )

Definition at line 168 of file dx_canvashelper.cxx.

References ENSURE_OR_THROW, mpGraphicsProvider, and needOutput().

◆ createFont()

css::uno::Reference< css::rendering::XCanvasFont > dxcanvas::CanvasHelper::createFont ( const css::rendering::XCanvas *  pCanvas,
const css::rendering::FontRequest &  fontRequest,
const css::uno::Sequence< css::beans::PropertyValue > &  extraFontProperties,
const css::geometry::Matrix2D &  fontMatrix 
)

◆ disposing()

void dxcanvas::CanvasHelper::disposing ( )

Release all references.

Definition at line 134 of file dx_canvashelper.cxx.

References mpDevice, mpGdiPlusUser, and mpGraphicsProvider.

Referenced by dxcanvas::BitmapCanvasHelper::disposing(), and dxcanvas::SpriteCanvasHelper::disposing().

◆ drawBezier()

void dxcanvas::CanvasHelper::drawBezier ( const css::rendering::XCanvas *  pCanvas,
const css::geometry::RealBezierSegment2D &  aBezierSegment,
const css::geometry::RealPoint2D &  aEndPoint,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ drawBitmap()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::drawBitmap ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XBitmap > &  xBitmap,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ drawBitmapModulated()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::drawBitmapModulated ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XBitmap > &  xBitmap,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ drawLine()

void dxcanvas::CanvasHelper::drawLine ( const css::rendering::XCanvas *  pCanvas,
const css::geometry::RealPoint2D &  aStartPoint,
const css::geometry::RealPoint2D &  aEndPoint,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ drawPoint()

void dxcanvas::CanvasHelper::drawPoint ( const css::rendering::XCanvas *  pCanvas,
const css::geometry::RealPoint2D &  aPoint,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ drawPolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::drawPolyPolygon ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ drawText()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::drawText ( const css::rendering::XCanvas *  pCanvas,
const css::rendering::StringContext &  text,
const css::uno::Reference< css::rendering::XCanvasFont > &  xFont,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
sal_Int8  textDirection 
)

◆ drawTextLayout()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::drawTextLayout ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XTextLayout > &  laidOutText,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ fillPolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::fillPolyPolygon ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ fillTexturedPolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::fillTexturedPolyPolygon ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const css::uno::Sequence< css::rendering::Texture > &  textures 
)

◆ fillTextureMappedPolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::fillTextureMappedPolyPolygon ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const css::uno::Sequence< css::rendering::Texture > &  textures,
const css::uno::Reference< css::geometry::XMapping2D > &  xMapping 
)

◆ flush()

void dxcanvas::CanvasHelper::flush ( ) const

Definition at line 807 of file dx_canvashelper.cxx.

References mpGraphicsProvider, and needOutput().

◆ getDevice()

uno::Reference< rendering::XGraphicDevice > dxcanvas::CanvasHelper::getDevice ( )

Definition at line 675 of file dx_canvashelper.cxx.

References mpDevice.

◆ modifying()

void dxcanvas::CanvasHelper::modifying ( )
inline

Called from XCanvas base classes, to notify that content is about to change.

Definition at line 222 of file dx_canvashelper.hxx.

◆ needOutput()

bool dxcanvas::CanvasHelper::needOutput ( ) const
inlineprotected

◆ operator=()

const CanvasHelper & dxcanvas::CanvasHelper::operator= ( const CanvasHelper )
delete

◆ queryAvailableFonts()

css::uno::Sequence< css::rendering::FontInfo > dxcanvas::CanvasHelper::queryAvailableFonts ( const css::rendering::XCanvas *  pCanvas,
const css::rendering::FontInfo &  aFilter,
const css::uno::Sequence< css::beans::PropertyValue > &  aFontProperties 
)

◆ queryStrokeShapes()

css::uno::Reference< css::rendering::XPolyPolygon2D > dxcanvas::CanvasHelper::queryStrokeShapes ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const css::rendering::StrokeAttributes &  strokeAttributes 
)

◆ setDevice()

void dxcanvas::CanvasHelper::setDevice ( css::rendering::XGraphicDevice &  rDevice)

Initialize canvas helper.

This method late-initializes the canvas helper, providing it with the necessary device and output objects. Note that the CanvasHelper does not take ownership of the passed rDevice reference, nor does it perform any reference counting. Thus, to prevent the reference counted SpriteCanvas object from deletion, the user of this class is responsible for holding ref-counted references itself!

Parameters
rDeviceReference device this canvas is associated with

Definition at line 141 of file dx_canvashelper.cxx.

References mpDevice.

Referenced by dxcanvas::SpriteCanvasHelper::init().

◆ setTarget() [1/2]

void dxcanvas::CanvasHelper::setTarget ( const GraphicsProviderSharedPtr rTarget)

Set the target for rendering operations.

Parameters
rTargetRender target

Definition at line 146 of file dx_canvashelper.cxx.

References ENSURE_OR_THROW, mpGraphicsProvider, and rTarget.

Referenced by dxcanvas::BitmapCanvasHelper::setTarget().

◆ setTarget() [2/2]

void dxcanvas::CanvasHelper::setTarget ( const GraphicsProviderSharedPtr rTarget,
const ::basegfx::B2ISize rOutputOffset 
)

Set the target for rendering operations.

Parameters
rTargetRender target
rOutputOffsetOutput offset in pixel

Definition at line 156 of file dx_canvashelper.cxx.

References ENSURE_OR_THROW, maOutputOffset, mpGraphicsProvider, and rTarget.

◆ setupGraphicsState()

void dxcanvas::CanvasHelper::setupGraphicsState ( GraphicsSharedPtr const &  rGraphics,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)
protected

Referenced by drawPoint().

◆ strokePolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::strokePolyPolygon ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const css::rendering::StrokeAttributes &  strokeAttributes 
)

◆ strokeTexturedPolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::strokeTexturedPolyPolygon ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const css::uno::Sequence< css::rendering::Texture > &  textures,
const css::rendering::StrokeAttributes &  strokeAttributes 
)

◆ strokeTextureMappedPolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > dxcanvas::CanvasHelper::strokeTextureMappedPolyPolygon ( const css::rendering::XCanvas *  pCanvas,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPolyPolygon,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const css::uno::Sequence< css::rendering::Texture > &  textures,
const css::uno::Reference< css::geometry::XMapping2D > &  xMapping,
const css::rendering::StrokeAttributes &  strokeAttributes 
)

Member Data Documentation

◆ maOutputOffset

::basegfx::B2ISize dxcanvas::CanvasHelper::maOutputOffset
protected

Current (transformation-independent) output buffer offset.

Definition at line 248 of file dx_canvashelper.hxx.

Referenced by dxcanvas::BitmapCanvasHelper::drawTextLayout(), and setTarget().

◆ mpDevice

css::rendering::XGraphicDevice* dxcanvas::CanvasHelper::mpDevice
protected

Phyical output device.

Deliberately not a refcounted reference, because of potential circular references for spritecanvas.

Definition at line 233 of file dx_canvashelper.hxx.

Referenced by disposing(), dxcanvas::BitmapCanvasHelper::drawTextLayout(), getDevice(), and setDevice().

◆ mpGdiPlusUser

GDIPlusUserSharedPtr dxcanvas::CanvasHelper::mpGdiPlusUser
protected

Refcounted global GDI+ state container.

Definition at line 226 of file dx_canvashelper.hxx.

Referenced by disposing().

◆ mpGraphicsProvider

GraphicsProviderSharedPtr dxcanvas::CanvasHelper::mpGraphicsProvider
protected

Provides the Gdiplus::Graphics to render into.

Definition at line 236 of file dx_canvashelper.hxx.

Referenced by clear(), disposing(), drawPoint(), flush(), needOutput(), and setTarget().


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