xref: /haiku/src/apps/icon-o-matic/transformable/ChannelTransform.h (revision 2f470aec1c92ce6917b8a903e343795dc77af41f)
1 /*
2  * Copyright 2006, Haiku. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Stephan Aßmus <superstippi@gmx.de>
7  */
8 
9 #ifndef CHANNEL_TRANSFORM_H
10 #define CHANNEL_TRANSFORM_H
11 
12 #include "Transformable.h"
13 
14 class ChannelTransform : public Transformable {
15  public:
16 								ChannelTransform();
17 								ChannelTransform(const ChannelTransform& other);
18 	virtual						~ChannelTransform();
19 
20 	// ChannelTransform
21 	virtual	void				Update(bool deep = true) {}
22 
23 			void				SetTransformation(const Transformable& other);
24 
25 			void				SetTransformation(BPoint pivot,
26 												  BPoint translation,
27 												  double rotation,
28 												  double xScale,
29 												  double yScale);
30 
31 			void				SetPivot(BPoint pivot);
32 
33 	virtual	void				TranslateBy(BPoint offset);
34 	virtual	void				RotateBy(BPoint origin, double degrees);
35 
36 			void				ScaleBy(double xScale, double yScale);
37 			void				RotateBy(double degrees);
38 
39 			void				SetTranslationAndScale(BPoint offset,
40 													   double xScale,
41 													   double yScale);
42 
43 	virtual	void				Reset();
44 
45 	inline	BPoint				Pivot() const
46 									{ return fPivot; }
47 	inline	BPoint				Translation() const
48 									{ return fTranslation; }
49 	inline	double				LocalRotation() const
50 									{ return fRotation; }
51 	inline	double				LocalXScale() const
52 									{ return fXScale; }
53 	inline	double				LocalYScale() const
54 									{ return fYScale; }
55 
56 			ChannelTransform&	operator=(const ChannelTransform& other);
57 
58  private:
59 			void				_UpdateMatrix();
60 
61 			BPoint				fPivot;
62 			BPoint				fTranslation;
63 			double				fRotation;
64 			double				fXScale;
65 			double				fYScale;
66 };
67 
68 #endif // CHANNEL_TRANSFORM_H
69 
70