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

Helper class for basic canvas functionality. More...

#include <canvashelper.hxx>

Inheritance diagram for vclcanvas::CanvasHelper:
[legend]

Public Types

enum  ColorType {
  LINE_COLOR ,
  FILL_COLOR ,
  TEXT_COLOR ,
  IGNORE_COLOR
}
 

Public Member Functions

 CanvasHelper ()
 Create canvas helper. More...
 
 CanvasHelper (const CanvasHelper &)=delete
 make noncopyable More...
 
const CanvasHelperoperator= (const CanvasHelper &)=delete
 
void disposing ()
 Release all references. More...
 
void init (css::rendering::XGraphicDevice &rDevice, const OutDevProviderSharedPtr &rOutDev, bool bProtect, bool bHaveAlpha)
 Initialize canvas helper. More...
 
void setOutDev (const OutDevProviderSharedPtr &rOutDev, bool bProtect)
 Set primary output device. More...
 
void setBackgroundOutDev (const OutDevProviderSharedPtr &rOutDev)
 Set secondary output device. More...
 
void clear ()
 
void drawLine (const css::rendering::XCanvas *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, const css::rendering::FontInfo &aFilter, const css::uno::Sequence< css::beans::PropertyValue > &aFontProperties)
 
css::uno::Reference< css::rendering::XCachedPrimitive > drawText (const css::rendering::XCanvas *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 *rCanvas, 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 ()
 
css::geometry::IntegerSize2D getSize ()
 
css::uno::Reference< css::rendering::XBitmap > getScaledBitmap (const css::geometry::RealSize2D &newSize, bool beFast)
 
css::uno::Sequence< sal_Int8getData (css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerRectangle2D &rect)
 
css::uno::Sequence< sal_Int8getPixel (css::rendering::IntegerBitmapLayout &bitmapLayout, const css::geometry::IntegerPoint2D &pos)
 
css::rendering::IntegerBitmapLayout getMemoryLayout ()
 
bool repaint (const GraphicObjectSharedPtr &rGrf, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const ::Point &rPt, const ::Size &rSz, const GraphicAttr &rAttr) const
 Repaint a cached bitmap. More...
 
void flush () const
 Flush drawing queue. More...
 
int setupOutDevState (const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, ColorType eColorType) const
 
bool hasAlpha () const
 

Protected Attributes

css::rendering::XGraphicDevice * mpDevice
 Phyical output device. More...
 
OutDevProviderSharedPtr mpProtectedOutDevProvider
 Rendering to this outdev preserves its state. More...
 
OutDevProviderSharedPtr mpOutDevProvider
 Rendering to this outdev does not preserve its state. More...
 
OutDevProviderSharedPtr mp2ndOutDevProvider
 Rendering to this outdev does not preserve its state. More...
 
bool mbHaveAlpha
 When true, content is able to represent alpha. More...
 

Private Member Functions

css::uno::Reference< css::rendering::XCachedPrimitive > implDrawBitmap (const css::rendering::XCanvas *rCanvas, const css::uno::Reference< css::rendering::XBitmap > &xBitmap, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, bool bModulateColors)
 
bool setupTextOutput (::Point &o_rOutPos, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState, const css::uno::Reference< css::rendering::XCanvasFont > &xFont) const
 

Detailed Description

Helper class for basic canvas functionality.

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

Definition at line 39 of file canvashelper.hxx.

Member Enumeration Documentation

◆ ColorType

Enumerator
LINE_COLOR 
FILL_COLOR 
TEXT_COLOR 
IGNORE_COLOR 

Definition at line 260 of file canvashelper.hxx.

Constructor & Destructor Documentation

◆ CanvasHelper() [1/2]

vclcanvas::CanvasHelper::CanvasHelper ( )

Create canvas helper.

Definition at line 106 of file canvashelper.cxx.

◆ CanvasHelper() [2/2]

vclcanvas::CanvasHelper::CanvasHelper ( const CanvasHelper )
delete

make noncopyable

Member Function Documentation

◆ clear()

void vclcanvas::CanvasHelper::clear ( )

◆ createFont()

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

◆ disposing()

void vclcanvas::CanvasHelper::disposing ( )

◆ drawBezier()

void vclcanvas::CanvasHelper::drawBezier ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::drawBitmap ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::drawBitmapModulated ( const css::rendering::XCanvas *  rCanvas,
const css::uno::Reference< css::rendering::XBitmap > &  xBitmap,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ drawLine()

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

◆ drawPolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > vclcanvas::CanvasHelper::drawPolyPolygon ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::drawText ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::drawTextLayout ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::fillPolyPolygon ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::fillTexturedPolyPolygon ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::fillTextureMappedPolyPolygon ( const css::rendering::XCanvas *  rCanvas,
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 vclcanvas::CanvasHelper::flush ( ) const

Flush drawing queue.

This only works for Window canvases, and ensures that all pending render operations are flushed to the driver/hardware.

Definition at line 1173 of file canvashelper.cxx.

References mp2ndOutDevProvider, and mpOutDevProvider.

Referenced by vclcanvas::SpriteCanvasHelper::updateScreen().

◆ getData()

css::uno::Sequence< sal_Int8 > vclcanvas::CanvasHelper::getData ( css::rendering::IntegerBitmapLayout &  bitmapLayout,
const css::geometry::IntegerRectangle2D &  rect 
)

◆ getDevice()

css::uno::Reference< css::rendering::XGraphicDevice > vclcanvas::CanvasHelper::getDevice ( )
inline

Definition at line 222 of file canvashelper.hxx.

References mpDevice.

◆ getMemoryLayout()

rendering::IntegerBitmapLayout vclcanvas::CanvasHelper::getMemoryLayout ( )

◆ getPixel()

css::uno::Sequence< sal_Int8 > vclcanvas::CanvasHelper::getPixel ( css::rendering::IntegerBitmapLayout &  bitmapLayout,
const css::geometry::IntegerPoint2D &  pos 
)

◆ getScaledBitmap()

css::uno::Reference< css::rendering::XBitmap > vclcanvas::CanvasHelper::getScaledBitmap ( const css::geometry::RealSize2D &  newSize,
bool  beFast 
)

◆ getSize()

geometry::IntegerSize2D vclcanvas::CanvasHelper::getSize ( )

Definition at line 893 of file canvashelper.cxx.

References vcl::unotools::integerSize2DFromSize(), and mpOutDevProvider.

Referenced by getMemoryLayout().

◆ hasAlpha()

bool vclcanvas::CanvasHelper::hasAlpha ( ) const
inline

Definition at line 270 of file canvashelper.hxx.

References mbHaveAlpha.

Referenced by vclcanvas::CanvasBitmapHelper::getMemoryLayout().

◆ implDrawBitmap()

uno::Reference< rendering::XCachedPrimitive > vclcanvas::CanvasHelper::implDrawBitmap ( const css::rendering::XCanvas *  rCanvas,
const css::uno::Reference< css::rendering::XBitmap > &  xBitmap,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
bool  bModulateColors 
)
private

◆ init()

void vclcanvas::CanvasHelper::init ( css::rendering::XGraphicDevice &  rDevice,
const OutDevProviderSharedPtr rOutDev,
bool  bProtect,
bool  bHaveAlpha 
)

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
rOutDevSet primary output device for this canvas. That's where all content is output to.
bProtectWhen true, all output operations preserve outdev state. When false, outdev state might change at any time.
bHaveAlphaWhen true, hasAlpha() will always return true, otherwise, false.

Referenced by vclcanvas::CanvasBitmapHelper::init(), and vclcanvas::SpriteCanvasHelper::init().

◆ operator=()

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

◆ queryAvailableFonts()

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

◆ queryStrokeShapes()

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

◆ repaint()

bool vclcanvas::CanvasHelper::repaint ( const GraphicObjectSharedPtr rGrf,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const ::Point rPt,
const ::Size rSz,
const GraphicAttr rAttr 
) const

Repaint a cached bitmap.

◆ setBackgroundOutDev()

void vclcanvas::CanvasHelper::setBackgroundOutDev ( const OutDevProviderSharedPtr rOutDev)

Set secondary output device.

Used for sprites, to generate mask bitmap.

Definition at line 144 of file canvashelper.cxx.

References mp2ndOutDevProvider.

◆ setOutDev()

void vclcanvas::CanvasHelper::setOutDev ( const OutDevProviderSharedPtr rOutDev,
bool  bProtect 
)

Set primary output device.

This changes the primary output device, where rendering is sent to.

Definition at line 133 of file canvashelper.cxx.

References mpOutDevProvider, and mpProtectedOutDevProvider.

◆ setupOutDevState()

int vclcanvas::CanvasHelper::setupOutDevState ( const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
ColorType  eColorType 
) const

◆ setupTextOutput()

bool vclcanvas::CanvasHelper::setupTextOutput ( ::Point o_rOutPos,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
const css::uno::Reference< css::rendering::XCanvasFont > &  xFont 
) const
private

◆ strokePolyPolygon()

css::uno::Reference< css::rendering::XCachedPrimitive > vclcanvas::CanvasHelper::strokePolyPolygon ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::strokeTexturedPolyPolygon ( const css::rendering::XCanvas *  rCanvas,
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 > vclcanvas::CanvasHelper::strokeTextureMappedPolyPolygon ( const css::rendering::XCanvas *  rCanvas,
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

◆ mbHaveAlpha

bool vclcanvas::CanvasHelper::mbHaveAlpha
protected

When true, content is able to represent alpha.

Definition at line 290 of file canvashelper.hxx.

Referenced by getMemoryLayout(), and hasAlpha().

◆ mp2ndOutDevProvider

OutDevProviderSharedPtr vclcanvas::CanvasHelper::mp2ndOutDevProvider
protected

Rendering to this outdev does not preserve its state.

Definition at line 287 of file canvashelper.hxx.

Referenced by clear(), disposing(), flush(), implDrawBitmap(), setBackgroundOutDev(), setupOutDevState(), and setupTextOutput().

◆ mpDevice

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

Phyical output device.

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

Definition at line 278 of file canvashelper.hxx.

Referenced by disposing(), getDevice(), vclcanvas::CanvasBitmapHelper::getScaledBitmap(), implDrawBitmap(), and setupOutDevState().

◆ mpOutDevProvider

OutDevProviderSharedPtr vclcanvas::CanvasHelper::mpOutDevProvider
protected

Rendering to this outdev does not preserve its state.

Definition at line 284 of file canvashelper.hxx.

Referenced by clear(), disposing(), flush(), getMemoryLayout(), vclcanvas::CanvasBitmapHelper::getMemoryLayout(), getSize(), implDrawBitmap(), setOutDev(), setupOutDevState(), and setupTextOutput().

◆ mpProtectedOutDevProvider

OutDevProviderSharedPtr vclcanvas::CanvasHelper::mpProtectedOutDevProvider
protected

Rendering to this outdev preserves its state.

Definition at line 281 of file canvashelper.hxx.

Referenced by clear(), disposing(), implDrawBitmap(), and setOutDev().


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