|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Graphics Extension Library source file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "GfxLineIteratorP.h" |
|
20 |
|
21 |
|
22 // --------------------------------------------------------------------------- |
|
23 // Constructor |
|
24 // --------------------------------------------------------------------------- |
|
25 // -------------------------------------------------------------------------- |
|
26 // CGfxLineIteratorP::CGfxLineIteratorP( TGfxLine2D* aLine, |
|
27 // --------------------------------------------------------------------------- |
|
28 CGfxLineIteratorP::CGfxLineIteratorP( TGfxLine2D* aLine, |
|
29 TGfxAffineTransform* aAffine ) : |
|
30 iLine( aLine ), |
|
31 iIdx( 0 ) |
|
32 { |
|
33 iTransform = aAffine; |
|
34 } |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // Destructor |
|
38 // --------------------------------------------------------------------------- |
|
39 // -------------------------------------------------------------------------- |
|
40 // CGfxLineIteratorP::~CGfxLineIteratorP() |
|
41 // --------------------------------------------------------------------------- |
|
42 CGfxLineIteratorP::~CGfxLineIteratorP() |
|
43 { |
|
44 } |
|
45 |
|
46 // -------------------------------------------------------------------------- |
|
47 // TGfxSegType CGfxLineIteratorP::CurrentSegment( TFloatFixPt* aCoords ) |
|
48 // --------------------------------------------------------------------------- |
|
49 TGfxSegType CGfxLineIteratorP::CurrentSegment( TFloatFixPt* aCoords ) |
|
50 { |
|
51 TGfxSegType segtype; |
|
52 |
|
53 if ( iIdx == 0 ) |
|
54 { |
|
55 aCoords[0] = iLine->iX1; |
|
56 aCoords[1] = iLine->iY1; |
|
57 segtype = EGfxSegMoveTo; |
|
58 } |
|
59 else |
|
60 { |
|
61 aCoords[0] = iLine->iX2; |
|
62 aCoords[1] = iLine->iY2; |
|
63 segtype = EGfxSegLineTo; |
|
64 } |
|
65 if ( !iTransform->IsIdentity() ) |
|
66 { |
|
67 iTransform->Transform( aCoords, aCoords, 1 ); |
|
68 } |
|
69 |
|
70 return segtype; |
|
71 } |
|
72 |
|
73 // -------------------------------------------------------------------------- |
|
74 // TBool CGfxLineIteratorP::IsDone() |
|
75 // --------------------------------------------------------------------------- |
|
76 TBool CGfxLineIteratorP::IsDone() |
|
77 { |
|
78 return ( iIdx > 1 ); |
|
79 } |
|
80 |
|
81 // -------------------------------------------------------------------------- |
|
82 // void CGfxLineIteratorP::Next() |
|
83 // --------------------------------------------------------------------------- |
|
84 void CGfxLineIteratorP::NextL() |
|
85 { |
|
86 iIdx++; |
|
87 } |
|
88 |