LibreOffice Module canvas (master) 1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
canvas::CanvasCustomSpriteHelper Class Referenceabstract

Base class for an XSprite helper implementation - to be used in concert with CanvasCustomSpriteBase. More...

#include <canvascustomspritehelper.hxx>

Inheritance diagram for canvas::CanvasCustomSpriteHelper:
[legend]
Collaboration diagram for canvas::CanvasCustomSpriteHelper:
[legend]

Public Member Functions

 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...
 

Protected Member Functions

void transformUpdated () const
 Notifies that caller is again in sync with current transformation. More...
 

Private Member Functions

 CanvasCustomSpriteHelper (const CanvasCustomSpriteHelper &)=delete
 
CanvasCustomSpriteHelperoperator= (const CanvasCustomSpriteHelper &)=delete
 
virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D (css::uno::Reference< css::rendering::XPolyPolygon2D > &xPoly) const =0
 Called to convert an API polygon to a basegfx polygon. More...
 
bool updateClipState (const Sprite::Reference &rSprite)
 Update clip information from current state. More...
 

Private Attributes

SpriteSurface::Reference mpSpriteCanvas
 Owning sprite canvas. More...
 
::basegfx::B2DRange maCurrClipBounds
 Currently active clip area. More...
 
::basegfx::B2DPoint maPosition
 
::basegfx::B2DVector maSize
 
::basegfx::B2DHomMatrix maTransform
 
css::uno::Reference< css::rendering::XPolyPolygon2D > mxClipPoly
 
double mfPriority
 
double mfAlpha
 
bool mbActive
 
bool mbIsCurrClipRectangle
 If true, denotes that the current sprite clip is a true rectangle, i.e. More...
 
bool mbIsContentFullyOpaque
 Redraw speedup. More...
 
bool mbTransformDirty
 True, iff maTransform has changed. More...
 

Detailed Description

Base class for an XSprite helper implementation - to be used in concert with CanvasCustomSpriteBase.

Definition at line 46 of file canvascustomspritehelper.hxx.

Constructor & Destructor Documentation

◆ CanvasCustomSpriteHelper() [1/2]

canvas::CanvasCustomSpriteHelper::CanvasCustomSpriteHelper ( )

Definition at line 148 of file canvascustomspritehelper.cxx.

References mbActive.

◆ ~CanvasCustomSpriteHelper()

virtual canvas::CanvasCustomSpriteHelper::~CanvasCustomSpriteHelper ( )
inlinevirtual

Definition at line 50 of file canvascustomspritehelper.hxx.

◆ CanvasCustomSpriteHelper() [2/2]

canvas::CanvasCustomSpriteHelper::CanvasCustomSpriteHelper ( const CanvasCustomSpriteHelper )
privatedelete

Member Function Documentation

◆ checkDrawBitmap()

void canvas::CanvasCustomSpriteHelper::checkDrawBitmap ( const Sprite::Reference rSprite,
const css::uno::Reference< css::rendering::XBitmap > &  xBitmap,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ clearingContent()

void canvas::CanvasCustomSpriteHelper::clearingContent ( const Sprite::Reference rSprite)

need to call this method for XCanvas::clear(), for opacity tracking

Definition at line 178 of file canvascustomspritehelper.cxx.

References mbIsContentFullyOpaque.

◆ clip()

void canvas::CanvasCustomSpriteHelper::clip ( const Sprite::Reference rSprite,
const css::uno::Reference< css::rendering::XPolyPolygon2D > &  aClip 
)

◆ disposing()

void canvas::CanvasCustomSpriteHelper::disposing ( )

Object is being disposed, release all internal references.

Derive: \n when overriding this method in derived classes,
always call the base class' method!

Definition at line 173 of file canvascustomspritehelper.cxx.

References mpSpriteCanvas.

◆ getAlpha()

double canvas::CanvasCustomSpriteHelper::getAlpha ( ) const
inline

◆ getClip()

const css::uno::Reference< css::rendering::XPolyPolygon2D > & canvas::CanvasCustomSpriteHelper::getClip ( ) const
inline

Retrieve current clip.

Definition at line 131 of file canvascustomspritehelper.hxx.

Referenced by dxcanvas::SpriteHelper::redraw(), and vclcanvas::SpriteHelper::redraw().

◆ getPosPixel()

const ::basegfx::B2DPoint & canvas::CanvasCustomSpriteHelper::getPosPixel ( ) const
inline

Definition at line 99 of file canvascustomspritehelper.hxx.

References maPosition.

Referenced by dxcanvas::SpriteHelper::redraw().

◆ getPriority()

double canvas::CanvasCustomSpriteHelper::getPriority ( ) const
inline

Definition at line 102 of file canvascustomspritehelper.hxx.

Referenced by vclcanvas::SpriteHelper::redraw().

◆ getSizePixel()

const ::basegfx::B2DVector & canvas::CanvasCustomSpriteHelper::getSizePixel ( ) const
inline

◆ getTransformation()

const ::basegfx::B2DHomMatrix & canvas::CanvasCustomSpriteHelper::getTransformation ( ) const
inline

◆ getUpdateArea() [1/2]

basegfx::B2DRange canvas::CanvasCustomSpriteHelper::getUpdateArea ( ) const

◆ getUpdateArea() [2/2]

basegfx::B2DRange canvas::CanvasCustomSpriteHelper::getUpdateArea ( const ::basegfx::B2DRange rUntransformedSpriteBounds) const

◆ hasTransformChanged()

bool canvas::CanvasCustomSpriteHelper::hasTransformChanged ( ) const
inline

Returns true, if transformation has changed since last transformUpdated() call.

Definition at line 124 of file canvascustomspritehelper.hxx.

Referenced by vclcanvas::SpriteHelper::redraw().

◆ hide()

void canvas::CanvasCustomSpriteHelper::hide ( const Sprite::Reference rSprite)

◆ init()

void canvas::CanvasCustomSpriteHelper::init ( const css::geometry::RealSize2D &  rSpriteSize,
const SpriteSurface::Reference rOwningSpriteCanvas 
)

Init helper.

Parameters
rSpriteSizeRequested size of the sprite, as passed to the XSpriteCanvas::createCustomSprite() method
rOwningSpriteCanvasThe XSpriteCanvas this sprite is displayed on

Definition at line 158 of file canvascustomspritehelper.cxx.

References ENSURE_OR_THROW, maSize, max, mpSpriteCanvas, basegfx::Tuple2D< typename TYPE >::setX(), and basegfx::Tuple2D< typename TYPE >::setY().

◆ isActive()

bool canvas::CanvasCustomSpriteHelper::isActive ( ) const
inline

Retrieve current activation state.

Definition at line 136 of file canvascustomspritehelper.hxx.

References mbActive.

Referenced by dxcanvas::SpriteHelper::needRedraw(), dxcanvas::SpriteHelper::redraw(), and vclcanvas::SpriteHelper::redraw().

◆ isAreaUpdateOpaque()

bool canvas::CanvasCustomSpriteHelper::isAreaUpdateOpaque ( const ::basegfx::B2DRange rUpdateArea) const

◆ isContentFullyOpaque()

bool canvas::CanvasCustomSpriteHelper::isContentFullyOpaque ( ) const
inline

Returns true, if sprite content bitmap is fully opaque.

This does not take clipping or transformation into account, but only denotes that the sprite bitmap's alpha channel is all 1.0

Definition at line 121 of file canvascustomspritehelper.hxx.

Referenced by vclcanvas::SpriteHelper::redraw().

◆ move()

void canvas::CanvasCustomSpriteHelper::move ( const Sprite::Reference rSprite,
const css::geometry::RealPoint2D &  aNewPos,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)

◆ operator=()

CanvasCustomSpriteHelper & canvas::CanvasCustomSpriteHelper::operator= ( const CanvasCustomSpriteHelper )
privatedelete

◆ polyPolygonFromXPolyPolygon2D()

virtual ::basegfx::B2DPolyPolygon canvas::CanvasCustomSpriteHelper::polyPolygonFromXPolyPolygon2D ( css::uno::Reference< css::rendering::XPolyPolygon2D > &  xPoly) const
privatepure virtual

Called to convert an API polygon to a basegfx polygon.

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

Implemented in cairocanvas::SpriteHelper, dxcanvas::SpriteHelper, and vclcanvas::SpriteHelper.

Referenced by updateClipState().

◆ setAlpha()

void canvas::CanvasCustomSpriteHelper::setAlpha ( const Sprite::Reference rSprite,
double  alpha 
)

◆ setPriority()

void canvas::CanvasCustomSpriteHelper::setPriority ( const Sprite::Reference rSprite,
double  nPriority 
)

◆ show()

void canvas::CanvasCustomSpriteHelper::show ( const Sprite::Reference rSprite)

◆ transform()

void canvas::CanvasCustomSpriteHelper::transform ( const Sprite::Reference rSprite,
const css::geometry::AffineMatrix2D &  aTransformation 
)

◆ transformUpdated()

void canvas::CanvasCustomSpriteHelper::transformUpdated ( ) const
inlineprotected

Notifies that caller is again in sync with current transformation.

const, but modifies state visible to derived classes. beware of passing this information to the outside!

Definition at line 145 of file canvascustomspritehelper.hxx.

Referenced by vclcanvas::SpriteHelper::redraw().

◆ updateClipState()

bool canvas::CanvasCustomSpriteHelper::updateClipState ( const Sprite::Reference rSprite)
private

Update clip information from current state.

This method recomputes the maCurrClipBounds and mbIsCurrClipRectangle members from the current clip and transformation. IFF the clip changed from rectangular to rectangular again, this method issues a sequence of optimized SpriteSurface::updateSprite() calls.

Returns
true, if SpriteSurface::updateSprite() was already called within this method.

Definition at line 43 of file canvascustomspritehelper.cxx.

References canvas::tools::calcTransformedRectBounds(), basegfx::B2DPolyPolygon::getB2DPolygon(), basegfx::Tuple2D< typename TYPE >::getX(), basegfx::Tuple2D< typename TYPE >::getY(), basegfx::Range2D< typename TYPE, typename TRAITS >::intersect(), vclcanvas::tools::isRectangle(), maCurrClipBounds, maPosition, maSize, maTransform, mbActive, mbIsCurrClipRectangle, mpSpriteCanvas, mxClipPoly, polyPolygonFromXPolyPolygon2D(), basegfx::Range2D< typename TYPE, typename TRAITS >::reset(), and basegfx::B2DPolyPolygon::transform().

Referenced by clip(), and transform().

Member Data Documentation

◆ maCurrClipBounds

::basegfx::B2DRange canvas::CanvasCustomSpriteHelper::maCurrClipBounds
private

Currently active clip area.

This member is either empty, denoting that the current clip shows the full sprite content, or contains a rectangular subarea of the sprite, outside of which the sprite content is fully clipped.

See also
mbIsCurrClipRectangle

Definition at line 184 of file canvascustomspritehelper.hxx.

Referenced by getUpdateArea(), and updateClipState().

◆ maPosition

::basegfx::B2DPoint canvas::CanvasCustomSpriteHelper::maPosition
private

◆ maSize

::basegfx::B2DVector canvas::CanvasCustomSpriteHelper::maSize
private

Definition at line 188 of file canvascustomspritehelper.hxx.

Referenced by getUpdateArea(), init(), move(), and updateClipState().

◆ maTransform

::basegfx::B2DHomMatrix canvas::CanvasCustomSpriteHelper::maTransform
private

Definition at line 189 of file canvascustomspritehelper.hxx.

Referenced by getUpdateArea(), transform(), and updateClipState().

◆ mbActive

bool canvas::CanvasCustomSpriteHelper::mbActive
private

◆ mbIsContentFullyOpaque

bool canvas::CanvasCustomSpriteHelper::mbIsContentFullyOpaque
mutableprivate

Redraw speedup.

When true, this flag denotes that the current sprite content is fully opaque, thus, that blits to the screen do neither have to take alpha into account, nor prepare any background for the sprite area.

Definition at line 210 of file canvascustomspritehelper.hxx.

Referenced by checkDrawBitmap(), clearingContent(), and isAreaUpdateOpaque().

◆ mbIsCurrClipRectangle

bool canvas::CanvasCustomSpriteHelper::mbIsCurrClipRectangle
private

If true, denotes that the current sprite clip is a true rectangle, i.e.

maCurrClipBounds exactly describes the visible area of the sprite.

See also
maCurrClipBounds

Definition at line 201 of file canvascustomspritehelper.hxx.

Referenced by isAreaUpdateOpaque(), and updateClipState().

◆ mbTransformDirty

bool canvas::CanvasCustomSpriteHelper::mbTransformDirty
mutableprivate

True, iff maTransform has changed.

Definition at line 213 of file canvascustomspritehelper.hxx.

Referenced by transform().

◆ mfAlpha

double canvas::CanvasCustomSpriteHelper::mfAlpha
private

Definition at line 192 of file canvascustomspritehelper.hxx.

Referenced by hide(), isAreaUpdateOpaque(), setAlpha(), and show().

◆ mfPriority

double canvas::CanvasCustomSpriteHelper::mfPriority
private

Definition at line 191 of file canvascustomspritehelper.hxx.

Referenced by setPriority().

◆ mpSpriteCanvas

SpriteSurface::Reference canvas::CanvasCustomSpriteHelper::mpSpriteCanvas
private

Owning sprite canvas.

Definition at line 173 of file canvascustomspritehelper.hxx.

Referenced by clip(), disposing(), hide(), init(), move(), setAlpha(), setPriority(), show(), transform(), and updateClipState().

◆ mxClipPoly

css::uno::Reference< css::rendering::XPolyPolygon2D > canvas::CanvasCustomSpriteHelper::mxClipPoly
private

Definition at line 190 of file canvascustomspritehelper.hxx.

Referenced by clip(), and updateClipState().


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