* a VectorPath can transform all it's points using a given

Transformable, should have been part of the last commit...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18556 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2006-08-21 18:19:16 +00:00
parent bd04a1e761
commit 2d8b47105a
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -31,6 +31,7 @@
# include "Icons.h" # include "Icons.h"
# include "Property.h" # include "Property.h"
# include "PropertyObject.h" # include "PropertyObject.h"
# include "Transformable.h"
#endif // ICON_O_MATIC #endif // ICON_O_MATIC
#define obj_new(type, n) ((type *)malloc ((n) * sizeof(type))) #define obj_new(type, n) ((type *)malloc ((n) * sizeof(type)))
@@ -921,6 +922,22 @@ VectorPath::Reverse()
_NotifyPathReversed(); _NotifyPathReversed();
} }
// ApplyTransform
void
VectorPath::ApplyTransform(const Transformable& transform)
{
if (transform.IsIdentity())
return;
for (int32 i = 0; i < fPointCount; i++) {
transform.Transform(&(fPath[i].point));
transform.Transform(&(fPath[i].point_out));
transform.Transform(&(fPath[i].point_in));
}
_NotifyPathChanged();
}
// PrintToStream // PrintToStream
void void
VectorPath::PrintToStream() const VectorPath::PrintToStream() const
+2
View File
@@ -24,6 +24,7 @@
class BBitmap; class BBitmap;
class BMessage; class BMessage;
class BView; class BView;
class Transformable;
struct control_point { struct control_point {
BPoint point; // actual point on path BPoint point; // actual point on path
@@ -154,6 +155,7 @@ class VectorPath {
void CleanUp(); void CleanUp();
void Reverse(); void Reverse();
void ApplyTransform(const Transformable& transform);
void PrintToStream() const; void PrintToStream() const;