1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
|
/************************************************************************/
/* */
/* Windows Meta File specific definitions. */
/* */
/************************************************************************/
# include <X11/Xlib.h>
# include <bitmap.h>
# include <docFont.h>
# include <appColor.h>
# include <appDraw.h>
# include <appImage.h>
# include <sioGeneral.h>
# define WINMETA_Arc 0x0817
# define WINMETA_Chord 0x0830
# define WINMETA_Ellipse 0x0418
# define WINMETA_ExcludeClipRect 0x0415
# define WINMETA_FloodFill 0x0419
# define WINMETA_IntersectClipRect 0x0416
# define WINMETA_LineTo 0x0213
# define WINMETA_MoveTo 0x0214
# define WINMETA_OffsetClipRgn 0x0220
# define WINMETA_OffsetViewportOrg 0x0211
# define WINMETA_OffsetWindowOrg 0x020f
# define WINMETA_PatBlt 0x061d
# define WINMETA_Pie 0x081a
# define WINMETA_RealizePalette 0x0035
# define WINMETA_Rectangle 0x041b
# define WINMETA_ResizePalette 0x0319
# define WINMETA_RestoreDC 0x0127
# define WINMETA_RoundRect 0x061c
# define WINMETA_SaveDC 0x001e
# define WINMETA_ScaleViewportExt 0x0412
# define WINMETA_ScaleWindowExt 0x0400
# define WINMETA_SetBkColor 0x0201
# define WINMETA_SetBkMode 0x0102
# define WINMETA_SetMapMode 0x0103
# define WINMETA_SetMapperFlags 0x0231
# define WINMETA_SetPixel 0x041f
# define WINMETA_SetPolyFillMode 0x0106
# define WINMETA_SetROP2 0x0104
# define WINMETA_SetStretchBltMode 0x0107
# define WINMETA_SetTextAlign 0x012e
# define WINMETA_SetTextCharExtra 0x0108
# define WINMETA_SetTextColor 0x0209
# define WINMETA_SetTextJustification 0x020a
# define WINMETA_SetViewportExt 0x020e
# define WINMETA_SetViewportOrg 0x020d
# define WINMETA_SetWindowExt 0x020c
# define WINMETA_SetWindowOrg 0x020b
# define WINMETA_AnimatePalette 0x0436
# define WINMETA_BitBlt_2 0x0922
# define WINMETA_BitBlt 0x0940
# define WINMETA_CreateBrushIndirect 0x02fc
# define WINMETA_CreateFontIndirect 0x02fb
# define WINMETA_CreatePalette 0x00f7
# define WINMETA_CreatePatternBrush_2 0x01f9
# define WINMETA_CreatePatternBrush 0x0142
# define WINMETA_CreatePenIndirect 0x02fa
# define WINMETA_CreateRegion 0x06ff
# define WINMETA_DeleteObject 0x01f0
# define WINMETA_Escape 0x0626
# define WINMETA_ExtTextOut 0x0a32
# define WINMETA_Polygon 0x0324
# define WINMETA_PolyPolygon 0x0538
# define WINMETA_PolyLine 0x0325
# define WINMETA_SelectClipRgn 0x012c
# define WINMETA_SelectObject 0x012d
# define WINMETA_SelectPalette 0x0234
# define WINMETA_SetDIBitsToDevice 0x0d33
# define WINMETA_SetPaletteEntries 0x0037
# define WINMETA_StretchBlt_2 0x0b23
# define WINMETA_StretchBlt 0x0b41
# define WINMETA_StretchDIBits 0x0f43
# define WINMETA_TextOut 0x0521
/************************************************************************/
/* */
/* 1) Various MapModes: Refer to petzold for an explanation. */
/* 2) StrechBlt() modes. */
/* 3) Font family styles. */
/* */
/************************************************************************/
/* 1 */
# define MM_TEXT 1
# define MM_LOMETRIC 2
# define MM_HIMETRIC 3
# define MM_LOENGLISH 4
# define MM_HIENGLISH 5
# define MM_TWIPS 6
# define MM_ISOTROPIC 7
# define MM_ANISOTROPIC 8
/* 2 */
# define STRETCH_BLT_BLACKONWHITE 1
# define STRETCH_BLT_WHITEONBLACK 2
# define STRETCH_BLT_COLORONCOLOR 3
/* 3 */
# define FF_DONTCARE 0x00
# define FF_ROMAN 0x10
# define FF_SWISS 0x20
# define FF_MODERN 0x30
# define FF_SCRIPT 0x40
# define FF_DECORATIVE 0x50
/************************************************************************/
/* */
/* Implementation of a metafile 'Object' */
/* */
/************************************************************************/
# define TA_LEFT 0x01
# define TA_RIGHT 0x02
# define TA_CENTER 0x04
# define TA_TOP 0x08
# define TA_BOTTOM 0x10
# define TA_BASELINE 0x20
# define TA_UPDATECP 0x40
# define BKMODE_OPAQUE 0
# define BKMODE_TRANSPARENT 1
typedef struct LogicalBrush
{
int lbStyle;
# define BS_SOLID 0
# define BS_NULL 1
# define BS_HOLLOW BS_NULL
# define BS_HATCHED 2
# define BS_PATTERN 3
# define BS_INDEXED 4
# define BS_DIBPATTERN 5
RGB8Color lbColor;
long lbHatch;
} LogicalBrush;
typedef struct LogicalPen
{
int lpStyle;
# define PS_SOLID 0
# define PS_DASH 1
# define PS_DOT 2
# define PS_DASHDOT 3
# define PS_DASHDOTDOT 4
# define PS_NULL 5
# define PS_INSIDEFRAME 6
int lpWidth;
RGB8Color lpColor;
} LogicalPen;
typedef struct LogicalFont
{
int lfHeight;
int lfWidth;
int lfEscapement;
int lfOrientation;
int lfWeight;
unsigned char lfItalic;
unsigned char lfUnderline;
unsigned char lfStrikeOut;
unsigned char lfCharSet;
unsigned char lfOutPrecision;
unsigned char lfClipPrecision;
unsigned char lfQuality;
unsigned char lfPitchAndFamily;
char lfFaceName[32];
/************************************/
/* Implementation */
/************************************/
TextAttribute lfTextAttribute;
int lfPrivateFont;
} LogicalFont;
typedef struct LogicalPalette
{
int lpVersion;
int lpColorCount;
} LogicalPalette;
typedef union MetafileSpecific
{
LogicalBrush mfsLogicalBrush;
LogicalPen mfsLogicalPen;
LogicalFont mfsLogicalFont;
} MetafileSpecific;
typedef struct MetaFileObject
{
int mfoType;
MetafileSpecific mfoSpecific;
} MetaFileObject;
# define MFtypeFREE 0
# define MFtypeBRUSH 1
# define MFtypePEN 2
# define MFtypeFONT 3
# define MFtypePALETTE 4
# define MFtypePATTERNBRUSH 5
# define mfoLogicalBrush mfoSpecific.mfsLogicalBrush
# define mfoLogicalPen mfoSpecific.mfsLogicalPen
# define mfoLogicalFont mfoSpecific.mfsLogicalFont
typedef struct DeviceContext
{
int dcMapMode;
int dcDrawBorders;
int dcFillInsides;
int dcROP2;
LogicalPen dcPen;
LogicalBrush dcBrush;
LogicalFont dcFont;
RGB8Color dcBkColor;
RGB8Color dcTextColor;
int dcBkMode;
int dcExtraTextSpacing;
int dcJustificationAmount;
int dcJustificationSpaces;
int dcTextAlignment;
long dcStretchBltMode;
int dcX;
int dcY;
unsigned char * dcString;
int dcOrgX;
int dcOrgY;
int dcExtX;
int dcExtY;
int dcTwipsWide;
int dcTwipsHigh;
MetaFileObject * dcObjects;
int dcObjectCount;
XPoint * dcPoints;
AfmFontInfo * dcAfi;
} DeviceContext;
# define dcxExtX dcxDeviceContext.dcExtX
# define dcxExtY dcxDeviceContext.dcExtY
# define dcxOrgX dcxDeviceContext.dcOrgX
# define dcxOrgY dcxDeviceContext.dcOrgY
# define DC_X(x,dc) ( ( (x-(dc)->dcOrgX)* (dc)->dcTwipsWide )/ \
(dc)->dcExtX )
# define DC_Y(y,dc) ( ( (y-(dc)->dcOrgY)* (dc)->dcTwipsHigh )/ \
(dc)->dcExtY )
# define DCX_X(x,dcx) ( ( (x-(dcx)->dcxOrgX)* (dcx)->dcxPixelsWide )/ \
(dcx)->dcxExtX )
# define DCX_Y(y,dcx) ( ( (y-(dcx)->dcxOrgY)* (dcx)->dcxPixelsHigh )/ \
(dcx)->dcxExtY )
# define DCX_W(w,dcx) ( ( (w)* (dcx)->dcxPixelsWide )/ (dcx)->dcxExtX )
# define DCX_H(h,dcx) ( ( (h)* (dcx)->dcxPixelsHigh )/ (dcx)->dcxExtY )
# define DC_W(w,dc) ( ( (w)* (dc)->dcTwipsWide )/ (dc)->dcExtX )
# define DC_H(h,dc) ( ( (h)* (dc)->dcTwipsHigh )/ (dc)->dcExtY )
typedef struct DeviceContextX11
{
DeviceContext dcxDeviceContext;
int dcxScreen;
Window dcxDrawable;
GC dcxGc;
int dcxPixelsWide;
int dcxPixelsHigh;
XColor dcxPenColor;
XColor dcxBrushColor;
XColor dcxBkColor;
XColor dcxTextColor;
AppPhysicalFont * dcxPhysicalFont;
} DeviceContextX11;
/************************************************************************/
/* */
/* Routine declarations. */
/* */
/************************************************************************/
extern int appMetaPlayFileX11( SimpleInputStream * sis,
void ** pPrivate,
AppColors * ac,
DocumentFontList * dfl,
AppDrawingData * add,
Pixmap pixmap,
int xExt,
int yExt,
int pixelsWide,
int pixelsHigh,
int twipsWide,
int twipsHigh,
Window win );
extern int appMetaSaveBitmapMetafile( const BitmapDescription * bd,
const unsigned char * buffer,
SimpleOutputStream * sos );
extern int appMetaPlayFilePs( FILE * f,
SimpleInputStream * sis,
DocumentFontList * dfl,
const char * afmDirectory,
int xExt,
int yExt,
int twipsWide,
int twipsHigh );
extern void appMetaCleanDeviceContext( DeviceContext * dc );
extern int appMetaInitDeviceContext( DeviceContext * dc,
int objectCount,
int xExt,
int yExt,
int twipsWide,
int twipsHigh );
extern void appMetaCleanObject( MetaFileObject * mfo );
extern int appMeta_ExtTextOut( SimpleInputStream * sis,
int recordSize,
int * pX0,
int * pY0,
int * pCount,
int * pStyle,
int * pX1,
int * pY1,
int * pH1,
int * pW1,
DeviceContext * dc );
extern int appMeta_TextOut( SimpleInputStream * sis,
int recordSize,
int * pX0,
int * pY0,
int * pCount,
DeviceContext * dc );
extern int appMeta_GetCounts( SimpleInputStream * sis,
int recordSize,
int * pCount,
int ** pCounts,
DeviceContext * dc );
extern int appMetaCreateBrushIndirect( DeviceContext * dc,
int recordSize,
SimpleInputStream * sis );
extern int appMetaCreatePenIndirect( DeviceContext * dc,
int recordSize,
SimpleInputStream * sis );
extern int appMetaCreateFontIndirect( DeviceContext * dc,
DocumentFontList * dfl,
int recordSize,
SimpleInputStream * sis );
extern int appMetaCreatePatternBrush( DeviceContext * dc,
int recordSize,
SimpleInputStream * sis );
extern int appMetaCreatePalette( DeviceContext * dc,
int recordSize,
SimpleInputStream * sis );
extern int appMetaDeleteObject( DeviceContext * dc,
int ob );
extern int appMetaGetColor( SimpleInputStream * sis,
RGB8Color * rgb8 );
extern int appMetaListFontsPs( SimpleInputStream * sis,
DocumentFontList * dfl,
const char * afmDirectory,
PostScriptFont ** pFontList,
int * pCount,
int xExt,
int yExt,
int twipsWide,
int twipsHigh );
|