2 * Copyright 2006, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
9 #ifndef TRANSFORMABLE_H
10 #define TRANSFORMABLE_H
14 #include <agg_trans_affine.h>
16 #include "IconBuild.h"
22 class Transformable
: public agg::trans_affine
{
29 Transformable(const Transformable
& other
);
30 virtual ~Transformable();
32 void StoreTo(double matrix
[matrix_size
]) const;
33 void LoadFrom(const double matrix
[matrix_size
]);
35 // set to or combine with other matrix
36 void SetTransform(const Transformable
& other
);
37 Transformable
& operator=(const Transformable
& other
);
38 Transformable
& Multiply(const Transformable
& other
);
43 bool IsIdentity() const;
44 bool IsTranslationOnly() const;
45 bool IsNotDistorted() const;
48 bool operator==(const Transformable
& other
) const;
49 bool operator!=(const Transformable
& other
) const;
51 // transforms coordiantes
52 void Transform(double* x
, double* y
) const;
53 void Transform(BPoint
* point
) const;
54 BPoint
Transform(const BPoint
& point
) const;
56 void InverseTransform(double* x
, double* y
) const;
57 void InverseTransform(BPoint
* point
) const;
58 BPoint
InverseTransform(const BPoint
& point
) const;
60 // transforms the rectangle "bounds" and
61 // returns the *bounding box* of that
62 BRect
TransformBounds(BRect bounds
) const;
64 // some convenience functions
65 virtual void TranslateBy(BPoint offset
);
66 virtual void RotateBy(BPoint origin
, double degrees
);
67 virtual void ScaleBy(BPoint origin
, double xScale
, double yScale
);
68 virtual void ShearBy(BPoint origin
, double xShear
, double yShear
);
70 virtual void TransformationChanged();
71 // hook function that is called when the transformation
72 // is changed for some reason
82 #endif // TRANSFORMABLE_H