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 47 of file canvascustomspritehelper.hxx.

Constructor & Destructor Documentation

canvas::CanvasCustomSpriteHelper::CanvasCustomSpriteHelper ( )

Definition at line 148 of file canvascustomspritehelper.cxx.

References mbActive, and mpSpriteCanvas.

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

Definition at line 51 of file canvascustomspritehelper.hxx.

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

Member Function Documentation

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 
)

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

Definition at line 190 of file canvascustomspritehelper.cxx.

References canvas::tools::isInside(), mbIsContentFullyOpaque, and canvas::tools::mergeViewAndRenderTransform().

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

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

Definition at line 184 of file canvascustomspritehelper.cxx.

References mbIsContentFullyOpaque.

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

Object is being disposed, release all internal references.

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

Definition at line 179 of file canvascustomspritehelper.cxx.

References mpSpriteCanvas.

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

Retrieve current clip.

Definition at line 132 of file canvascustomspritehelper.hxx.

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

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

Definition at line 100 of file canvascustomspritehelper.hxx.

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

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

Definition at line 103 of file canvascustomspritehelper.hxx.

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

const ::basegfx::B2DVector& canvas::CanvasCustomSpriteHelper::getSizePixel ( ) const
inline
const ::basegfx::B2DHomMatrix& canvas::CanvasCustomSpriteHelper::getTransformation ( ) const
inline
basegfx::B2DRange canvas::CanvasCustomSpriteHelper::getUpdateArea ( ) const
basegfx::B2DRange canvas::CanvasCustomSpriteHelper::getUpdateArea ( const ::basegfx::B2DRange rUntransformedSpriteBounds) const
bool canvas::CanvasCustomSpriteHelper::hasTransformChanged ( ) const
inline

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

Definition at line 125 of file canvascustomspritehelper.hxx.

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

void canvas::CanvasCustomSpriteHelper::hide ( const Sprite::Reference rSprite)
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 164 of file canvascustomspritehelper.cxx.

References ENSURE_OR_THROW, maSize, max, mpSpriteCanvas, basegfx::B2DTuple::setX(), and basegfx::B2DTuple::setY().

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

Retrieve current activation state.

Definition at line 137 of file canvascustomspritehelper.hxx.

References mbActive.

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

bool canvas::CanvasCustomSpriteHelper::isAreaUpdateOpaque ( const ::basegfx::B2DRange rUpdateArea) const
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 122 of file canvascustomspritehelper.hxx.

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

void canvas::CanvasCustomSpriteHelper::move ( const Sprite::Reference rSprite,
const css::geometry::RealPoint2D &  aNewPos,
const css::rendering::ViewState viewState,
const css::rendering::RenderState &  renderState 
)
CanvasCustomSpriteHelper& canvas::CanvasCustomSpriteHelper::operator= ( const CanvasCustomSpriteHelper )
privatedelete
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:
Needs to be provided by backend-specific code

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

Referenced by updateClipState().

void canvas::CanvasCustomSpriteHelper::setAlpha ( const Sprite::Reference rSprite,
double  alpha 
)
void canvas::CanvasCustomSpriteHelper::setPriority ( const Sprite::Reference rSprite,
double  nPriority 
)
void canvas::CanvasCustomSpriteHelper::show ( const Sprite::Reference rSprite)
void canvas::CanvasCustomSpriteHelper::transform ( const Sprite::Reference rSprite,
const css::geometry::AffineMatrix2D &  aTransformation 
)
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 146 of file canvascustomspritehelper.hxx.

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

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::utils::getRange(), basegfx::B2DTuple::getX(), basegfx::B2DTuple::getY(), basegfx::B2DRange::intersect(), basegfx::utils::isRectangle(), maCurrClipBounds, maPosition, maSize, maTransform, mbActive, mbIsCurrClipRectangle, mpSpriteCanvas, mxClipPoly, polyPolygonFromXPolyPolygon2D(), and basegfx::B2DRange::reset().

Referenced by clip(), and transform().

Member Data Documentation

::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 185 of file canvascustomspritehelper.hxx.

Referenced by getUpdateArea(), and updateClipState().

::basegfx::B2DPoint canvas::CanvasCustomSpriteHelper::maPosition
private
::basegfx::B2DVector canvas::CanvasCustomSpriteHelper::maSize
private

Definition at line 189 of file canvascustomspritehelper.hxx.

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

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

Definition at line 190 of file canvascustomspritehelper.hxx.

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

bool canvas::CanvasCustomSpriteHelper::mbActive
private
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 211 of file canvascustomspritehelper.hxx.

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

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 202 of file canvascustomspritehelper.hxx.

Referenced by isAreaUpdateOpaque(), and updateClipState().

bool canvas::CanvasCustomSpriteHelper::mbTransformDirty
mutableprivate

True, iff maTransform has changed.

Definition at line 214 of file canvascustomspritehelper.hxx.

Referenced by transform().

double canvas::CanvasCustomSpriteHelper::mfAlpha
private

Definition at line 193 of file canvascustomspritehelper.hxx.

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

double canvas::CanvasCustomSpriteHelper::mfPriority
private

Definition at line 192 of file canvascustomspritehelper.hxx.

Referenced by setPriority().

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

Owning sprite canvas.

Definition at line 174 of file canvascustomspritehelper.hxx.

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

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

Definition at line 191 of file canvascustomspritehelper.hxx.

Referenced by clip(), and updateClipState().


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