Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoVectorizeGDIAction.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef __SO_VECTORIZE_GDI_ACTION_
25#define __SO_VECTORIZE_GDI_ACTION_
26
27#include <SbTypes.h>
28
29#ifdef _WIN32
30# ifdef _SO_QT_
31# include <windows.h>
32# include <wingdi.h>
33# else
34# include <Inventor/Win/SoWinDef.h>
35# endif
36#else
37# define HPEN void *
38# define HGDIOBJ void *
39# define HBRUSH void *
40# define HGDIOBJ void *
41 typedef uint32_t DWORD;
42 typedef DWORD COLORREF;
43 {
44 long x;
45 long y;
46 } POINT;
47#endif
48
49#include <HardCopy/SoVectorizeAction.h>
50
65{
66
67 public:
68
73
79
86 SoNONUNICODE SbBool openFile(const char *file_name);
87
92 SbBool openFile( const SbString& file_name );
93
101 void openFile(HDC hdc);
102
106 void openFile();
107
112 void closeFile();
113
114 private:
115
116 SbString getGDIOutputName();
117
118 HDC getGDIHdc();
119
120 private:
121 // data
122 SbString m_filename;
123 HDC m_hdc;
124};
125
201{
202
203 SO_ACTION_HEADER(SoVectorizeGDIAction);
204
205 public:
206
211
216
217 /* Access methods */
218
223
227 SbBool hasPrinter() { return m_hasPrinter; };
228
229private:
233 static void initClass();
234 static void exitClass();
235
236 private:
237 /* Functions which really draw */
238 virtual void printPolyMark(const SbVec4f* points, int num_points,
239 const SbColor* colors, SbBool color_flag, float size);
240 virtual void printPolyMark(const SbVec4f* points, int num_points,
241 const SbColor* colors, SbBool color_flag,
242 SoMarkerSet *markerSet);
243 virtual void printImage(const SbVec4f &origin, const unsigned char *imagePixels,
244 SbVec2s &sourceSize, SbVec2s &requestedSize,
245 int numComponents,
246 SoImage::HorAlignment horAlign,
247 SoImage::VertAlignment vertAlign);
248 virtual void printPolyLine(const SbVec4f* points, int num_points,
249 const SbColor* colors, SbBool color_flag,
250 float thickness, u_short pattern, int linePatternScaleFactor);
251 virtual void printPolygon(const SbVec4f* points, int num_points,
252 const SbColor* colors, SbBool color_flag, const SbString &category,
253 const SbString &name, const unsigned char* pattern);
254 virtual void printText2(const SbVec4f point, const SbColor color,
255 const SbString& font_name, float font_size,
256 const SbString& string, int justif, float angle);
257
258 // Retrieves the printer DC
259 HDC getPrinterDC(void);
260
261 // Write header and footer
262 virtual void writeHeader();
263 virtual void writeFooter();
264
265 // Print the border and the background
266 virtual void printBorder();
267 virtual void printBackground();
268
269 // Set hardware clipping
270 virtual void setHardwareClip();
271
272 // Miscellaneous methods
273 private:
274 void assignColor(SbColor, float);
275 void selectPen(DWORD, DWORD, COLORREF, SbBool);
276 SbBool isPenUsedAgain(DWORD, DWORD, COLORREF, SbBool);
277 void pointsToLandscape(POINT *, int);
278
279 // data
280 {
281 DWORD style;
282 DWORD thickness;
283 COLORREF color;
284 } structCurrentPen;
285
286 structCurrentPen currentPen;
287 HPEN m_currentPen;
288 HGDIOBJ m_oldPen;
289 HBRUSH m_currentBrush;
290 HGDIOBJ m_oldBrush;
291 COLORREF m_currentBrushColor;
292 SbBool m_patternFlag;
293
294 SbColor m_currentColor;
295 EndLineStyle m_currentLineEndStyle;
296 JoinLineStyle m_currentLineJoinsStyle;
297 float m_currentMiterLimit;
298
299 SbString m_filename;
300
301 HDC m_hdc;
302 SbBool m_hasPrinter;
303
304 SbBool m_printerFlag;
305 SbBool m_solidPenFlag;
306 int m_offsetX, m_offsetY;
307 int m_portraitWidth;
308 int m_unitRatio;
309};
310
311//***************************************************************************************
312#endif //__SO_VECTORIZE_GDI_ACTION_
313
Color vector class.
Definition SbColor.h:82
Class for smart character strings.
Definition SbString.h:202
2D vector class.
Definition SbVec.h:700
4D vector class.
Definition SbVec.h:2214
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Manage vector output t...
void openFile()
Default method: Opens the printer dialog box for paper output.
virtual ~SoGDIVectorOutput()
Destructor.
void closeFile()
Fully optional.
SoNONUNICODE SbBool openFile(const char *file_name)
Opens the GDI output as a Windows Enhanced MetaFile (.EMF) from the given file name.
SbBool openFile(const SbString &file_name)
Opens the GDI output as a Windows Enhanced MetaFile (.EMF) from the given file name.
void openFile(HDC hdc)
Initializes GDI output using the given device context (type HDC).
SoGDIVectorOutput()
Constructor.
VertAlignment
Vertical alignment.
Definition SoImage.h:146
HorAlignment
Horizontal alignment.
Definition SoImage.h:130
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Extension of Poi...
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Abstract class used to...
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Abstract class for vec...
EndLineStyle
End line style.
JoinLineStyle
Join line style.
<a href="IconLegend.html"><img src="extHC.gif" alt="HardCopy" border="0"></a> Vectorize a scene grap...
SoGDIVectorOutput * getGDIVectorOutput() const
Returns the SoGDIVectorOutput instance in action.
SbBool hasPrinter()
Returns TRUE if the printer is set.
virtual ~SoVectorizeGDIAction()
Destructor.
SoVectorizeGDIAction()
Constructor.
int SbBool
Boolean type.
Definition SbBase.h:87