1 -- Created on: 1997-03-17
2 -- Created by: EugenyPLOTNIKOV
3 -- Copyright (c) 1997-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
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.
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.
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.
21 -- Modified: MAR-98, MAY-98 (DCB)
22 -- OCT-98 (DCB) - see CXX file for details
24 class DDriver from WNT inherits PlotterDriver from PlotMgt
26 ---Purpose: Defines the device-independent Windows NT driver.
27 -- After graphics output enhanced metafile will be created.
28 -- It is possible to play this file on device several times
29 -- by Spool () method.
35 HArray1OfInteger from TColStd,
36 GraphicDevice from WNT,
37 OrientationType from WNT,
38 TypeOfText from Aspect,
45 PlaneAngle from Quantity,
49 Array1OfShortReal from TShort,
50 ExtendedString from TCollection,
51 AsciiString from TCollection,
52 HAsciiString from TCollection,
53 HSequenceOfAsciiString from TColStd,
55 HListOfMFTFonts from WNT,
56 HArray1OfShortReal from TShort,
61 DriverDefinitionError from Aspect,
62 DriverError from Aspect
67 aDeviceName : CString from Standard;
68 aFileName : CString from Standard;
69 anOrientation : OrientationType from WNT = WNT_OT_LANDSCAPE;
70 aScale : Factor from Quantity = 1.0;
71 aCopies : Integer from Standard = 1
72 ) returns mutable DDriver from WNT
73 raises DriverDefinitionError from Aspect;
74 ---Purpose: Constructs a device driver framework defined by the
75 -- string aDeviceName, the path specified as an
76 -- argument for OSD_Path, the type of orientation
77 -- anOrientation, the scale aScale, the number of copies
78 -- aCopies and the flag aPrintFlag.
81 aFileName : CString from Standard;
82 aCopies : Integer from Standard = 1
83 ) returns mutable DDriver from WNT;
85 -- Creates the class object. An empty path is authorized
86 -- and in this case, a temporary enhanced metafile is
87 -- created. You can delete this file by using the EndDraw function.
88 -- Warning - OSD_Path corresponds to an ASCII string.
90 -- Aspect_DriverDefinitionError if the driver could not be defined.
96 BeginDraw ( me : mutable )
98 ---Purpose: Begins a new picture of graphics in the enhanced metafile
100 EndDraw ( me : mutable; fSynchronize: Boolean = Standard_False )
102 ---Purpose: Flushes all graphics, closes enhanced metafile.
105 aPlotMode : PlotMode from Aspect = Aspect_PM_FILEONLY;
106 aDeviceName : CString from Standard = NULL;
107 anOriginalSize : Boolean from Standard = Standard_False
108 ) returns Boolean from Standard
109 raises DriverError from Aspect is redefined;
110 ---Purpose: Spools the driver onto a printer spool.
111 -- Stretches the picture so that it fits into the device
112 -- workspace if the Boolean anOriginalSize is False
113 -- and the workspace dimensions of the original
114 -- device differ from those of the current device. This
115 -- flag is ignored if aDeviceName is NULL.
117 -- If aDeviceName is NULL, then the driver should be
118 -- created with the first constructor. Otherwise, use
119 -- the second constructor to create a class object.
121 -- Aspect_DriverError if the driver is not correctly defined.
123 ---------------------------------------------
124 -- Category: Methods to define the attributes
125 ---------------------------------------------
129 ColorIndex : Integer from Standard;
130 TypeIndex : Integer from Standard;
131 WidthIndex : Integer from Standard
132 ) raises DriverError from Aspect is redefined;
133 ---Purpose: Defines the Current Line Attibutes
137 ColorIndex : Integer from Standard;
138 FontIndex : Integer from Standard
139 ) raises DriverError from Aspect is redefined;
140 ---Purpose: Defines the Current Text Attributes
144 ColorIndex : Integer from Standard;
145 FontIndex : Integer from Standard;
146 aSlant : PlaneAngle from Quantity;
147 aHScale : Factor from Quantity;
148 aWScale : Factor from Quantity;
149 isUnderlined : Boolean from Standard = Standard_False
150 ) raises DriverError from Aspect is redefined;
151 ---Purpose: Defines the Current Extended Text Attributes
155 ColorIndex : Integer from Standard;
156 TileIndex : Integer from Standard;
157 DrawEdge : Boolean from Standard = Standard_False
158 ) raises DriverError from Aspect is redefined;
159 ---Purpose: Sets the poly attributes
163 ColorIndex : Integer from Standard;
164 WidthIndex : Integer from Standard;
165 FillMarker : Boolean from Standard = Standard_False
166 ) raises DriverError from Aspect is redefined;
167 ---Purpose: Defines the Current Marker Attributes
170 ---------------------------
171 -- Category: Images methods
172 ---------------------------
176 anImage : Transient from Standard
177 ) returns Boolean from Standard is redefined;
181 anImageFile : CString from Standard;
182 aWidth, aHeight : out Integer from Standard
183 ) returns Boolean from Standard is redefined;
187 anImageId : Transient from Standard
188 ) raises DriverError from Aspect is redefined;
192 anImageFile : CString from Standard
193 ) raises DriverError from Aspect is redefined;
197 anImageId : Transient from Standard;
198 aX, aY : ShortReal from Standard
199 ) raises DriverError from Aspect is redefined;
202 ---------------------------------------
203 -- Category: Methods to draw primitives
204 ---------------------------------------
207 anImageFile : CString from Standard;
208 aX, aY : ShortReal from Standard;
209 aScale : Factor from Quantity = 1.0
210 ) raises DriverError from Aspect is redefined;
214 anImageId : Transient from Standard;
215 aX, aY : ShortReal from Standard;
216 aWidth, aHeight : Integer from Standard;
217 anArrayOfPixels : Address from Standard
218 ) raises DriverError from Aspect is redefined;
219 ---Purpose: Fills a complete Image .
223 anImageId : Transient from Standard;
224 aX, aY : ShortReal from Standard;
225 anIndexOfLine, aWidth, aHeight : Integer from Standard;
226 anArrayOfPixels : Address from Standard
227 ) raises DriverError from Aspect is redefined;
228 ---Purpose: Fills a line of the Image .
229 -- Warning: 0 <= anIndexOfLine < aHeight
230 -- anIndexOfLine = 0 must be the first call
232 PlotPolyline (me : mutable;
233 xArray : Address from Standard;
234 yArray : Address from Standard;
235 nPts : Address from Standard;
236 nParts : Integer from Standard
237 ) returns Boolean from Standard
238 is redefined protected;
239 ---Purpose: Draws a polyline depending of the SetLineAttrib() attributes.
241 PlotPolygon (me : mutable;
242 xArray : Address from Standard;
243 yArray : Address from Standard;
244 nPts : Address from Standard;
245 nParts : Integer from Standard
246 ) returns Boolean from Standard
247 is redefined protected;
248 ---Purpose: Draws a polygon depending of the SetPolyAttrib() attributes.
252 X1, Y1 : ShortReal from Standard;
253 X2, Y2 : ShortReal from Standard
254 ) returns Boolean from Standard
255 is redefined protected;
256 ---Purpose: Draws a segment depending of the SetLineAttrib() attributes.
260 aText : ExtendedString from TCollection;
261 Xpos : ShortReal from Standard;
262 Ypos : ShortReal from Standard;
263 anAngle : ShortReal from Standard = 0.0;
264 aType : TypeOfText from Aspect = Aspect_TOT_SOLID
265 ) returns Boolean from Standard
266 is redefined protected;
267 ---Purpose: Draws a text depending of the SetTextAttrib() attributes.
268 -- Warning: Coordinates must be defined in DWU space.
272 aText : CString from Standard;
273 Xpos : ShortReal from Standard;
274 Ypos : ShortReal from Standard;
275 anAngle : ShortReal from Standard = 0.0;
276 aType : TypeOfText from Aspect = Aspect_TOT_SOLID
277 ) returns Boolean from Standard
278 is redefined protected;
279 ---Purpose: Draws a text depending of the SetTextAttrib() attributes.
280 -- Warning: Coordinates must be defined in DWU space.
284 aText : ExtendedString from TCollection;
285 Xpos : ShortReal from Standard;
286 Ypos : ShortReal from Standard;
287 aMarge : Ratio from Quantity = 0.1;
288 anAngle : ShortReal from Standard = 0.0;
289 aType : TypeOfText from Aspect = Aspect_TOT_SOLID
290 ) returns Boolean from Standard
291 is redefined protected;
292 ---Purpose: Draws an framed text depending of the
293 -- SetTextAttrib() and SetPolyAttrib() attributes.
294 -- Warning: Coordinates must be defined in DWU space.
295 -- <aMarge> defines the ratio of the space between the
296 -- polygon borders and the bounding box of the text and
297 -- depending of the height of the text.
301 aText : CString from Standard;
302 Xpos : ShortReal from Standard;
303 Ypos : ShortReal from Standard;
304 aMarge : Ratio from Quantity = 0.1;
305 anAngle : ShortReal from Standard = 0.0;
306 aType : TypeOfText from Aspect = Aspect_TOT_SOLID
307 ) returns Boolean from Standard
308 is redefined protected;
309 ---Purpose: Draws an framed text depending of the
310 -- SetTextAttrib() and SetPolyAttrib() attributes.
311 -- Warning: Coordinates must be defined in DWU space.
312 -- <aMarge> defines the ratio of the space between the
313 -- polygon borders and the bounding box of the text and
314 -- depending of the height of the text.
316 PlotPoint ( me : mutable; X, Y : ShortReal from Standard )
317 returns Boolean from Standard
318 is redefined protected;
319 ---Purpose: Draws a 1 PIXEL point depending of the SetMarkerAttrib()
320 -- color attribute or add a point depending of the incremental BeginXxxxxx()
325 aMarker : Integer from Standard;
326 Xpos : ShortReal from Standard;
327 Ypos : ShortReal from Standard;
328 Width : ShortReal from Standard;
329 Height : ShortReal from Standard;
330 Angle : ShortReal from Standard = 0.0
331 ) returns Boolean from Standard
332 is redefined protected;
333 ---Purpose: Draws the prevously defined marker <aMarker>
334 -- depending of the SetMarkerAttrib() attributes.
335 -- Warning: Coordinates and sizes must be defined in DWU space.
336 -- Angle must be defined in RADIAN.
337 -- A one pixel marker is drawn when aMarker index is undefined
341 X, Y : ShortReal from Standard;
342 anXradius, anYradius : ShortReal from Standard;
343 aStartAngle : ShortReal from Standard = 0.0;
344 anOpenAngle : ShortReal from Standard = 6.283185
345 ) returns Boolean from Standard
346 is redefined protected;
347 ---Purpose: Draws an Ellipsoid arc of center <X,Y> and Radius
348 -- <anXradius,anYradius> of relative angle <anOpenAngle> from
349 -- the base angle <aStartAngle> and depending of the SetLineAttrib() attributes
353 X, Y : ShortReal from Standard;
354 anXradius, anYradius : ShortReal from Standard;
355 aStartAngle : ShortReal from Standard = 0.0;
356 anOpenAngle : ShortReal from Standard = 6.283185
357 ) returns Boolean from Standard
358 is redefined protected;
359 ---Purpose: Draws an filled Ellipsoid arc of center <X,Y> and Radius
360 -- <anXradius,anYradius> of relative angle <anOpenAngle> from
361 -- the base angle <aStartAngle> and depending of the SetPolyAttrib() attributes.
363 BeginPolyline ( me : mutable; aNumber : Integer ) is static;
364 ---Purpose: Begin an incremental polyline primitive of <aNumber> of points
365 -- Warning: Points must be added by the the DrawPoint() method.
367 BeginPolygon ( me : mutable; aNumber : Integer )
369 ---Purpose: Begin an incremental polygon primitive of <aNumber> of points
370 -- Warning: Points must be added by the the DrawPoint() method.
372 BeginSegments ( me : mutable )
374 ---Purpose: Begin a set of segments .
375 -- Warning: Segments must be added by the DrawSegment() method
377 BeginArcs ( me : mutable )
379 ---Purpose: Begin a set of circles or ellips .
380 -- Warning: Arcs must be added by the DrawArc() methods
382 BeginPolyArcs ( me : mutable )
384 ---Purpose: Begin a set of polygon circles or ellips
385 -- Warning: Arcs must be added by the DrawPolyArc() methods
387 BeginMarkers ( me : mutable )
390 ---Purpose: Begin a set of markers .
391 -- Warning: Markers must be added by the DrawMarker() method
393 BeginPoints ( me : mutable )
396 ---Purpose: Begin a set of points .
397 -- Warning: Points must be added by the DrawPoint() method
399 ClosePrimitive ( me : mutable ) raises DriverError from Aspect is static;
400 ---Purpose: Close the last Begining primitive
402 ---------------------------------------------
403 -- Category: Methods to define the attributes
404 ---------------------------------------------
405 InitializeColorMap(me: mutable; aColorMap: ColorMap from Aspect)
406 raises DriverError from Aspect is redefined protected;
407 ---Category: Methods to define the ColorIndexs
409 InitializeTypeMap(me: mutable; aTypeMap: TypeMap from Aspect)
410 raises DriverError from Aspect is redefined protected;
411 ---Category: Methods to define the TypeIndexs
413 InitializeWidthMap(me: mutable; aWidthMap: WidthMap from Aspect)
414 raises DriverError from Aspect is redefined protected;
415 ---Category: Methods to define the WidthIndexs
417 InitializeFontMap(me: mutable; aFontMap: FontMap from Aspect)
418 raises DriverError from Aspect is redefined protected;
419 ---Category: Methods to define the FontIndexs
421 InitializeMarkMap(me: mutable; aFontMap: MarkMap from Aspect)
422 raises DriverError from Aspect is redefined protected;
423 ---Category: Methods to define the MarkIndexs
426 ----------------------------
427 -- Category: Inquire methods
428 ----------------------------
431 WorkSpace ( me ; Width,Heigth : out Length from Quantity ) is static;
432 ---Purpose: Returns the Available WorkSpace in DWU coordinates
434 Convert ( me ; PV : Integer from Standard ) returns Length from Quantity is static;
435 ---Purpose: Returns the DWU value depending of
438 Convert ( me ; DV : Length from Quantity ) returns Integer from Standard is static;
439 ---Purpose: Returns the PIXEL value depending of the DWU value.
443 PX, PY : Integer from Standard;
444 DX, DY : out Length from Quantity
446 ---Purpose: Returns the DWU position depending of the PIXEL position .
450 DX, DY : Length from Quantity;
451 PX, PY : out Integer from Standard
453 ---Purpose: Returns the PIXEL position depending of the DWU position
457 aText : ExtendedString from TCollection;
458 aWidth, aHeight : out ShortReal from Standard;
459 aFontIndex : Integer from Standard = -1
461 ---Purpose: Returns the TEXT size in DWU space depending
462 -- of the required FontIndex if aFontIndex is >= 0
463 -- or the current FontIndex if < 0 (default).
467 aText : ExtendedString from TCollection;
468 aWidth, aHeight, anXoffset, anYoffset : out ShortReal from Standard;
469 aFontIndex: Integer from Standard = -1
471 ---Purpose: Returns the TEXT size and offsets
472 -- in DWU space depending
473 -- of the required FontIndex if aFontIndex is >= 0
474 -- or the current FontIndex if < 0 (default).
478 aText : CString from Standard;
479 aWidth, aHeight, anXoffset, anYoffset : out ShortReal from Standard;
480 aFontIndex : Integer from Standard = -1
482 ---Purpose: Returns the TEXT size in DWU space depending
483 -- of the required FontIndex if aFontIndex is >= 0
484 -- or the current FontIndex if < 0 (default).
486 HDC ( me ) returns Handle from Aspect is static;
487 ---Purpose: Returns device context handle
489 ClientRect ( me; aWidth, aHeigth : out Integer from Standard ) is static;
490 ---Purpose: Returns dimensions of the device
492 GraphicDevice ( me ) returns GraphicDevice from WNT is static;
493 ---Purpose: Returns graphic device
495 DeviceList ( myclass )
496 returns HSequenceOfAsciiString from TColStd
497 raises DriverError from Aspect;
498 ---Purpose: Returns list of available graphic devices.
499 -- First element is default device
502 aDevice : AsciiString from TCollection;
503 aWidth, aHeight: out Real from Standard);
504 ---Purpose: Returns size of a specified device.
508 aWidth : out Integer from Standard;
509 aHeight : out Integer from Standard;
510 aSwap : out Integer from Standard
511 ) returns Real from Standard;
512 ---Purpose: returns dimensions, in .01 millimeter units,
513 -- of a rectangle that surrounds the picture stored
514 -- in the metafile ( parameters <aWidth> & <aHeight> ).
515 -- <aSwap> value idicates whether rotate operation
516 -- (portrait/landscape) was performed or not. Valid
517 -- values are: <0> - no rotation
519 -- <2> - could not determine
520 -- Returns ratio between <aWidth> & <aHeight>.
521 -- Warning: returns <-1> in case of error
523 ProcessColorIndex ( me; ColorIndex : Integer from Standard )
524 returns Integer from Standard is private;
526 ProcessWidthIndex ( me; WidthIndex : Integer from Standard )
527 returns Length from Quantity is private;
529 ProcessTypeIndex ( me; TypeIndex : Integer from Standard )
530 returns Integer from Standard is private;
533 anOriginalSize : Boolean from Standard;
534 aPlotMode : PlotMode from Aspect = Aspect_PM_NPLOTTER
535 ) returns Boolean from Standard is private;
536 ---Purpose: Internal methods
538 TextManager (me: mutable)
539 returns TextManager from WNT;
540 ---C++: return const &
541 ---Category: Inquire methods
543 MFT_Font (me: mutable; anIndex: Integer)
544 returns FontManager from MFT;
545 ---C++: return const &
546 ---Category: Inquire methods
548 MFT_Size (me: mutable; anIndex: Integer)
550 ---Category: Inquire methods
553 myRect : Address from Standard;
554 myPrnName : AsciiString from TCollection; -- Name of .PRN file
555 myEmfName : AsciiString from TCollection; -- Name of .EMF file
557 myAllocator : Address from Standard;
558 myPixelToUnit : Real from Standard;
559 myImageName : HAsciiString from TCollection;
560 myDevice : GraphicDevice from WNT;
561 myHDC : Handle from Aspect;
562 myHDCMeta : Handle from Aspect;
563 myHMetaFile : Handle from Aspect;
564 myImage : Handle from Aspect;
565 myOrientation : OrientationType from WNT;
566 myScale : Factor from Quantity;
567 myFlags : Integer from Standard;
568 myNCopies : Integer from Standard;
570 myColors : HColorTable from WNT;
571 myFonts : HFontTable from WNT;
572 myTypeIdxs : HArray1OfInteger from TColStd;
573 myWidthIdxs : HArray1OfInteger from TColStd;
574 myMarkerIdxs : HArray1OfInteger from TColStd;
576 myMFTFonts : HListOfMFTFonts from WNT;
577 myMFTSizes : HArray1OfShortReal from TShort;
578 myNTextManager : TextManager from WNT;
580 end DDriver from WNT;