b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | /*****************************************************************************/ |
19 | /* */ |
20 | /* EXTENDED HDC */ |
21 | /* */ |
22 | /* Abstract: extends existing WIN32's HDC ( styled lines drawing etc. ) */ |
23 | /* Note : use it only in Windows 95 since Windows NT provides these */ |
24 | /* functionalities */ |
25 | /* */ |
26 | /* History : JAN-1998 EUG ( creation ) */ |
27 | /* */ |
28 | /*****************************************************************************/ |
29 | #ifndef __EHDC_HXX |
30 | # define __EHDC_HXX |
31 | |
32 | # ifndef __cplusplus |
33 | # error "C++ compiler required for EHDC stuff" |
34 | # endif /* __cplusplus */ |
35 | |
36 | # ifndef _WINDOWS_ |
37 | # ifndef STRICT |
38 | # define STRICT |
39 | # endif /* STRICT */ |
40 | # ifndef WIN32_LEAN_AND_MEAN |
41 | # define WIN32_LEAN_AND_MEAN |
42 | # include <windows.h> |
43 | # include <windowsx.h> |
44 | # endif /* WIN32_LEAN_AND_MEAN */ |
45 | # endif /* _WINDOWS_ */ |
46 | |
47 | # define ARCF_PIE 0x00000001 |
48 | # define ARCF_CHORD 0x00000002 |
49 | |
50 | # define POLYF_NOEDGE 0x00000001 |
51 | # define POLYF_NOCLOSEDGE 0x00000002 |
52 | |
53 | # define EHDCF_XFORM 0x00000001 |
54 | # define EHDCF_EPEN 0x00000002 |
55 | # define EHDCF_JOIN 0x00000004 |
56 | # define EHDCF_PDRAW 0x00000008 |
57 | # define EHDCF_CJOIN 0x00000010 |
58 | # define EHDCF_NJOIN 0x00000020 |
59 | # define EHDCF_JBEVL 0x00000040 |
60 | # define EHDCF_SFREE 0x80000000 |
61 | # define EHDCF_TPATH 0x40000000 |
62 | # define EHDCF_TREG 0x20000000 |
63 | # define EHDCF_PPUSH 0x10000000 |
64 | # define EHDCF_BPUSH 0x08000000 |
65 | # define EHDCF_DDAF 0x04000000 |
66 | |
67 | class EHDC { /* defined extended HDC */ |
68 | |
69 | public: |
70 | |
71 | EHDC ( HDC, PSIZE ); /* constructor */ |
72 | EHDC (); /* yet another one */ |
73 | ~EHDC (); /* destructor */ |
74 | |
75 | /*****************/ |
76 | /* DC MANAGEMENT */ |
77 | /*****************/ |
78 | |
79 | void SetDC ( HDC, PSIZE ); |
80 | /* sets WIN32's DC for graphics operations */ |
81 | HDC Hdc ( void ) { return myHDC; } |
82 | /* returns WIN32's HDC */ |
83 | HBRUSH SelectEPen ( DWORD, CONST LOGBRUSH*, DWORD, DWORD*, BOOL = FALSE ); |
84 | /* selects pen for line drawing */ |
85 | void SelectEPen ( DWORD, CONST LOGBRUSH* ); |
86 | /* selects pen for line drawing ( old one is saved ) */ |
87 | HPEN SelectEPen ( HPEN ); |
88 | /* selects pen for line drawing */ |
89 | void SelectEBrush ( PLOGBRUSH, PLOGBRUSH = NULL ); |
90 | /* selects brush for polygon filling */ |
91 | int SetPolyFillMode ( int aMode ) { return ::SetPolyFillMode ( myHDC, aMode ); } |
92 | /* sets polygon fill mode */ |
93 | |
94 | BOOL Miter ( void ) { return !( myFlags & EHDCF_JBEVL ); } |
95 | /* checks for line join style */ |
96 | void SetMiter ( BOOL ); |
97 | /* sets line join style */ |
98 | |
99 | void Extent ( PSIZE psz ) { *psz = mySize; } |
100 | /* Retrieves viewport extents */ |
101 | |
102 | /*******************/ |
103 | /* DRAWING METHODS */ |
104 | /*******************/ |
105 | |
106 | void MoveToEx ( int, int, LPPOINT ); |
107 | /* moves current point and begins a new path */ |
108 | BOOL LineTo ( int, int ); |
109 | /* draws a segment from current position and */ |
110 | /* updates this position */ |
111 | void ClosePath ( void ); |
112 | /* closes current path */ |
113 | void Polyline ( CONST POINT*, int, BOOL = FALSE ); |
114 | /* draws a polyline ( path and current position */ |
115 | /* are unchanged ) */ |
116 | void Polygon ( CONST POINT*, int, DWORD = 0 ); |
117 | /* draws a filled polygon ( path and current position */ |
118 | /* are unchanged ) */ |
119 | /* Note: specify n - 1 points in parameters */ |
120 | void Arc ( int, int, int, int, double = 0.0, double = 6.283185, DWORD = 0 ); |
121 | /* Draws an arc ( path and current position */ |
122 | /* are unchanged ) */ |
123 | void Polyarc ( int, int, int, int, double = 0.0, double = 6.283185, BOOL = TRUE ); |
124 | /* draws a polyarc ( path and current position */ |
125 | /* are unchanged ) */ |
126 | void SetPixel ( int, int, COLORREF ); |
127 | /* draws single pixel */ |
128 | |
129 | /****************/ |
130 | /* TEXT METHODS */ |
131 | /****************/ |
132 | |
133 | void SetTextColor ( COLORREF ); |
134 | void SetTextAttrib ( COLORREF, HFONT, double = 0.0, double = 1.0, double = 1.0 ); |
135 | void ETextOut ( int, int, char*, double = 0.0, BOOL = FALSE ); |
136 | void ETextOut ( int, int, wchar_t*, double = 0.0, BOOL = FALSE ); |
137 | void PolyTextOut ( |
138 | int, int, char*, double = 0.0, double = 0.1, BOOL = FALSE, BOOL = FALSE, |
139 | BOOL = FALSE |
140 | ); |
141 | void PolyTextOut ( |
142 | int, int, wchar_t*, double = 0.0, double = 0.1, BOOL = FALSE, BOOL = FALSE, |
143 | BOOL = FALSE |
144 | ); |
145 | |
146 | /**************************/ |
147 | /* TRANSFORMATION METHODS */ |
148 | /**************************/ |
149 | |
150 | void SetWorldTransform ( XFORM* ); |
151 | void ModifyWorldTransform ( XFORM*, DWORD ); |
152 | void GetWorldTransform ( XFORM* xf ) { *xf = myXform; } |
153 | void Transform ( LPPOINT, int ); |
154 | |
155 | /**************************/ |
156 | /* UPDATED REGION METHODS */ |
157 | /**************************/ |
158 | |
159 | void ResetURect ( void ); |
160 | void SetURect ( LPRECT lpRect ) { myURect = *lpRect; } |
161 | void GetURect ( LPRECT ); |
162 | void Register ( LPPOINT, int ); |
163 | |
164 | protected: |
165 | |
166 | void _Init ( void ); |
167 | void _DrawTo ( PPOINT ); |
168 | void _Join ( void ); |
169 | BOOL _DrawToEx ( PPOINT ); |
170 | void _LineTo ( PPOINT ); |
171 | void _ETextOut ( int, int, void*, double = 0.0, BOOL = FALSE, BOOL = FALSE ); |
172 | void _PolyTextOut ( |
173 | int, int, void*, double = 0.0, double = 0.1, |
174 | BOOL = FALSE, BOOL = FALSE, BOOL = FALSE, BOOL = FALSE |
175 | ); |
176 | |
177 | HDC myHDC; |
178 | POINT myStart; |
179 | POINT myClose; |
180 | POINT myA, myB; |
181 | POINT myJoin; |
182 | POINT myCJoin; |
183 | XFORM myXform; |
184 | DWORD myFlags; |
185 | PPOINT myTextPath; |
186 | PBYTE myTextType; |
187 | DWORD myTextNP; |
188 | DWORD myTextBS; |
189 | HPEN myTextPen; |
190 | HBRUSH myTextBrush; |
191 | HFONT myTextFont; |
192 | double myTextSlant; |
193 | double myTextHScale; |
194 | double myTextVScale; |
195 | DWORD myPWidth, myPWPush; |
196 | HPEN myPPen, myPPenPush; |
197 | HBRUSH myPBrush, myPBrushPush; |
198 | BOOL myfXpenPush; |
199 | PDWORD myPStyle; |
200 | DWORD myPNS; |
201 | DWORD myPBS; |
202 | DWORD myPIndex; |
203 | DWORD myPRlen; |
204 | RECT myURect; |
205 | HBRUSH myBrush, myBrushPush; |
206 | HBRUSH myOBrush; |
207 | SIZE mySize; |
208 | PPOINT myDDA1; |
209 | PPOINT myDDA2; |
210 | DWORD myNDDA; |
211 | DWORD myIDDA; |
212 | |
213 | friend VOID CALLBACK ___auxDDAF ( int, int, LPARAM ); |
214 | |
215 | }; |
216 | |
217 | #endif /* __EHDC_HXX */ |