-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTransformIterator.cpp
50 lines (41 loc) · 962 Bytes
/
TransformIterator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include "TransformIterator.h"
TransformIterator::TransformIterator(Matrix2D *transformation, BShape *target)
: BShapeIterator(),
fTransformation(transformation),
fTarget(target)
{
}
TransformIterator::~TransformIterator()
{
}
status_t
TransformIterator::IterateMoveTo(BPoint *point)
{
fTarget->MoveTo((*fTransformation) * (*point));
return B_OK;
}
status_t
TransformIterator::IterateLineTo(int32 lineCount, BPoint *linePts)
{
for (int i = 0; i < lineCount; i++)
fTarget->LineTo((*fTransformation) * linePts[i]);
return B_OK;
}
status_t
TransformIterator::IterateBezierTo(int32 bezierCount, BPoint *bezierPts)
{
BPoint pts[3];
for (int i = 0; i < bezierCount * 3;) {
pts[0] = (*fTransformation) * bezierPts[i++];
pts[1] = (*fTransformation) * bezierPts[i++];
pts[2] = (*fTransformation) * bezierPts[i++];
fTarget->BezierTo(pts);
}
return B_OK;
}
status_t
TransformIterator::IterateClose()
{
fTarget->Close();
return B_OK;
}