diff --git a/src/libs/icon/shape/VectorPath.cpp b/src/libs/icon/shape/VectorPath.cpp index 604cf93733..96f55ed0e1 100644 --- a/src/libs/icon/shape/VectorPath.cpp +++ b/src/libs/icon/shape/VectorPath.cpp @@ -31,6 +31,7 @@ # include "Icons.h" # include "Property.h" # include "PropertyObject.h" +# include "Transformable.h" #endif // ICON_O_MATIC #define obj_new(type, n) ((type *)malloc ((n) * sizeof(type))) @@ -921,6 +922,22 @@ VectorPath::Reverse() _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 void VectorPath::PrintToStream() const diff --git a/src/libs/icon/shape/VectorPath.h b/src/libs/icon/shape/VectorPath.h index d319c9b384..bd7ab129ee 100644 --- a/src/libs/icon/shape/VectorPath.h +++ b/src/libs/icon/shape/VectorPath.h @@ -24,6 +24,7 @@ class BBitmap; class BMessage; class BView; +class Transformable; struct control_point { BPoint point; // actual point on path @@ -154,6 +155,7 @@ class VectorPath { void CleanUp(); void Reverse(); + void ApplyTransform(const Transformable& transform); void PrintToStream() const;