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

Helper class for canvas sprites. More...

#include <spritehelper.hxx>

Inheritance diagram for vclcanvas::SpriteHelper:
[legend]
Collaboration diagram for vclcanvas::SpriteHelper:
[legend]

Public Member Functions

 SpriteHelper ()
 
void init (const css::geometry::RealSize2D &rSpriteSize, const ::canvas::SpriteSurface::Reference &rOwningSpriteCanvas, const BackBufferSharedPtr &rBackBuffer, const BackBufferSharedPtr &rBackBufferMask, bool bShowSpriteBounds)
 Late-init the sprite helper. More...
 
void disposing ()
 
void redraw (OutputDevice &rOutDev, const ::basegfx::B2DPoint &rPos, bool &bSurfacesDirty, bool bBufferedUpdate) const
 Repaint sprite content to associated sprite canvas. More...
 
- Public Member Functions inherited from canvas::CanvasCustomSpriteHelper
 CanvasCustomSpriteHelper ()
 
virtual ~CanvasCustomSpriteHelper ()
 
void init (const css::geometry::RealSize2D &rSpriteSize, const SpriteSurface::Reference &rOwningSpriteCanvas)
 Init helper. More...
 
void disposing ()
 Object is being disposed, release all internal references. More...
 
void clearingContent (const Sprite::Reference &rSprite)
 need to call this method for XCanvas::clear(), for opacity tracking More...
 
void checkDrawBitmap (const Sprite::Reference &rSprite, const css::uno::Reference< css::rendering::XBitmap > &xBitmap, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 need to call this method for XCanvas::drawBitmap(), for opacity tracking More...
 
void setAlpha (const Sprite::Reference &rSprite, double alpha)
 
void move (const Sprite::Reference &rSprite, const css::geometry::RealPoint2D &aNewPos, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState)
 
void transform (const Sprite::Reference &rSprite, const css::geometry::AffineMatrix2D &aTransformation)
 
void clip (const Sprite::Reference &rSprite, const css::uno::Reference< css::rendering::XPolyPolygon2D > &aClip)
 
void setPriority (const Sprite::Reference &rSprite, double nPriority)
 
void show (const Sprite::Reference &rSprite)
 
void hide (const Sprite::Reference &rSprite)
 
bool isAreaUpdateOpaque (const ::basegfx::B2DRange &rUpdateArea) const
 
const ::basegfx::B2DPointgetPosPixel () const
 
const ::basegfx::B2DVectorgetSizePixel () const
 
::basegfx::B2DRange getUpdateArea () const
 
double getPriority () const
 
::basegfx::B2DRange getUpdateArea (const ::basegfx::B2DRange &rUntransformedSpriteBounds) const
 Calc sprite update area from given raw sprite bounds. More...
 
bool isContentFullyOpaque () const
 Returns true, if sprite content bitmap is fully opaque. More...
 
bool hasTransformChanged () const
 Returns true, if transformation has changed since last transformUpdated() call. More...
 
double getAlpha () const
 Retrieve current alpha value. More...
 
const css::uno::Reference< css::rendering::XPolyPolygon2D > & getClip () const
 Retrieve current clip. More...
 
const ::basegfx::B2DHomMatrixgetTransformation () const
 
bool isActive () const
 Retrieve current activation state. More...
 

Private Member Functions

virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D (css::uno::Reference< css::rendering::XPolyPolygon2D > &xPoly) const override
 Called to convert an API polygon to a basegfx polygon. More...
 

Private Attributes

BackBufferSharedPtr mpBackBuffer
 
BackBufferSharedPtr mpBackBufferMask
 
mutable ::canvas::vcltools::VCLObject< BitmapExmaContent
 Cached bitmap for the current sprite content. More...
 
bool mbShowSpriteBounds
 When true, line sprite corners in red. More...
 

Additional Inherited Members

- Protected Member Functions inherited from canvas::CanvasCustomSpriteHelper
void transformUpdated () const
 Notifies that caller is again in sync with current transformation. More...
 

Detailed Description

Helper class for canvas sprites.

This class implements all sprite-related functionality, like that available on the XSprite interface.

Definition at line 40 of file spritehelper.hxx.

Constructor & Destructor Documentation

◆ SpriteHelper()

vclcanvas::SpriteHelper::SpriteHelper ( )

Definition at line 44 of file spritehelper.cxx.

Member Function Documentation

◆ disposing()

void vclcanvas::SpriteHelper::disposing ( )

Definition at line 65 of file spritehelper.cxx.

References mpBackBuffer, and mpBackBufferMask.

◆ init()

void vclcanvas::SpriteHelper::init ( const css::geometry::RealSize2D &  rSpriteSize,
const ::canvas::SpriteSurface::Reference rOwningSpriteCanvas,
const BackBufferSharedPtr rBackBuffer,
const BackBufferSharedPtr rBackBufferMask,
bool  bShowSpriteBounds 
)

Late-init the sprite helper.

Parameters
rSpriteSizeSize of the sprite
rSpriteCanvasSprite canvas this sprite is part of. Object stores ref-counted reference to it, thus, don't forget to pass on disposing()!
rBackBufferBuffer of the sprite content (non-alpha part)
rBackBufferMaskBuffer of the sprite content (alpha part)

◆ polyPolygonFromXPolyPolygon2D()

virtual ::basegfx::B2DPolyPolygon vclcanvas::SpriteHelper::polyPolygonFromXPolyPolygon2D ( css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPoly) const
overrideprivatevirtual

Called to convert an API polygon to a basegfx polygon.

Derive: \n Needs to be provided by backend-specific code

Implements canvas::CanvasCustomSpriteHelper.

◆ redraw()

void vclcanvas::SpriteHelper::redraw ( OutputDevice rOutDev,
const ::basegfx::B2DPoint rPos,
bool &  bSurfacesDirty,
bool  bBufferedUpdate 
) const

Repaint sprite content to associated sprite canvas.

Parameters
rPosOutput position (sprite's own position is disregarded)
io_bSurfacesDirtyWhen true, the referenced sprite surfaces (backBuffer and backBufferMask) have been modified since last call.
bBufferedUpdateWhen true, the redraw does not happen directly on the front buffer, but within a VDev. Used to speed up drawing.

Definition at line 74 of file spritehelper.cxx.

References ALIGN_TOP, vcl::CLIPREGION, COL_RED(), basegfx::B2DPolyPolygon::count(), tools::PolyPolygon::Count(), OutputDevice::DrawPolyLine(), OutputDevice::DrawPolyPolygon(), OutputDevice::DrawText(), OutputDevice::DrawTransformedBitmapEx(), canvas::CanvasCustomSpriteHelper::getAlpha(), BitmapEx::GetBitmap(), canvas::tools::getBoundMarksPolyPolygon(), canvas::CanvasCustomSpriteHelper::getClip(), tools::PolyPolygon::GetObject(), canvas::CanvasCustomSpriteHelper::getPriority(), canvas::CanvasCustomSpriteHelper::getSizePixel(), canvas::CanvasCustomSpriteHelper::getTransformation(), canvas::CanvasCustomSpriteHelper::hasTransformChanged(), Size::Height(), i, canvas::CanvasCustomSpriteHelper::isActive(), canvas::CanvasCustomSpriteHelper::isContentFullyOpaque(), BitmapEx::IsEmpty(), maContent, mbShowSpriteBounds, mpBackBuffer, mpBackBufferMask, vcl::unotools::pointFromB2DPoint(), OutputDevice::Pop(), OutputDevice::Push(), SAL_INFO, basegfx::B2DHomMatrix::scale(), OutputDevice::SetClipRegion(), vcl::Font::SetColor(), OutputDevice::SetFillColor(), OutputDevice::SetFont(), vcl::Font::SetFontHeight(), OutputDevice::SetLineColor(), OutputDevice::SetTextAlign(), OutputDevice::SetTextColor(), vcl::unotools::sizeFromB2DSize(), text(), basegfx::B2DPolyPolygon::transform(), canvas::CanvasCustomSpriteHelper::transformUpdated(), basegfx::B2DHomMatrix::translate(), Size::Width(), Point::X(), and Point::Y().

Member Data Documentation

◆ maContent

mutable ::canvas::vcltools::VCLObject<BitmapEx> vclcanvas::SpriteHelper::maContent
private

Cached bitmap for the current sprite content.

Definition at line 100 of file spritehelper.hxx.

Referenced by redraw().

◆ mbShowSpriteBounds

bool vclcanvas::SpriteHelper::mbShowSpriteBounds
private

When true, line sprite corners in red.

Definition at line 103 of file spritehelper.hxx.

Referenced by redraw().

◆ mpBackBuffer

BackBufferSharedPtr vclcanvas::SpriteHelper::mpBackBuffer
private

Definition at line 96 of file spritehelper.hxx.

Referenced by disposing(), and redraw().

◆ mpBackBufferMask

BackBufferSharedPtr vclcanvas::SpriteHelper::mpBackBufferMask
private

Definition at line 97 of file spritehelper.hxx.

Referenced by disposing(), and redraw().


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