soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
STransformation.cpp
1
2#include <souistd.h>
3#include <animation/STransformation.h>
4
5SNSBEGIN
6
8{
9 return getTransformationType() == TYPE_IDENTITY;
10}
11
13{
14 return (getTransformationType() & TYPE_MATRIX) == TYPE_MATRIX;
15}
16
18{
19 return (getTransformationType() & TYPE_ALPHA) == TYPE_ALPHA;
20}
21
23{
24 return mAlpha;
25}
26
28{
29 if (mMatrix.isIdentity())
30 mTransformationType &= ~TYPE_MATRIX;
31 else
32 mTransformationType |= TYPE_MATRIX;
33}
34
36{
37 mAlpha = alpha;
38 mTransformationType |= TYPE_ALPHA;
39}
40
42{
43 mMatrix = mtx;
45}
46
51
53{
54 return mMatrix;
55}
56
58{
59 if (t.hasAlpha())
60 {
61 mAlpha = (BYTE)((int)mAlpha * t.GetAlpha() / 255);
62 mTransformationType |= TYPE_ALPHA;
63 }
64 if (t.hasMatrix())
65 {
66 mMatrix *= t.getMatrix();
68 }
69}
70
71void STransformation::Compose(const ITransformation *t)
72{
73 const STransformation &t2 = *(const STransformation *)t;
74 compose(t2);
75}
76
78{
79 if (t.hasAlpha())
80 {
81 mAlpha = (BYTE)((int)mAlpha * t.GetAlpha() / 255);
82 mTransformationType |= TYPE_ALPHA;
83 }
84 if (t.hasMatrix())
85 {
88 }
89}
90
98
103
108
110{
111 mMatrix.reset();
112 mAlpha = 255;
113 mTransformationType = TYPE_IDENTITY;
114}
115
120
122{
123 return &mMatrix;
124}
125
126SNSEND
The SMatrix class holds a 3x3 matrix for transforming coordinates. SMatrix does not have a constructo...
Definition SMatrix.h:22
void set(STransformation t)
Clones the specified transformation.
void updateMatrixType()
Updates the transformation type based on the current matrix and alpha.
void Clear() OVERRIDE
Clears the transformation to the identity matrix and alpha to 1.
IMatrix * GetMatrix() OVERRIDE
Gets the matrix representing the transformation.
bool hasMatrix() const
Checks if the transformation affects the matrix property.
int mTransformationType
Indicates the nature of this transformation.
void Compose(const ITransformation *t) OVERRIDE
Composes this transformation with another transformation.
void compose(const STransformation &t)
Applies this STransformation to an existing STransformation.
BYTE GetAlpha() SCONST OVERRIDE
Gets the degree of transparency.
void SetTransformationType(int type) OVERRIDE
Sets the type of transformation.
void postCompose(STransformation t)
Composes this transformation with another transformation using postConcat.
bool isIdentity() const
Checks if the transformation is the identity transformation.
BYTE mAlpha
The degree of transparency (255 means fully opaque, 0 means fully transparent).
void SetAlpha(BYTE alpha) OVERRIDE
Sets the degree of transparency.
STransformation()
Creates a new transformation with alpha = 1 and the identity matrix.
const SMatrix & getMatrix() const
Gets the 3x3 matrix representing the transformation.
bool hasAlpha() const
Checks if the transformation affects the alpha property.
SMatrix mMatrix
The 3x3 matrix representing the transformation.
void setMatrix(const SMatrix &mtx)
Sets the matrix representing the transformation.
int getTransformationType() const
Indicates the nature of this transformation.