LibreOffice Module slideshow (master) 1
Public Member Functions | Private Attributes | List of all members
slideshow::internal::AnimatedSprite Class Reference

This class provides the sprite for animated shapes. More...

#include <animatedsprite.hxx>

Collaboration diagram for slideshow::internal::AnimatedSprite:
[legend]

Public Member Functions

 AnimatedSprite (ViewLayerSharedPtr xViewLayer, const ::basegfx::B2DSize &rSpriteSizePixel, double nSpritePrio)
 Create a new AnimatedSprite, for the given metafile shape. More...
 
 AnimatedSprite (const AnimatedSprite &)=delete
 
AnimatedSpriteoperator= (const AnimatedSprite &)=delete
 
void resize (const ::basegfx::B2DSize &rSpriteSizePixel)
 Resize the sprite. More...
 
void setPixelOffset (const ::basegfx::B2DSize &rPixelOffset)
 Set an offset for the content output in pixel. More...
 
void show ()
 Show the sprite. More...
 
void hide ()
 Hide the sprite. More...
 
::cppcanvas::CanvasSharedPtr getContentCanvas () const
 Query the content canvas for the current sprite. More...
 
void movePixel (const ::basegfx::B2DPoint &rNewPos)
 Move the sprite in device pixel space. More...
 
void setAlpha (double rAlpha)
 Set the alpha value of the sprite. More...
 
void clip (const ::basegfx::B2DPolyPolygon &rClip)
 Set a sprite clip in user coordinate space. More...
 
void clip ()
 Clears a sprite clip. More...
 
void transform (const ::basegfx::B2DHomMatrix &rTransform)
 Set a sprite transformation. More...
 

Private Attributes

ViewLayerSharedPtr mpViewLayer
 
::cppcanvas::CustomSpriteSharedPtr mpSprite
 
::basegfx::B2DSize maEffectiveSpriteSizePixel
 
::basegfx::B2DSize maContentPixelOffset
 
double mnSpritePrio
 
double mnAlpha
 
::std::optional< ::basegfx::B2DPointmaPosPixel
 
::std::optional< ::basegfx::B2DPolyPolygonmaClip
 
bool mbSpriteVisible
 

Detailed Description

This class provides the sprite for animated shapes.

Besides encapsulating the Canvas sprite for animated shapes, this class also handles dynamic sprite resizing and all the gory details of offset calculations and rounding prevention.

Definition at line 45 of file animatedsprite.hxx.

Constructor & Destructor Documentation

◆ AnimatedSprite() [1/2]

slideshow::internal::AnimatedSprite::AnimatedSprite ( ViewLayerSharedPtr  xViewLayer,
const ::basegfx::B2DSize rSpriteSizePixel,
double  nSpritePrio 
)

Create a new AnimatedSprite, for the given metafile shape.

Parameters
rViewLayerThe destination view layer, on which the animation should appear
rSpriteSizePixelThe overall size of the sprite in device coordinate space, sufficient to display all transformations, shape changes and clips.
nSpritePrioPriority of the sprite. Must remain static over the lifetime of this object

Definition at line 40 of file animatedsprite.cxx.

References ENSURE_OR_THROW, maEffectiveSpriteSizePixel, mnSpritePrio, mpSprite, and mpViewLayer.

◆ AnimatedSprite() [2/2]

slideshow::internal::AnimatedSprite::AnimatedSprite ( const AnimatedSprite )
delete

Member Function Documentation

◆ clip() [1/2]

void slideshow::internal::AnimatedSprite::clip ( )

Clears a sprite clip.

If the sprite is not yet created, this method has no effect.

Definition at line 175 of file animatedsprite.cxx.

References maClip, and mpSprite.

◆ clip() [2/2]

void slideshow::internal::AnimatedSprite::clip ( const ::basegfx::B2DPolyPolygon rClip)

Set a sprite clip in user coordinate space.

If the sprite is not yet created, this method has no effect.

Definition at line 169 of file animatedsprite.cxx.

References maClip, and mpSprite.

◆ getContentCanvas()

cppcanvas::CanvasSharedPtr slideshow::internal::AnimatedSprite::getContentCanvas ( ) const

Query the content canvas for the current sprite.

Note that this method must be called every time something is rendered to the sprite, because XCustomSprite does not guarantee the validity of the canvas after a render operation.

Furthermore, the view transformation on the returned canvas is already correctly setup, matching the associated destination canvas.

Definition at line 66 of file animatedsprite.cxx.

References ENSURE_OR_THROW, basegfx::Size2D< typename TYPE >::getHeight(), basegfx::Size2D< typename TYPE >::getWidth(), maContentPixelOffset, mpSprite, mpViewLayer, and basegfx::B2DHomMatrix::set().

◆ hide()

void slideshow::internal::AnimatedSprite::hide ( )

Hide the sprite.

Definition at line 186 of file animatedsprite.cxx.

References mbSpriteVisible, and mpSprite.

◆ movePixel()

void slideshow::internal::AnimatedSprite::movePixel ( const ::basegfx::B2DPoint rNewPos)

Move the sprite in device pixel space.

If the sprite is not yet created, this method has no effect.

Definition at line 157 of file animatedsprite.cxx.

References maPosPixel, and mpSprite.

◆ operator=()

AnimatedSprite & slideshow::internal::AnimatedSprite::operator= ( const AnimatedSprite )
delete

◆ resize()

void slideshow::internal::AnimatedSprite::resize ( const ::basegfx::B2DSize rSpriteSizePixel)

◆ setAlpha()

void slideshow::internal::AnimatedSprite::setAlpha ( double  rAlpha)

Set the alpha value of the sprite.

If the sprite is not yet created, this method has no effect.

Definition at line 163 of file animatedsprite.cxx.

References mnAlpha, and mpSprite.

◆ setPixelOffset()

void slideshow::internal::AnimatedSprite::setPixelOffset ( const ::basegfx::B2DSize rPixelOffset)

Set an offset for the content output in pixel.

This method offsets the output on the sprite content canvas by the specified amount of device pixel (for subsequent render operations).

Definition at line 152 of file animatedsprite.cxx.

References maContentPixelOffset.

◆ show()

void slideshow::internal::AnimatedSprite::show ( )

Show the sprite.

Definition at line 192 of file animatedsprite.cxx.

References mbSpriteVisible, and mpSprite.

◆ transform()

void slideshow::internal::AnimatedSprite::transform ( const ::basegfx::B2DHomMatrix rTransform)

Set a sprite transformation.

If the sprite is not yet created, this method has no effect.

Definition at line 181 of file animatedsprite.cxx.

References mpSprite.

Member Data Documentation

◆ maClip

::std::optional< ::basegfx::B2DPolyPolygon > slideshow::internal::AnimatedSprite::maClip
private

Definition at line 148 of file animatedsprite.hxx.

Referenced by clip(), and resize().

◆ maContentPixelOffset

::basegfx::B2DSize slideshow::internal::AnimatedSprite::maContentPixelOffset
private

Definition at line 143 of file animatedsprite.hxx.

Referenced by getContentCanvas(), and setPixelOffset().

◆ maEffectiveSpriteSizePixel

::basegfx::B2DSize slideshow::internal::AnimatedSprite::maEffectiveSpriteSizePixel
private

Definition at line 142 of file animatedsprite.hxx.

Referenced by AnimatedSprite(), and resize().

◆ maPosPixel

::std::optional< ::basegfx::B2DPoint > slideshow::internal::AnimatedSprite::maPosPixel
private

Definition at line 147 of file animatedsprite.hxx.

Referenced by movePixel(), and resize().

◆ mbSpriteVisible

bool slideshow::internal::AnimatedSprite::mbSpriteVisible
private

Definition at line 150 of file animatedsprite.hxx.

Referenced by hide(), resize(), and show().

◆ mnAlpha

double slideshow::internal::AnimatedSprite::mnAlpha
private

Definition at line 146 of file animatedsprite.hxx.

Referenced by resize(), and setAlpha().

◆ mnSpritePrio

double slideshow::internal::AnimatedSprite::mnSpritePrio
private

Definition at line 145 of file animatedsprite.hxx.

Referenced by AnimatedSprite(), and resize().

◆ mpSprite

::cppcanvas::CustomSpriteSharedPtr slideshow::internal::AnimatedSprite::mpSprite
private

◆ mpViewLayer

ViewLayerSharedPtr slideshow::internal::AnimatedSprite::mpViewLayer
private

Definition at line 139 of file animatedsprite.hxx.

Referenced by AnimatedSprite(), getContentCanvas(), and resize().


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