LibreOffice Module canvas (master) 1
|
Base class for an XSprite helper implementation - to be used in concert with CanvasCustomSpriteBase. More...
#include <canvascustomspritehelper.hxx>
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::B2DPoint & | getPosPixel () const |
const ::basegfx::B2DVector & | getSizePixel () 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::B2DHomMatrix & | getTransformation () 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 | |
CanvasCustomSpriteHelper & | operator= (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... | |
Base class for an XSprite helper implementation - to be used in concert with CanvasCustomSpriteBase.
Definition at line 46 of file canvascustomspritehelper.hxx.
canvas::CanvasCustomSpriteHelper::CanvasCustomSpriteHelper | ( | ) |
Definition at line 148 of file canvascustomspritehelper.cxx.
References mbActive.
|
inlinevirtual |
Definition at line 50 of file canvascustomspritehelper.hxx.
|
privatedelete |
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 184 of file canvascustomspritehelper.cxx.
References basegfx::Size2D< typename TYPE >::getHeight(), basegfx::Size2D< typename TYPE >::getWidth(), 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 178 of file canvascustomspritehelper.cxx.
References mbIsContentFullyOpaque.
void canvas::CanvasCustomSpriteHelper::clip | ( | const Sprite::Reference & | rSprite, |
const css::uno::Reference< css::rendering::XPolyPolygon2D > & | aClip | ||
) |
Definition at line 300 of file canvascustomspritehelper.cxx.
References getUpdateArea(), maPosition, mbActive, mpSpriteCanvas, mxClipPoly, and updateClipState().
void canvas::CanvasCustomSpriteHelper::disposing | ( | ) |
Object is being disposed, release all internal references.
Definition at line 173 of file canvascustomspritehelper.cxx.
References mpSpriteCanvas.
|
inline |
Retrieve current alpha value.
Definition at line 127 of file canvascustomspritehelper.hxx.
Referenced by dxcanvas::SpriteHelper::needRedraw(), dxcanvas::SpriteHelper::redraw(), and vclcanvas::SpriteHelper::redraw().
|
inline |
Retrieve current clip.
Definition at line 131 of file canvascustomspritehelper.hxx.
Referenced by dxcanvas::SpriteHelper::redraw(), and vclcanvas::SpriteHelper::redraw().
|
inline |
Definition at line 99 of file canvascustomspritehelper.hxx.
References maPosition.
Referenced by dxcanvas::SpriteHelper::redraw().
|
inline |
Definition at line 102 of file canvascustomspritehelper.hxx.
Referenced by vclcanvas::SpriteHelper::redraw().
|
inline |
Definition at line 100 of file canvascustomspritehelper.hxx.
References maSize.
Referenced by dxcanvas::SpriteHelper::redraw(), and vclcanvas::SpriteHelper::redraw().
|
inline |
Definition at line 133 of file canvascustomspritehelper.hxx.
References maTransform.
Referenced by dxcanvas::SpriteHelper::redraw(), and vclcanvas::SpriteHelper::redraw().
basegfx::B2DRange canvas::CanvasCustomSpriteHelper::getUpdateArea | ( | ) | const |
Definition at line 422 of file canvascustomspritehelper.cxx.
References basegfx::B2DRange::getMaximum(), basegfx::B2DRange::getMinimum(), getUpdateArea(), basegfx::Tuple2D< typename TYPE >::getX(), basegfx::Tuple2D< typename TYPE >::getY(), basegfx::Range2D< typename TYPE, typename TRAITS >::isEmpty(), maCurrClipBounds, maPosition, and maSize.
Referenced by clip(), getUpdateArea(), hide(), isAreaUpdateOpaque(), move(), setAlpha(), setPriority(), show(), and transform().
basegfx::B2DRange canvas::CanvasCustomSpriteHelper::getUpdateArea | ( | const ::basegfx::B2DRange & | rUntransformedSpriteBounds | ) | const |
Calc sprite update area from given raw sprite bounds.
Definition at line 407 of file canvascustomspritehelper.cxx.
References canvas::tools::calcTransformedRectBounds(), basegfx::Tuple2D< typename TYPE >::getX(), basegfx::Tuple2D< typename TYPE >::getY(), maPosition, maTransform, and basegfx::B2DHomMatrix::translate().
|
inline |
Returns true, if transformation has changed since last transformUpdated() call.
Definition at line 124 of file canvascustomspritehelper.hxx.
Referenced by vclcanvas::SpriteHelper::redraw().
void canvas::CanvasCustomSpriteHelper::hide | ( | const Sprite::Reference & | rSprite | ) |
Definition at line 363 of file canvascustomspritehelper.cxx.
References getUpdateArea(), maPosition, mbActive, mfAlpha, and mpSpriteCanvas.
void canvas::CanvasCustomSpriteHelper::init | ( | const css::geometry::RealSize2D & | rSpriteSize, |
const SpriteSurface::Reference & | rOwningSpriteCanvas | ||
) |
Init helper.
rSpriteSize | Requested size of the sprite, as passed to the XSpriteCanvas::createCustomSprite() method |
rOwningSpriteCanvas | The 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().
|
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().
bool canvas::CanvasCustomSpriteHelper::isAreaUpdateOpaque | ( | const ::basegfx::B2DRange & | rUpdateArea | ) | const |
Definition at line 385 of file canvascustomspritehelper.cxx.
References getUpdateArea(), basegfx::Range2D< typename TYPE, typename TRAITS >::isInside(), mbIsContentFullyOpaque, mbIsCurrClipRectangle, and mfAlpha.
|
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().
void canvas::CanvasCustomSpriteHelper::move | ( | const Sprite::Reference & | rSprite, |
const css::geometry::RealPoint2D & | aNewPos, | ||
const css::rendering::ViewState & | viewState, | ||
const css::rendering::RenderState & | renderState | ||
) |
Definition at line 234 of file canvascustomspritehelper.cxx.
References getUpdateArea(), basegfx::Tuple2D< typename TYPE >::getX(), basegfx::Tuple2D< typename TYPE >::getY(), maPosition, maSize, mbActive, canvas::tools::mergeViewAndRenderTransform(), and mpSpriteCanvas.
|
privatedelete |
|
privatepure virtual |
Called to convert an API polygon to a basegfx polygon.
Implemented in cairocanvas::SpriteHelper, dxcanvas::SpriteHelper, and vclcanvas::SpriteHelper.
Referenced by updateClipState().
void canvas::CanvasCustomSpriteHelper::setAlpha | ( | const Sprite::Reference & | rSprite, |
double | alpha | ||
) |
Definition at line 215 of file canvascustomspritehelper.cxx.
References alpha, getUpdateArea(), maPosition, mbActive, mfAlpha, and mpSpriteCanvas.
void canvas::CanvasCustomSpriteHelper::setPriority | ( | const Sprite::Reference & | rSprite, |
double | nPriority | ||
) |
Definition at line 322 of file canvascustomspritehelper.cxx.
References getUpdateArea(), maPosition, mbActive, mfPriority, and mpSpriteCanvas.
void canvas::CanvasCustomSpriteHelper::show | ( | const Sprite::Reference & | rSprite | ) |
Definition at line 341 of file canvascustomspritehelper.cxx.
References getUpdateArea(), maPosition, mbActive, mfAlpha, and mpSpriteCanvas.
void canvas::CanvasCustomSpriteHelper::transform | ( | const Sprite::Reference & | rSprite, |
const css::geometry::AffineMatrix2D & | aTransformation | ||
) |
Definition at line 271 of file canvascustomspritehelper.cxx.
References getUpdateArea(), maPosition, maTransform, mbActive, mbTransformDirty, mpSpriteCanvas, and updateClipState().
|
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().
|
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.
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().
|
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.
Definition at line 184 of file canvascustomspritehelper.hxx.
Referenced by getUpdateArea(), and updateClipState().
|
private |
Definition at line 187 of file canvascustomspritehelper.hxx.
Referenced by clip(), getUpdateArea(), hide(), move(), setAlpha(), setPriority(), show(), transform(), and updateClipState().
|
private |
Definition at line 188 of file canvascustomspritehelper.hxx.
Referenced by getUpdateArea(), init(), move(), and updateClipState().
|
private |
Definition at line 189 of file canvascustomspritehelper.hxx.
Referenced by getUpdateArea(), transform(), and updateClipState().
|
private |
Definition at line 193 of file canvascustomspritehelper.hxx.
Referenced by clip(), hide(), move(), setAlpha(), setPriority(), show(), transform(), and updateClipState().
|
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().
|
private |
If true, denotes that the current sprite clip is a true rectangle, i.e.
maCurrClipBounds exactly describes the visible area of the sprite.
Definition at line 201 of file canvascustomspritehelper.hxx.
Referenced by isAreaUpdateOpaque(), and updateClipState().
|
mutableprivate |
True, iff maTransform has changed.
Definition at line 213 of file canvascustomspritehelper.hxx.
Referenced by transform().
|
private |
Definition at line 192 of file canvascustomspritehelper.hxx.
Referenced by hide(), isAreaUpdateOpaque(), setAlpha(), and show().
|
private |
Definition at line 191 of file canvascustomspritehelper.hxx.
Referenced by setPriority().
|
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().
|
private |
Definition at line 190 of file canvascustomspritehelper.hxx.
Referenced by clip(), and updateClipState().