メイン・コンテンツまでスキップ

AnimationTextureMapper

A TextureMapper with animation capabilities. Note that the angles of the TextureMapper is normalized to lie in the range [0; 2PI[ at the beginning at the animation. The end angles should be relative to this and are limited to values in the range [-32.7; 32.7].

Inherits from: TextureMapper, Image, Widget, Drawable

Protected Classes

structAnimationSetting
Information about how a specific animation parameter should be animated.

Public Types

enumAnimationParameter { X_ROTATION, Y_ROTATION, Z_ROTATION, SCALE }
Values that represent different animation parameter.

Public Functions

AnimationTextureMapper()
virtual voidcancelAnimationTextureMapperAnimation()
Cancel move animation.
virtual uint16_tgetAnimationStep()
Gets the current animation step measured in ticks since the call to startAnimation().
virtual voidhandleTickEvent()
Called periodically by the framework if the Drawable instance has subscribed to timer ticks.
virtual boolisTextureMapperAnimationRunning() const
Gets whether or not the animation is running.
voidsetTextureMapperAnimationEndedAction(GenericCallback< const AnimationTextureMapper & > & callback)
Associates an action to be performed when the animation ends.
voidsetTextureMapperAnimationStepAction(GenericCallback< const AnimationTextureMapper & > & callback)
Associates an action to be performed for every step in the animation.
virtual voidsetupAnimation(AnimationParameter parameter, float endValue, uint16_t duration, uint16_t delay, EasingEquation progressionEquation =&EasingEquations::linearEaseNone)
Sets up the animation for a specific parameter (angle/scale) for the next animation.
virtual voidstartAnimation()
Starts the animation from the current position to the specified end angles/scale, as specified by one or more calls to setupAnimation().

Public Attributes

const intNUMBER_OF_ANIMATION_PARAMETERS
Number of animation parameters.

Protected Attributes

uint16_tanimationCounter
Counter that is equal to the current step in the animation.
boolanimationRunning
Boolean that is true if the animation is running.
AnimationSettinganimations
Descriptions of the animation of specific animation parameters.
GenericCallback< const AnimationTextureMapper & > *textureMapperAnimationEndedCallback
Callback that is executed after the animation ends.
GenericCallback< const AnimationTextureMapper & > *textureMapperAnimationStepCallback
Callback that is executed after every step of the animation.

Additional inherited members

Public Types inherited from TextureMapper

enumRenderingAlgorithm { NEAREST_NEIGHBOR, BILINEAR_INTERPOLATION }
Rendering algorithm to use when scaling the bitmap.

Public Functions inherited from TextureMapper

virtual voiddraw(const Rect & invalidatedArea) const
Draw this drawable.
virtual floatgetBitmapPositionX() const
Gets bitmap position x coordinate.
virtual floatgetBitmapPositionY() const
Gets bitmap position y coordinate.
virtual floatgetCameraDistance() const
Gets camera distance.
virtual floatgetCameraX() const
Gets camera x coordinate.
virtual floatgetCameraY() const
Gets camera y coordinate.
virtual floatgetOrigoX() const
Gets transformation origo x coordinate.
virtual floatgetOrigoY() const
Gets transformation origo y coordinate.
virtual floatgetOrigoZ() const
Gets transformation origo z coordinate.
virtual RenderingAlgorithmgetRenderingAlgorithm() const
Gets the algorithm used when rendering.
virtual floatgetScale() const
Gets the scale of the image.
virtual RectgetSolidRect() const
Get (the largest possible) rectangle that is guaranteed to be solid (opaque).
virtual floatgetX0() const
Get the x coordinate of the top left corner of the transformed bitmap.
virtual floatgetX1() const
Get the x coordinate of the top right corner of the transformed bitmap.
virtual floatgetX2() const
Get the x coordinate of the bottom right of the transformed bitmap.
virtual floatgetX3() const
Get the x coordinate of the bottom left corner of the transformed bitmap.
virtual floatgetXAngle() const
Get the x angle in radians.
virtual floatgetY0() const
Get the y coordinate of the top left corner of the transformed bitmap.
virtual floatgetY1() const
Get the y coordinate of the top right corner of the transformed bitmap.
virtual floatgetY2() const
Get the y coordinate of the bottom right corner of the transformed bitmap.
virtual floatgetY3() const
Get the y coordinate of the bottom left corner of the transformed bitmap.
virtual floatgetYAngle() const
Get the y angle in radians.
virtual floatgetZ0() const
Get the z coordinate of the top left corner of the transformed bitmap.
virtual floatgetZ1() const
Get the z coordinate of the top right corner of the transformed bitmap.
virtual floatgetZ2() const
Get the z coordinate of the bottom right corner of the transformed bitmap.
virtual floatgetZ3() const
Get the z coordinate of the bottom left corner of the transformed bitmap.
virtual floatgetZAngle() const
Get the z angle in radians.
virtual voidinvalidateContent() const
Tell the framework that the contents of the Drawable needs to be redrawn.
virtual voidsetAngles(float newXAngle, float newYAngle, float newZAngle)
Sets the angles in radians of the image.
virtual voidsetBitmap(const Bitmap & bmp)
Sets the bitmap for this TextureMapper and updates the width and height of this widget to match those of the Bitmap.
virtual voidsetBitmapPosition(float x, float y)
Sets the position of the bitmap within the TextureMapper.
virtual voidsetBitmapPosition(int x, int y)
Sets the position of the bitmap within the TextureMapper.
virtual voidsetCamera(float x, float y)
Sets the camera coordinate.
virtual voidsetCameraDistance(float d)
Sets camera distance.
virtual voidsetOrigo(float x, float y)
Sets the transformation origo (center) in two dimensions.
virtual voidsetOrigo(float x, float y, float z)
Sets the transformation origo (center).
virtual voidsetRenderingAlgorithm(RenderingAlgorithm algorithm)
Sets the render algorithm to be used.
virtual voidsetScale(float newScale)
Sets the scale of the image.
virtual voidsetXAngle(float newXAngle)
Sets the x angle in radians.
virtual voidsetYAngle(float newYAngle)
Sets the y angle in radians.
virtual voidsetZAngle(float newZAngle)
Sets the z angle in radians.
TextureMapper(const Bitmap & bmp =Bitmap())
Constructs a new TextureMapper with a default alpha value of 255 (solid) and a default Bitmap (undefined) if none is specified.
TOUCHGFX_DEPRECATED("Please use invalidateContent() instead." , void invalidateBoundingRect() const )
Invalidate the bounding rectangle of the transformed bitmap.
virtual voidupdateAngles(float newXAngle, float newYAngle, float newZAngle)
Updates the angles in radians of the image.
virtual voidupdateScale(float newScale)
Updates the scale of the image.
virtual voidupdateXAngle(float newXAngle)
Updates the x angle in radians.
virtual voidupdateYAngle(float newYAngle)
Updates the y angle in radians.
virtual voidupdateZAngle(float newZAngle)
Updates the z angle in radians.

Protected Functions inherited from TextureMapper

voidapplyTransformation()
Transform the bitmap using the supplied origo, scale, rotation and camera.
voiddrawQuad(const Rect & invalidatedArea, uint16_t fb, const float triangleXs, const float triangleYs, const float triangleZs, const float triangleUs, const float triangleVs) const
The TextureMapper will draw the transformed bitmap by drawing one transformed quad.
RectgetBoundingRect() const
Gets bounding rectangle of the transformed bitmap.
RenderingVariantlookupRenderVariant() const
Returns the rendering variant based on the bitmap format, alpha value and rendering algorithm.

Protected Attributes inherited from TextureMapper

floatcameraDistance
The camera distance.
RenderingAlgorithmcurrentRenderingAlgorithm
The current rendering algorithm.
floatimageX0
The coordinate for the image points.
floatimageX1
The coordinate for the image points.
floatimageX2
The coordinate for the image points.
floatimageX3
The coordinate for the image points.
floatimageY0
The coordinate for the image points.
floatimageY1
The coordinate for the image points.
floatimageY2
The coordinate for the image points.
floatimageY3
The coordinate for the image points.
floatimageZ0
The coordinate for the image points.
floatimageZ1
The coordinate for the image points.
floatimageZ2
The coordinate for the image points.
floatimageZ3
The coordinate for the image points.
floatscale
The scale.
uint16_tsubDivisionSize
The size of the affine sub divisions.
floatxAngle
The angle x in radians.
floatxBitmapPosition
The bitmap position x.
floatxCamera
The camera x coordinate.
floatxOrigo
The origo x coordinate.
floatyAngle
The angle y in radians.
floatyBitmapPosition
The bitmap position y.
floatyCamera
The camera y coordinate.
floatyOrigo
The origo y coordinate.
floatzAngle
The angle z in radians.
floatzOrigo
The origo z coordinate.
const intMINIMAL_CAMERA_DISTANCE
The minimal camera distance.

Public Functions inherited from Image

virtual voiddraw(const Rect & invalidatedArea) const
Draw this drawable.
uint8_tgetAlpha() const
Gets the current alpha value of the widget.
BitmapgetBitmap() const
Gets the Bitmap currently assigned to the Image widget.
BitmapIdgetBitmapId() const
Gets the BitmapId currently assigned to the Image widget.
virtual RectgetSolidRect() const
Get (the largest possible) rectangle that is guaranteed to be solid (opaque).
Image(const Bitmap & bmp =Bitmap())
Constructs a new Image with a default alpha value of 255 (solid) and a default Bitmap (undefined) if none is specified.
virtual voidinvalidateContent() const
Tell the framework that the contents of the Drawable needs to be redrawn.
voidsetAlpha(uint8_t newAlpha)
Sets the opacity (alpha value).
virtual voidsetBitmap(const Bitmap & bmp)
Sets the bitmap for this Image and updates the width and height of this widget to match those of the Bitmap.

Protected Attributes inherited from Image

uint8_talpha
The Alpha for this image.
Bitmapbitmap
The Bitmap to display.

Public Functions inherited from Widget

virtual voidgetLastChild(int16_t , int16_t , Drawable ** last)
Since a Widget is only one Drawable, Widget::getLastChild simply yields itself as result, but only if the Widget isVisible and isTouchable.

Public Functions inherited from Drawable

voidcenter()
Centers the Drawable inside its parent.
voidcenterX()
Center the Drawable horizontally inside its parent.
voidcenterY()
Center the Drawable vertically inside its parent.
virtual voidchildGeometryChanged()
This function can be called on parent nodes to signal that the size or position of one or more of its children has changed.
virtual voiddraw(const Rect & invalidatedArea) const =0
Draw this drawable.
Drawable()
Initializes a new instance of the Drawable class.
voiddrawToDynamicBitmap(BitmapId id)
Render the Drawable object into a dynamic bitmap.
voidexpand(int margin =0)
Expands the Drawable to have the same size as its parent with a given margin around the edge.
RectgetAbsoluteRect() const
Helper function for obtaining the rectangle this Drawable covers, expressed in absolute coordinates.
virtual Drawable *getFirstChild()
Function for obtaining the first child of this drawable if any.
int16_tgetHeight() const
Gets the height of this Drawable.
virtual voidgetLastChild(int16_t x, int16_t y, Drawable ** last) =0
Function for obtaining the the last child of this drawable that intersects with the specified point.
Drawable *getNextSibling()
Gets the next sibling node.
Drawable *getParent() const
Returns the parent node.
const Rect &getRect() const
Gets the rectangle this Drawable covers, in coordinates relative to its parent.
virtual RectgetSolidRect() const =0
Get (the largest possible) rectangle that is guaranteed to be solid (opaque).
virtual RectgetSolidRectAbsolute()
Helper function for obtaining the largest solid rect (as implemented by getSolidRect()) expressed in absolute coordinates.
virtual voidgetVisibleRect(Rect & rect) const
Function for finding the visible part of this drawable.
int16_tgetWidth() const
Gets the width of this Drawable.
int16_tgetX() const
Gets the x coordinate of this Drawable, relative to its parent.
int16_tgetY() const
Gets the y coordinate of this Drawable, relative to its parent.
virtual voidhandleClickEvent(const ClickEvent & event)
Defines the event handler interface for ClickEvents.
virtual voidhandleDragEvent(const DragEvent & event)
Defines the event handler interface for DragEvents.
virtual voidhandleGestureEvent(const GestureEvent & event)
Defines the event handler interface for GestureEvents.
virtual voidinvalidate() const
Tell the framework that this entire Drawable needs to be redrawn.
virtual voidinvalidateContent() const
Tell the framework that the contents of the Drawable needs to be redrawn.
virtual voidinvalidateRect(Rect & invalidatedArea) const
Request that a region of this drawable is redrawn.
boolisTouchable() const
Gets whether this Drawable receives touch events or not.
boolisVisible() const
Gets whether this Drawable is visible.
virtual voidmoveRelative(int16_t x, int16_t y)
Moves the drawable.
virtual voidmoveTo(int16_t x, int16_t y)
Moves the drawable.
virtual voidsetHeight(int16_t height)
Sets the height of this drawable.
voidsetPosition(const Drawable & drawable)
Sets the position of the Drawable to the same as the given Drawable.
voidsetPosition(int16_t x, int16_t y, int16_t width, int16_t height)
Sets the size and position of this Drawable, relative to its parent.
voidsetTouchable(bool touch)
Controls whether this Drawable receives touch events or not.
voidsetVisible(bool vis)
Controls whether this Drawable should be visible.
virtual voidsetWidth(int16_t width)
Sets the width of this drawable.
voidsetWidthHeight(const Bitmap & bitmap)
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates).
voidsetWidthHeight(const Drawable & drawable)
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates).
voidsetWidthHeight(const Rect & other)
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates).
voidsetWidthHeight(int16_t width, int16_t height)
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates).
virtual voidsetX(int16_t x)
Sets the x coordinate of this Drawable, relative to its parent.
voidsetXY(const Drawable & drawable)
Sets the x and y coordinates of this Drawable.
voidsetXY(int16_t x, int16_t y)
Sets the x and y coordinates of this Drawable, relative to its parent.
virtual voidsetY(int16_t y)
Sets the y coordinate of this Drawable, relative to its parent.
virtual voidtranslateRectToAbsolute(Rect & r) const
Helper function for converting a region of this Drawable to absolute coordinates.
virtual ~Drawable()
Finalizes an instance of the Drawable class.

Protected Attributes inherited from Drawable

Drawable *nextSibling
Pointer to the next Drawable.
Drawable *parent
Pointer to this drawable's parent.
Rectrect
The coordinates of this Drawable, relative to its parent.
booltouchable
True if this drawable should receive touch events.
boolvisible
True if this drawable should be drawn.

Public Types Documentation

AnimationParameter

Values that represent different animation parameter.

X_ROTATIONRotation around the X axis.
Y_ROTATIONRotation around the Y axis.
Z_ROTATIONRotation around the Z axis.
SCALEScaling of the image.

Public Functions Documentation

AnimationTextureMapper

cancelAnimationTextureMapperAnimation

Cancel move animation.

Stops any running animation at the current position regardless of the progress made so far. Disables all animation parameters set using setupAnimation and mark the animation as stopped.

getAnimationStep

virtual uint16_t getAnimationStep()

Gets the current animation step measured in ticks since the call to startAnimation().

The steps during the initial delay are also counted.

Returns:

The current animation step.

handleTickEvent

virtual void handleTickEvent()

Called periodically by the framework if the Drawable instance has subscribed to timer ticks.

See also:

Reimplements: touchgfx::Drawable::handleTickEvent

isTextureMapperAnimationRunning

virtual bool isTextureMapperAnimationRunning()const

Gets whether or not the animation is running.

Returns:

true if the animation is running.

setTextureMapperAnimationEndedAction

Associates an action to be performed when the animation ends.

Parameters:
callbackThe callback to be executed. The callback will be given a reference to the AnimationTextureMapper.
See also:

setTextureMapperAnimationStepAction

Associates an action to be performed for every step in the animation.

Will not be called during the delay period.

Parameters:
callbackThe callback to be executed. The callback will be given a reference to the AnimationTextureMapper.
See also:

setupAnimation

virtual void setupAnimation(AnimationParameterparameter ,
floatendValue ,
uint16_tduration ,
uint16_tdelay ,
EasingEquationprogressionEquation =&EasingEquations::linearEaseNone
)

Sets up the animation for a specific parameter (angle/scale) for the next animation.

The specific parameter is chosen using the AnimationType enum. AnimationTypes that are not setup using this method will keep their value during the animation.

Parameters:
parameterThe parameter of the TextureMapper that should be animated.
endValueThe end value for the parameter.
durationThe duration for the animation of the parameter. Specified in ticks.
delayThe delay before the animation of the parameter starts. Specified in ticks.
progressionEquation(Optional) the progression equation for the animation of this parameter. Default is EasingEquations::linearEaseNone.

startAnimation

virtual void startAnimation()

Starts the animation from the current position to the specified end angles/scale, as specified by one or more calls to setupAnimation().

Public Attributes Documentation

NUMBER_OF_ANIMATION_PARAMETERS

const int NUMBER_OF_ANIMATION_PARAMETERS = SCALE + 1

Number of animation parameters.

Protected Attributes Documentation

animationCounter

uint16_t animationCounter

Counter that is equal to the current step in the animation.

animationRunning

bool animationRunning

Boolean that is true if the animation is running.

animations

AnimationSetting animations

Descriptions of the animation of specific animation parameters.

textureMapperAnimationEndedCallback

GenericCallback< const AnimationTextureMapper & > * textureMapperAnimationEndedCallback

Callback that is executed after the animation ends.

textureMapperAnimationStepCallback

GenericCallback< const AnimationTextureMapper & > * textureMapperAnimationStepCallback

Callback that is executed after every step of the animation.