1 #ifndef __drvsvm_h__
2 #define __drvsvm_h__
3 
4 /*
5    drvsvm.h : This file is part of pstoedit
6    Class declaration for the SVM (StarView metafile) output driver.
7    The implementation can be found in drvsvm.cpp
8 
9    Copyright (C) 2005 Thorsten Behrens (tbehrens at acm.org)
10 
11     This program is free software; you can redistribute it and/or modify
12     it under the terms of the GNU General Public License as published by
13     the Free Software Foundation; either version 2 of the License, or
14     (at your option) any later version.
15 
16     This program is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     GNU General Public License for more details.
20 
21     You should have received a copy of the GNU General Public License
22     along with this program; if not, write to the Free Software
23     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 
25 */
26 
27 
28 #include "drvbase.h"
29 #include "genericints.h"
30 
31 #include <utility>
32 #include <vector>
33 
34 
35 class drvSVM : public drvbase {
36 
37 public:
38 
39     // lifetime
40 	derivedConstructor(drvSVM);		// macrofied Constructor
41 	~drvSVM();
42 
43 	class DriverOptions : public ProgramOptions {
44 	public:
45 		OptionT < bool, BoolTrueExtractor> mapToArial;
46 		OptionT < bool, BoolTrueExtractor> emulateNarrowFonts;
47 
DriverOptions()48 		DriverOptions() :
49 		mapToArial(true,"-m",0,0,"map to Arial",0,false),
50 		emulateNarrowFonts(true,"-nf",0,0,"emulate narrow fonts",0,false)
51 		{
52 			ADD(mapToArial);
53 			ADD(emulateNarrowFonts);
54 		}
55 
56 	} * options;
57 
58     // overriding virtual base class methods
59     // -------------------------------------
60 
61 	virtual void ClipPath(cliptype clipmode);
62 	virtual void Save();
63 	virtual void Restore();
64 
65 	virtual void show_image(const PSImage & imageinfo);
driverOK()66 	virtual bool driverOK() const { return isDriverOk; }
67 
68 	typedef GenericInts::Int<32>::signedtype   Int32;
69 	typedef GenericInts::Int<32>::unsignedtype uInt32;
70 	typedef GenericInts::Int<16>::signedtype   Int16;
71 	typedef GenericInts::Int<16>::unsignedtype uInt16;
72 	typedef GenericInts::Int< 8>::signedtype   Int8;
73 	typedef GenericInts::Int< 8>::unsignedtype uInt8;
74 
75     // include _essential_ overrides (also adds a 'private' declaration)
76     // -----------------------------------------------------------------
77 #include "drvfuncs.h"
78 
79 	void show_text(const TextInfo & textInfo);
80 
81 private:
82 
83     typedef std::pair<Int32,Int32>			IntPoint;
84     typedef std::vector<IntPoint> 			VectorOfPoints;
85     typedef std::vector<VectorOfPoints>		VectorOfVectorOfPoints;
86     typedef std::vector<uInt8> 				VectorOfFlags;
87     typedef std::vector<VectorOfFlags>		VectorOfVectorOfFlags;
88 
89     enum LineColorAction
90     {
91         lineColor,
92         noLineColor
93     };
94     enum FillColorAction
95     {
96         fillColor,
97         noFillColor
98     };
99 
100     void setAttrs( LineColorAction eLineAction,
101                    FillColorAction eFillAction );
102     void write_path( VectorOfVectorOfPoints const& polyPolygon,
103                      VectorOfVectorOfFlags const&  polyPolygonFlags );
104     void write_polyline( VectorOfVectorOfPoints const& polyPolygon,
105                          VectorOfVectorOfFlags const&  polyPolygonFlags );
106 
107 	// private data of drvsvm
108     // ----------------------
109 
110     std::ostream::pos_type  headerPos;
111     long int				actionCount;
112     bool 					isDriverOk;
113 
114 };
115 
116 #endif /* #ifndef __drvsvm_h__ */
117