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 43 of file canvashelper.hxx.

Member Enumeration Documentation

Enumerator
LINE_COLOR 
FILL_COLOR 
TEXT_COLOR 
IGNORE_COLOR 

Definition at line 264 of file canvashelper.hxx.

Constructor & Destructor Documentation

vclcanvas::CanvasHelper::CanvasHelper ( )

Create canvas helper.

Definition at line 111 of file canvashelper.cxx.

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

make noncopyable

Member Function Documentation

void vclcanvas::CanvasHelper::clear ( )
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 
)
void vclcanvas::CanvasHelper::disposing ( )
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 
)
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 
)
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 
)
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 
)
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 
)
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 
)
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 
)
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 
)
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 
)
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 
)
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 1159 of file canvashelper.cxx.

References mp2ndOutDevProvider, and mpOutDevProvider.

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

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

Definition at line 226 of file canvashelper.hxx.

References mpDevice.

rendering::IntegerBitmapLayout vclcanvas::CanvasHelper::getMemoryLayout ( )
css::uno::Sequence< sal_Int8 > vclcanvas::CanvasHelper::getPixel ( css::rendering::IntegerBitmapLayout &  bitmapLayout,
const css::geometry::IntegerPoint2D &  pos 
)
css::uno::Reference< css::rendering::XBitmap > vclcanvas::CanvasHelper::getScaledBitmap ( const css::geometry::RealSize2D &  newSize,
bool  beFast 
)
geometry::IntegerSize2D vclcanvas::CanvasHelper::getSize ( )

Definition at line 879 of file canvashelper.cxx.

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

Referenced by getMemoryLayout().

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

Definition at line 274 of file canvashelper.hxx.

References mbHaveAlpha.

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

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
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::SpriteCanvasHelper::init(), and vclcanvas::CanvasBitmapHelper::init().

const CanvasHelper& vclcanvas::CanvasHelper::operator= ( const CanvasHelper )
delete
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 
)
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 
)
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.

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

Set secondary output device.

Used for sprites, to generate mask bitmap.

Definition at line 152 of file canvashelper.cxx.

References mp2ndOutDevProvider.

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 141 of file canvashelper.cxx.

References mpOutDevProvider, and mpProtectedOutDevProvider.

int vclcanvas::CanvasHelper::setupOutDevState ( const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState,
ColorType  eColorType 
) const
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
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 
)
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 
)
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

bool vclcanvas::CanvasHelper::mbHaveAlpha
protected

When true, content is able to represent alpha.

Definition at line 294 of file canvashelper.hxx.

Referenced by getMemoryLayout(), and hasAlpha().

OutDevProviderSharedPtr vclcanvas::CanvasHelper::mp2ndOutDevProvider
protected

Rendering to this outdev does not preserve its state.

Definition at line 291 of file canvashelper.hxx.

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

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 282 of file canvashelper.hxx.

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

OutDevProviderSharedPtr vclcanvas::CanvasHelper::mpOutDevProvider
protected

Rendering to this outdev does not preserve its state.

Definition at line 288 of file canvashelper.hxx.

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

OutDevProviderSharedPtr vclcanvas::CanvasHelper::mpProtectedOutDevProvider
protected

Rendering to this outdev preserves its state.

Definition at line 285 of file canvashelper.hxx.

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


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