b311480e |
1 | -- Created on: 1993-12-08 |
2 | -- Created by: Jean Louis FRENKEL, Stephane CALLEGARI |
3 | -- Copyright (c) 1993-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
7fd59977 |
22 | |
23 | deferred class WindowDriver from Aspect inherits Driver from Aspect |
24 | |
25 | ---Purpose: defines the WINDOW oriented output driver. |
26 | -- Warning: A limited number of mono attribute and translatable BUFFERS can be defined |
27 | -- for retaining a lot of primitives for DRAGGING . |
28 | -- |
29 | |
30 | uses |
31 | TypeOfResize from Aspect, |
32 | Window from Aspect, |
33 | TypeOfDrawMode from Aspect, |
34 | Factor from Quantity, |
35 | PlaneAngle from Quantity, |
36 | ExtendedString from TCollection |
37 | |
38 | raises |
39 | DriverError from Aspect |
40 | |
41 | is |
42 | Initialize(aWindow: Window from Aspect); |
43 | |
44 | BeginDraw (me: mutable; |
45 | DoubleBuffer: Boolean = Standard_True; |
46 | aRetainBuffer: Integer = 0) |
47 | ---Purpose: Begin graphics and drawn directly to the Window or Pixmap if |
48 | --<aRetainBuffer> is 0 or in the retain buffer if > 0. |
49 | raises DriverError from Aspect is deferred; |
50 | ---Trigger: Raises if the retain buffer is not open. |
51 | -- call BufferIsOpen() method before. |
52 | |
53 | ResizeSpace(me : mutable) |
54 | returns TypeOfResize from Aspect |
55 | raises DriverError from Aspect |
56 | is deferred; |
57 | |
58 | Window(me) returns Window from Aspect; |
59 | |
60 | SetDrawMode (me: mutable; |
61 | aMode: TypeOfDrawMode from Aspect) |
62 | is deferred; |
63 | ---Level: Public |
64 | ---Purpose: Change the current drawing mode of the Driver |
65 | -- XW_REPLACE : the primitive is drawn with his defined color. |
66 | -- XW_ERASE : the primitive is erased from the window. |
67 | -- XW_XOR : the primitive is xored to the window. |
68 | -- XW_XORLIGHT: the primitive is xored depending of the current |
69 | -- highlight and background colors. |
70 | |
71 | ------------------------------------------------------------- |
72 | -- Category: Methods to define or edit a buffer of primitives |
73 | ------------------------------------------------------------- |
74 | |
75 | OpenBuffer (me: mutable; aRetainBuffer: Integer; |
76 | aPivotX: ShortReal = 0.0; |
77 | aPivotY: ShortReal = 0.0; |
78 | aWidthIndex: Integer = 0; |
79 | aColorIndex: Integer = 0; |
80 | aFontIndex: Integer = 0; |
81 | aDrawMode: TypeOfDrawMode = Aspect_TODM_REPLACE) |
82 | returns Boolean is deferred; |
83 | ---Purpose: Allocate the retain buffer <aRetainBuffer> , |
84 | -- Defines the DWU coordinates of the pivot point for all primitives |
85 | --contains inside. |
86 | -- Defines the buffer color and font index : |
87 | -- the default color is the highlight color of the colormap. |
88 | -- the default font is the default system font of the fontmap. |
89 | -- The other attributes are fixed : |
90 | -- line type is Solid, |
91 | -- line width is 1 Pixel, |
92 | -- polygon fill mode is Solid, |
93 | -- Warning: The number of allocated buffers is limited,it's |
94 | --recommended to close unused buffers some time! |
95 | -- The TypeOfDrawMode REPLACE is enabled only if the |
96 | -- background drawing has been drawn with the DoubleBuffer |
97 | -- flag set to ENABLE at the last BeginDraw time. |
98 | -- The TypeOfDrawMode XOR is enabled in any case. |
99 | -- The other TypeOfDrawMode are not authorized. |
100 | -- Returns TRUE if the buffer is allocated and enabled for drawing. |
101 | |
102 | CloseBuffer (me; aRetainBuffer: Integer) |
103 | ---Purpose: Clear & Deallocate the retain buffer <aRetainBuffer>. |
104 | raises DriverError from Aspect is deferred; |
105 | ---Trigger: Raises if the retain buffer is not opened. |
106 | -- call BufferIsOpen() method before. |
107 | |
108 | ClearBuffer (me; aRetainBuffer: Integer) |
109 | ---Purpose: Erase & Clear ALL primitives retains in the buffer <aRetainBuffer>. |
110 | raises DriverError from Aspect is deferred; |
111 | ---Trigger: Raises if the retain buffer is not opened. |
112 | -- call BufferIsOpen() method before. |
113 | |
114 | DrawBuffer (me; aRetainBuffer: Integer) |
115 | ---Purpose: Draw ALL primitives retains in the buffer <aRetainBuffer>. |
116 | -- Warning: Note that the aspect of a retain buffer drawing is |
117 | -- mono-colored with the current buffer Attributes and |
118 | -- Depending of the DoubleBuffer state flag at the BeginDraw() buffer time, |
119 | -- when DB is TRUE,an XOR method is use for drawing and erasing buffers in the |
120 | -- same way.In this case,some color side effect can occurs depending of the |
121 | -- traversal primitive colors and the supported hardware. |
122 | -- when DB is FALSE and the background drawing has been generated with |
123 | -- DB at TRUE,no color side effect occurs because the DB is used for restoring |
124 | -- the drawing context at EraseBuffer() time,this is more powerfull for the |
125 | -- drawing quality excepted for large buffers (flicking) . |
126 | raises DriverError from Aspect is deferred; |
127 | ---Trigger: Raises if the retain buffer is not opened. |
128 | -- call BufferIsOpen() method before. |
129 | |
130 | EraseBuffer (me; aRetainBuffer: Integer) |
131 | ---Purpose: Erase ALL primitives retains in the buffer <aRetainBuffer>. |
132 | raises DriverError from Aspect is deferred; |
133 | ---Trigger: Raises if the retain buffer is not opened. |
134 | -- call BufferIsOpen() method before. |
135 | |
136 | MoveBuffer (me; aRetainBuffer: Integer; |
137 | aPivotX: ShortReal = 0.0; |
138 | aPivotY: ShortReal = 0.0) |
139 | ---Purpose: Erase , Translate and reDraw ALL primitives retains in the buffer |
140 | --<aRetainBuffer>. |
141 | --<aPivotX,aPivotY> are the new DWU attached point absolute coordinates |
142 | --of the buffer pivot point. |
143 | raises DriverError from Aspect is deferred; |
144 | ---Trigger: Raises if the retain buffer is not opened |
145 | -- call BufferIsOpen() method before. |
146 | |
147 | ScaleBuffer (me; aRetainBuffer: Integer; aScaleX: Factor = 1.0; |
148 | aScaleY: Factor = 1.0) |
149 | ---Purpose: Erase , Scale the buffer from the Pivot point and reDraw ALL primitives |
150 | --retains in the buffer <aRetainBuffer>. |
151 | --<aScaleX,aScaleY> are the absolute scale factors apply on the two axis. |
152 | -- Warning: Note that the scalling of some primitives can provided some bad |
153 | --smoothing side effect (i.e: Circles,...) |
154 | raises DriverError from Aspect is deferred; |
155 | ---Trigger: Raises if the retain buffer is not opened or |
156 | --one of <aScale> factor is <= 0. |
157 | -- call BufferIsOpen() method before. |
158 | |
159 | RotateBuffer (me; aRetainBuffer: Integer; anAngle: PlaneAngle = 0.0) |
160 | ---Purpose: Erase , Rotate the buffer from the Pivot point and reDraw ALL primitives |
161 | --retains in the buffer <aRetainBuffer>. |
162 | --<anAngle> is the absolute counter-clockwise rotation angle from the |
163 | --Horizontal axis. |
164 | raises DriverError from Aspect is deferred; |
165 | ---Trigger: Raises if the retain buffer is not opened. |
166 | -- call BufferIsOpen() method before. |
167 | |
168 | ---------------------------- |
169 | -- Category: Inquire methods |
170 | ---------------------------- |
171 | |
172 | BufferIsOpen(me; aRetainBuffer : Integer) returns Boolean is deferred; |
173 | ---Purpose: Returns TRUE if the retain buffer <aRetainBuffer> is enabled |
174 | --for drawing. |
175 | |
176 | BufferIsEmpty(me; aRetainBuffer : Integer) returns Boolean is deferred; |
177 | ---Purpose: Returns TRUE if the retain buffer has not been opened or empty. |
178 | --- Returns FALSE if a lot of primitives have been stored inside |
179 | -- because a BeginDraw(..,<aRetainBuffer>) has been done previously. |
180 | |
181 | BufferIsDrawn(me; aRetainBuffer : Integer) returns Boolean is deferred; |
182 | ---Purpose: Returns TRUE if the retain buffer s actually displayed at screen. |
183 | |
184 | AngleOfBuffer(me; aRetainBuffer : Integer; anAngle: out PlaneAngle) |
185 | ---Purpose: Returns the current buffer rotate angle from the X axis. |
186 | raises DriverError from Aspect is deferred; |
187 | ---Trigger: Raises if the retain buffer is not opened. |
188 | -- call BufferIsOpen() method before. |
189 | |
190 | ScaleOfBuffer(me; aRetainBuffer : Integer; aScaleX,aScaleY: out Factor) |
191 | ---Purpose: Returns the current buffer scale factors. |
192 | raises DriverError from Aspect is deferred; |
193 | ---Trigger: Raises if the retain buffer is not opened. |
194 | -- call BufferIsOpen() method before. |
195 | |
196 | PositionOfBuffer(me; aRetainBuffer : Integer; aPivotX,aPivotY: out ShortReal ) |
197 | ---Purpose: Returns the current buffer position. |
198 | raises DriverError from Aspect is deferred; |
199 | ---Trigger: Raises if the retain buffer is not opened. |
200 | -- call BufferIsOpen() method before. |
201 | |
202 | TextSize (me; aText: ExtendedString from TCollection; |
203 | aWidth, aHeight: out ShortReal from Standard; |
204 | aFontIndex: Integer from Standard = -1) |
205 | ---Level: Public |
206 | ---Purpose: Returns the TEXT size in DWU space depending |
207 | -- of the required FontIndex if aFontIndex is >= 0 |
208 | -- or the current FontIndex if < 0 (default). |
209 | ---Trigger: Raises if font is not defined. |
210 | raises DriverError from Aspect is deferred; |
211 | ---Category: Inquire methods |
212 | |
213 | TextSize (me; aText: ExtendedString from TCollection; |
214 | aWidth, aHeight, anXoffset, anYoffset: out ShortReal from Standard; |
215 | aFontIndex: Integer from Standard = -1) |
216 | ---Level: Public |
217 | ---Purpose: Returns the TEXT size and offsets |
218 | -- in DWU space depending |
219 | -- of the required FontIndex if aFontIndex is >= 0 |
220 | -- or the current FontIndex if < 0 (default). |
221 | ---Trigger: Raises if font is not defined. |
222 | raises DriverError from Aspect is deferred; |
223 | ---Category: Inquire methods |
224 | |
225 | FontSize (me; aSlant: out PlaneAngle from Quantity; |
226 | aSize,aBheight: out ShortReal from Standard; |
227 | aFontIndex: Integer from Standard = -1) |
228 | returns CString from Standard |
229 | ---Level: Public |
230 | ---Purpose: Returns the font string,slant,size and |
231 | --baseline height in DWU space depending |
232 | -- of the required FontIndex if aFontIndex is >= 0 |
233 | -- or the current FontIndex if < 0 (default). |
234 | ---Trigger: Raises if font is not defined. |
235 | raises DriverError from Aspect is deferred; |
236 | ---Category: Inquire methods |
237 | |
238 | ColorBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard) |
239 | is deferred; |
240 | ---Level: Advanced |
241 | ---Purpose: |
242 | -- Returns the min and max driver virtual color indexs. |
243 | ---Category: Inquire methods |
244 | |
245 | LocalColorIndex(me; anIndex : Integer from Standard) |
246 | returns Integer from Standard is deferred; |
247 | ---Level: Advanced |
248 | ---Purpose: |
249 | -- Returns the local colormap hardware index from a virtual driver color |
250 | -- index or returns -1 if the index is not defined. |
251 | ---Category: Inquire methods |
252 | |
253 | FontBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard) |
254 | is deferred; |
255 | ---Level: Advanced |
256 | ---Purpose: |
257 | -- Returns the min and max driver virtual font indexs. |
258 | ---Category: Inquire methods |
259 | |
260 | LocalFontIndex(me; anIndex : Integer from Standard) |
261 | returns Integer from Standard is deferred; |
262 | ---Level: Advanced |
263 | ---Purpose: |
264 | -- Returns the associated fontmap hardware index from a virtual driver font |
265 | -- index or returns -1 if the index is not defined. |
266 | ---Category: Inquire methods |
267 | |
268 | TypeBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard) |
269 | is deferred; |
270 | ---Level: Advanced |
271 | ---Purpose: |
272 | -- Returns the min and max driver virtual type indexs. |
273 | ---Category: Inquire methods |
274 | |
275 | LocalTypeIndex(me; anIndex : Integer from Standard) |
276 | returns Integer from Standard is deferred; |
277 | ---Level: Advanced |
278 | ---Purpose: |
279 | -- Returns the associated typemap hardware index from a virtual driver type |
280 | -- index or returns -1 if the index is not defined. |
281 | ---Category: Inquire methods |
282 | |
283 | WidthBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard) |
284 | is deferred; |
285 | ---Level: Advanced |
286 | ---Purpose: |
287 | -- Returns the min and max driver virtual width indexs. |
288 | ---Category: Inquire methods |
289 | |
290 | LocalWidthIndex(me; anIndex : Integer from Standard) |
291 | returns Integer from Standard is deferred; |
292 | ---Level: Advanced |
293 | ---Purpose: |
294 | -- Returns the associated widthmap hardware index from a virtual driver width |
295 | -- index or returns -1 if the index is not defined. |
296 | ---Category: Inquire methods |
297 | |
298 | MarkBoundIndexs(me; aMinIndex,aMaxIndex : out Integer from Standard) |
299 | is deferred; |
300 | ---Level: Advanced |
301 | ---Purpose: |
302 | -- Returns the min and max driver virtual marker indexs. |
303 | ---Category: Inquire methods |
304 | |
305 | LocalMarkIndex(me; anIndex : Integer from Standard) |
306 | returns Integer from Standard is deferred; |
307 | ---Level: Advanced |
308 | ---Purpose: |
309 | -- Returns the local markmap hardware index from a virtual driver marker |
310 | -- index or returns -1 if the index is not defined. |
311 | ---Category: Inquire methods |
312 | |
313 | fields |
314 | MyWindow : Window from Aspect is protected; |
315 | MyDrawMode : TypeOfDrawMode from Aspect is protected; |
316 | MyRetainBuffer : Integer from Standard is protected; |
317 | |
318 | end WindowDriver from Aspect; |