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 void RotateBy(double degrees); 36 37 virtual void ScaleBy(BPoint origin, double xScale, 38 double yScale); 39 void ScaleBy(double xScale, double yScale); 40 41 void SetTranslationAndScale(BPoint offset, 42 double xScale, 43 double yScale); 44 45 virtual void Reset(); 46 47 inline BPoint Pivot() const 48 { return fPivot; } 49 inline BPoint Translation() const 50 { return fTranslation; } 51 inline double LocalRotation() const 52 { return fRotation; } 53 inline double LocalXScale() const 54 { return fXScale; } 55 inline double LocalYScale() const 56 { return fYScale; } 57 58 ChannelTransform& operator=(const ChannelTransform& other); 59 60 private: 61 void _UpdateMatrix(); 62 63 BPoint fPivot; 64 BPoint fTranslation; 65 double fRotation; 66 double fXScale; 67 double fYScale; 68 }; 69 70 #endif // CHANNEL_TRANSFORM_H 71 72