lib

kowmfstruct.h
1/* This library is distributed under the conditions of the GNU LGPL.
2 * WMF Metafile Structures
3 * Author: 2002/2003 thierry lorthiois
4 */
5#ifndef _KOWMFSTRUCT_H_
6#define _KOWMFSTRUCT_H_
7
8#include <tqglobal.h>
9#include <tqnamespace.h>
10
11#define APMHEADER_KEY 0x9AC6CDD7
12#define ENHMETA_SIGNATURE 0x464D4520
13
14struct WmfMetaHeader
15{
16 TQ_UINT16 fileType; // Type of metafile (0=memory, 1=disk)
17 TQ_UINT16 headerSize; // always 9
18 TQ_UINT16 version;
19 TQ_UINT32 fileSize; // Total size of the metafile in WORDs
20 TQ_UINT16 numOfObjects; // Maximum Number of objects in the stack
21 TQ_UINT32 maxRecordSize; // The size of largest record in WORDs
22 TQ_UINT16 numOfParameters; // not used (always 0)
23};
24
25
26struct WmfPlaceableHeader
27{
28 TQ_UINT32 key; // Magic number (always 9AC6CDD7h)
29 TQ_UINT16 handle; // Metafile HANDLE number (always 0)
30 TQ_INT16 left; // Left coordinate in metafile units
31 TQ_INT16 top;
32 TQ_INT16 right;
33 TQ_INT16 bottom;
34 TQ_UINT16 inch; // Number of metafile units per inch
35 TQ_UINT32 reserved;
36 TQ_UINT16 checksum; // Checksum value for previous 10 WORDs
37};
38
39
40struct WmfEnhMetaHeader
41{
42 TQ_UINT32 recordType; // Record type (is always 00000001h)
43 TQ_UINT32 recordSize; // Record size in bytes. This may be greater
44 // than the sizeof( ENHMETAHEADER ).
45 TQ_INT32 boundsLeft; // Inclusive-inclusive bounds in device units
46 TQ_INT32 boundsTop;
47 TQ_INT32 boundsRight;
48 TQ_INT32 boundsBottom;
49 TQ_INT32 frameLeft; // Inclusive-inclusive Picture Frame
50 TQ_INT32 frameTop;
51 TQ_INT32 frameRight;
52 TQ_INT32 frameBottom;
53 TQ_UINT32 signature; // Signature. Must be ENHMETA_SIGNATURE.
54 TQ_UINT32 version; // Version number
55 TQ_UINT32 size; // Size of the metafile in bytes
56 TQ_UINT32 numOfRecords; // Number of records in the metafile
57 TQ_UINT16 numHandles; // Number of handles in the handle table
58 // Handle index zero is reserved.
59 TQ_UINT16 reserved; // always 0
60 TQ_UINT32 sizeOfDescription; // Number of chars in the unicode description string
61 // This is 0 if there is no description string
62 TQ_UINT32 offsetOfDescription; // Offset to the metafile description record.
63 // This is 0 if there is no description string
64 TQ_UINT32 numPaletteEntries; // Number of color palette entries
65 TQ_INT32 widthDevicePixels; // Size of the reference device in pixels
66 TQ_INT32 heightDevicePixels;
67 TQ_INT32 widthDeviceMM; // Size of the reference device in millimeters
68 TQ_INT32 heightDeviceMM;
69};
70
71
72struct WmfMetaRecord
73{
74 TQ_UINT32 size; // Total size of the record in WORDs
75 TQ_UINT16 function; // Record function number
76 TQ_UINT16 param[ 1 ]; // TQ_UINT16 array of parameters
77};
78
79
80struct WmfEnhMetaRecord
81{
82 TQ_UINT32 function; // Record function number
83 TQ_UINT32 size; // Record size in bytes
84 TQ_UINT32 param[ 1 ]; // TQ_UINT32 array of parameters
85};
86
87// Static data
88 static const struct OpTab
89 {
90 TQ_UINT32 winRasterOp;
91 TQt::RasterOp qtRasterOp;
92 } koWmfOpTab32[] =
93 {
94 { 0x00CC0020, TQt::CopyROP },
95 { 0x00EE0086, TQt::OrROP },
96 { 0x008800C6, TQt::AndROP },
97 { 0x00660046, TQt::XorROP },
98 { 0x00440328, TQt::AndNotROP },
99 { 0x00330008, TQt::NotCopyROP },
100 { 0x001100A6, TQt::NandROP },
101 { 0x00C000CA, TQt::CopyROP },
102 { 0x00BB0226, TQt::NotOrROP },
103 { 0x00F00021, TQt::CopyROP },
104 { 0x00FB0A09, TQt::CopyROP },
105 { 0x005A0049, TQt::CopyROP },
106 { 0x00550009, TQt::NotROP },
107 { 0x00000042, TQt::ClearROP },
108 { 0x00FF0062, TQt::SetROP }
109 };
110
111 static const TQt::RasterOp koWmfOpTab16[] =
112 {
113 TQt::CopyROP,
114 TQt::ClearROP, TQt::NandROP, TQt::NotAndROP, TQt::NotCopyROP,
115 TQt::AndNotROP, TQt::NotROP, TQt::XorROP, TQt::NorROP,
116 TQt::AndROP, TQt::NotXorROP, TQt::NopROP, TQt::NotOrROP,
117 TQt::CopyROP, TQt::OrNotROP, TQt::OrROP, TQt::SetROP
118 };
119
120 static const TQt::BrushStyle koWmfHatchedStyleBrush[] =
121 {
122 TQt::HorPattern,
123 TQt::VerPattern,
124 TQt::FDiagPattern,
125 TQt::BDiagPattern,
126 TQt::CrossPattern,
127 TQt::DiagCrossPattern
128 };
129
130 static const TQt::BrushStyle koWmfStyleBrush[] =
131 { TQt::SolidPattern,
132 TQt::NoBrush,
133 TQt::FDiagPattern, /* hatched */
134 TQt::Dense4Pattern, /* should be custom bitmap pattern */
135 TQt::HorPattern, /* should be BS_INDEXED (?) */
136 TQt::VerPattern, /* should be device-independent bitmap */
137 TQt::Dense6Pattern, /* should be device-independent packed-bitmap */
138 TQt::Dense2Pattern, /* should be BS_PATTERN8x8 */
139 TQt::Dense3Pattern /* should be device-independent BS_DIBPATTERN8x8 */
140 };
141
142 static const TQt::PenStyle koWmfStylePen[] =
143 { TQt::SolidLine, TQt::DashLine, TQt::DotLine, TQt::DashDotLine, TQt::DashDotDotLine,
144 TQt::NoPen, TQt::SolidLine };
145
146#endif
147
unsigned int version()
Returns the encoded number of KOffice's version, see the KOFFICE_VERSION macro.