1 /* 2 * << Haru Free PDF Library >> -- hpdf_types.h 3 * 4 * URL: http://libharu.org 5 * 6 * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp> 7 * Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org> 8 * 9 * Permission to use, copy, modify, distribute and sell this software 10 * and its documentation for any purpose is hereby granted without fee, 11 * provided that the above copyright notice appear in all copies and 12 * that both that copyright notice and this permission notice appear 13 * in supporting documentation. 14 * It is provided "as is" without express or implied warranty. 15 * 16 */ 17 18 #ifndef _HPDF_TYPES_H 19 #define _HPDF_TYPES_H 20 21 #ifndef HPDF_STDCALL 22 #ifdef HPDF_DLL_MAKE 23 #define HPDF_STDCALL __stdcall 24 #else 25 #ifdef HPDF_DLL 26 #define HPDF_STDCALL __stdcall 27 #else 28 #define HPDF_STDCALL 29 #endif 30 #endif 31 #endif 32 33 #include <stdlib.h> 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 39 /*----------------------------------------------------------------------------*/ 40 /*----- type definition ------------------------------------------------------*/ 41 42 43 /* native OS integer types */ 44 typedef signed int HPDF_INT; 45 typedef unsigned int HPDF_UINT; 46 47 48 /* 32bit integer types 49 */ 50 typedef signed int HPDF_INT32; 51 typedef unsigned int HPDF_UINT32; 52 53 54 /* 16bit integer types 55 */ 56 typedef signed short HPDF_INT16; 57 typedef unsigned short HPDF_UINT16; 58 59 60 /* 8bit integer types 61 */ 62 typedef signed char HPDF_INT8; 63 typedef unsigned char HPDF_UINT8; 64 65 66 /* 8bit binary types 67 */ 68 typedef unsigned char HPDF_BYTE; 69 70 71 /* float type (32bit IEEE754) 72 */ 73 typedef float HPDF_REAL; 74 75 76 /* double type (64bit IEEE754) 77 */ 78 typedef double HPDF_DOUBLE; 79 80 81 /* boolean type (0: False, !0: True) 82 */ 83 typedef signed int HPDF_BOOL; 84 85 86 /* error-no type (32bit unsigned integer) 87 */ 88 typedef unsigned long HPDF_STATUS; 89 90 91 /* charactor-code type (16bit) 92 */ 93 typedef HPDF_UINT16 HPDF_CID; 94 typedef HPDF_UINT16 HPDF_UNICODE; 95 96 97 /* HPDF_Point struct 98 */ 99 typedef struct _HPDF_Point { 100 HPDF_REAL x; 101 HPDF_REAL y; 102 } HPDF_Point; 103 104 typedef struct _HPDF_Rect { 105 HPDF_REAL left; 106 HPDF_REAL bottom; 107 HPDF_REAL right; 108 HPDF_REAL top; 109 } HPDF_Rect; 110 111 /* HPDF_Point3D struct 112 */ 113 typedef struct _HPDF_Point3D { 114 HPDF_REAL x; 115 HPDF_REAL y; 116 HPDF_REAL z; 117 } HPDF_Point3D; 118 119 typedef struct _HPDF_Rect HPDF_Box; 120 121 /* HPDF_Date struct 122 */ 123 typedef struct _HPDF_Date { 124 HPDF_INT year; 125 HPDF_INT month; 126 HPDF_INT day; 127 HPDF_INT hour; 128 HPDF_INT minutes; 129 HPDF_INT seconds; 130 char ind; 131 HPDF_INT off_hour; 132 HPDF_INT off_minutes; 133 } HPDF_Date; 134 135 136 typedef enum _HPDF_InfoType { 137 /* date-time type parameters */ 138 HPDF_INFO_CREATION_DATE = 0, 139 HPDF_INFO_MOD_DATE, 140 141 /* string type parameters */ 142 HPDF_INFO_AUTHOR, 143 HPDF_INFO_CREATOR, 144 HPDF_INFO_PRODUCER, 145 HPDF_INFO_TITLE, 146 HPDF_INFO_SUBJECT, 147 HPDF_INFO_KEYWORDS, 148 HPDF_INFO_TRAPPED, 149 HPDF_INFO_GTS_PDFX, 150 HPDF_INFO_EOF 151 } HPDF_InfoType; 152 153 /* PDF-A Types */ 154 155 typedef enum _HPDF_PDFA_TYPE 156 { 157 HPDF_PDFA_1A = 0, 158 HPDF_PDFA_1B = 1 159 } HPDF_PDFAType; 160 161 162 typedef enum _HPDF_PdfVer { 163 HPDF_VER_12 = 0, 164 HPDF_VER_13, 165 HPDF_VER_14, 166 HPDF_VER_15, 167 HPDF_VER_16, 168 HPDF_VER_17, 169 HPDF_VER_EOF 170 } HPDF_PDFVer; 171 172 typedef enum _HPDF_EncryptMode { 173 HPDF_ENCRYPT_R2 = 2, 174 HPDF_ENCRYPT_R3 = 3 175 } HPDF_EncryptMode; 176 177 178 typedef void 179 (HPDF_STDCALL *HPDF_Error_Handler) (HPDF_STATUS error_no, 180 HPDF_STATUS detail_no, 181 void *user_data); 182 183 typedef void* 184 (HPDF_STDCALL *HPDF_Alloc_Func) (HPDF_UINT size); 185 186 187 typedef void 188 (HPDF_STDCALL *HPDF_Free_Func) (void *aptr); 189 190 191 /*---------------------------------------------------------------------------*/ 192 /*------ text width struct --------------------------------------------------*/ 193 194 typedef struct _HPDF_TextWidth { 195 HPDF_UINT numchars; 196 197 /* don't use this value (it may be change in the feature). 198 use numspace as alternated. */ 199 HPDF_UINT numwords; 200 201 HPDF_UINT width; 202 HPDF_UINT numspace; 203 } HPDF_TextWidth; 204 205 206 /*---------------------------------------------------------------------------*/ 207 /*------ dash mode ----------------------------------------------------------*/ 208 209 typedef struct _HPDF_DashMode { 210 HPDF_UINT16 ptn[8]; 211 HPDF_UINT num_ptn; 212 HPDF_UINT phase; 213 } HPDF_DashMode; 214 215 216 /*---------------------------------------------------------------------------*/ 217 /*----- HPDF_TransMatrix struct ---------------------------------------------*/ 218 219 typedef struct _HPDF_TransMatrix { 220 HPDF_REAL a; 221 HPDF_REAL b; 222 HPDF_REAL c; 223 HPDF_REAL d; 224 HPDF_REAL x; 225 HPDF_REAL y; 226 } HPDF_TransMatrix; 227 228 229 /*---------------------------------------------------------------------------*/ 230 231 typedef enum _HPDF_ColorSpace { 232 HPDF_CS_DEVICE_GRAY = 0, 233 HPDF_CS_DEVICE_RGB, 234 HPDF_CS_DEVICE_CMYK, 235 HPDF_CS_CAL_GRAY, 236 HPDF_CS_CAL_RGB, 237 HPDF_CS_LAB, 238 HPDF_CS_ICC_BASED, 239 HPDF_CS_SEPARATION, 240 HPDF_CS_DEVICE_N, 241 HPDF_CS_INDEXED, 242 HPDF_CS_PATTERN, 243 HPDF_CS_EOF 244 } HPDF_ColorSpace; 245 246 /*---------------------------------------------------------------------------*/ 247 /*----- HPDF_RGBColor struct ------------------------------------------------*/ 248 249 typedef struct _HPDF_RGBColor { 250 HPDF_REAL r; 251 HPDF_REAL g; 252 HPDF_REAL b; 253 } HPDF_RGBColor; 254 255 /*---------------------------------------------------------------------------*/ 256 /*----- HPDF_CMYKColor struct -----------------------------------------------*/ 257 258 typedef struct _HPDF_CMYKColor { 259 HPDF_REAL c; 260 HPDF_REAL m; 261 HPDF_REAL y; 262 HPDF_REAL k; 263 } HPDF_CMYKColor; 264 265 /*---------------------------------------------------------------------------*/ 266 /*------ The line cap style -------------------------------------------------*/ 267 268 typedef enum _HPDF_LineCap { 269 HPDF_BUTT_END = 0, 270 HPDF_ROUND_END, 271 HPDF_PROJECTING_SCUARE_END, 272 HPDF_LINECAP_EOF 273 } HPDF_LineCap; 274 275 /*----------------------------------------------------------------------------*/ 276 /*------ The line join style -------------------------------------------------*/ 277 278 typedef enum _HPDF_LineJoin { 279 HPDF_MITER_JOIN = 0, 280 HPDF_ROUND_JOIN, 281 HPDF_BEVEL_JOIN, 282 HPDF_LINEJOIN_EOF 283 } HPDF_LineJoin; 284 285 /*----------------------------------------------------------------------------*/ 286 /*------ The text rendering mode ---------------------------------------------*/ 287 288 typedef enum _HPDF_TextRenderingMode { 289 HPDF_FILL = 0, 290 HPDF_STROKE, 291 HPDF_FILL_THEN_STROKE, 292 HPDF_INVISIBLE, 293 HPDF_FILL_CLIPPING, 294 HPDF_STROKE_CLIPPING, 295 HPDF_FILL_STROKE_CLIPPING, 296 HPDF_CLIPPING, 297 HPDF_RENDERING_MODE_EOF 298 } HPDF_TextRenderingMode; 299 300 301 typedef enum _HPDF_WritingMode { 302 HPDF_WMODE_HORIZONTAL = 0, 303 HPDF_WMODE_VERTICAL, 304 HPDF_WMODE_EOF 305 } HPDF_WritingMode; 306 307 308 typedef enum _HPDF_PageLayout { 309 HPDF_PAGE_LAYOUT_SINGLE = 0, 310 HPDF_PAGE_LAYOUT_ONE_COLUMN, 311 HPDF_PAGE_LAYOUT_TWO_COLUMN_LEFT, 312 HPDF_PAGE_LAYOUT_TWO_COLUMN_RIGHT, 313 HPDF_PAGE_LAYOUT_TWO_PAGE_LEFT, 314 HPDF_PAGE_LAYOUT_TWO_PAGE_RIGHT, 315 HPDF_PAGE_LAYOUT_EOF 316 } HPDF_PageLayout; 317 318 319 typedef enum _HPDF_PageMode { 320 HPDF_PAGE_MODE_USE_NONE = 0, 321 HPDF_PAGE_MODE_USE_OUTLINE, 322 HPDF_PAGE_MODE_USE_THUMBS, 323 HPDF_PAGE_MODE_FULL_SCREEN, 324 /* HPDF_PAGE_MODE_USE_OC, 325 HPDF_PAGE_MODE_USE_ATTACHMENTS, 326 */ 327 HPDF_PAGE_MODE_EOF 328 } HPDF_PageMode; 329 330 331 typedef enum _HPDF_PageNumStyle { 332 HPDF_PAGE_NUM_STYLE_DECIMAL = 0, 333 HPDF_PAGE_NUM_STYLE_UPPER_ROMAN, 334 HPDF_PAGE_NUM_STYLE_LOWER_ROMAN, 335 HPDF_PAGE_NUM_STYLE_UPPER_LETTERS, 336 HPDF_PAGE_NUM_STYLE_LOWER_LETTERS, 337 HPDF_PAGE_NUM_STYLE_EOF 338 } HPDF_PageNumStyle; 339 340 341 typedef enum _HPDF_DestinationType { 342 HPDF_XYZ = 0, 343 HPDF_FIT, 344 HPDF_FIT_H, 345 HPDF_FIT_V, 346 HPDF_FIT_R, 347 HPDF_FIT_B, 348 HPDF_FIT_BH, 349 HPDF_FIT_BV, 350 HPDF_DST_EOF 351 } HPDF_DestinationType; 352 353 354 typedef enum _HPDF_AnnotType { 355 HPDF_ANNOT_TEXT_NOTES, 356 HPDF_ANNOT_LINK, 357 HPDF_ANNOT_SOUND, 358 HPDF_ANNOT_FREE_TEXT, 359 HPDF_ANNOT_STAMP, 360 HPDF_ANNOT_SQUARE, 361 HPDF_ANNOT_CIRCLE, 362 HPDF_ANNOT_STRIKE_OUT, 363 HPDF_ANNOT_HIGHTLIGHT, 364 HPDF_ANNOT_UNDERLINE, 365 HPDF_ANNOT_INK, 366 HPDF_ANNOT_FILE_ATTACHMENT, 367 HPDF_ANNOT_POPUP, 368 HPDF_ANNOT_3D, 369 HPDF_ANNOT_SQUIGGLY, 370 HPDF_ANNOT_LINE, 371 HPDF_ANNOT_PROJECTION 372 } HPDF_AnnotType; 373 374 375 typedef enum _HPDF_AnnotFlgs { 376 HPDF_ANNOT_INVISIBLE, 377 HPDF_ANNOT_HIDDEN, 378 HPDF_ANNOT_PRINT, 379 HPDF_ANNOT_NOZOOM, 380 HPDF_ANNOT_NOROTATE, 381 HPDF_ANNOT_NOVIEW, 382 HPDF_ANNOT_READONLY 383 } HPDF_AnnotFlgs; 384 385 386 typedef enum _HPDF_AnnotHighlightMode { 387 HPDF_ANNOT_NO_HIGHTLIGHT = 0, 388 HPDF_ANNOT_INVERT_BOX, 389 HPDF_ANNOT_INVERT_BORDER, 390 HPDF_ANNOT_DOWN_APPEARANCE, 391 HPDF_ANNOT_HIGHTLIGHT_MODE_EOF 392 } HPDF_AnnotHighlightMode; 393 394 395 typedef enum _HPDF_AnnotIcon { 396 HPDF_ANNOT_ICON_COMMENT = 0, 397 HPDF_ANNOT_ICON_KEY, 398 HPDF_ANNOT_ICON_NOTE, 399 HPDF_ANNOT_ICON_HELP, 400 HPDF_ANNOT_ICON_NEW_PARAGRAPH, 401 HPDF_ANNOT_ICON_PARAGRAPH, 402 HPDF_ANNOT_ICON_INSERT, 403 HPDF_ANNOT_ICON_EOF 404 } HPDF_AnnotIcon; 405 406 typedef enum _HPDF_AnnotIntent { 407 HPDF_ANNOT_INTENT_FREETEXTCALLOUT = 0, 408 HPDF_ANNOT_INTENT_FREETEXTTYPEWRITER, 409 HPDF_ANNOT_INTENT_LINEARROW, 410 HPDF_ANNOT_INTENT_LINEDIMENSION, 411 HPDF_ANNOT_INTENT_POLYGONCLOUD, 412 HPDF_ANNOT_INTENT_POLYLINEDIMENSION, 413 HPDF_ANNOT_INTENT_POLYGONDIMENSION 414 } HPDF_AnnotIntent; 415 416 typedef enum _HPDF_LineAnnotEndingStyle { 417 HPDF_LINE_ANNOT_NONE = 0, 418 HPDF_LINE_ANNOT_SQUARE, 419 HPDF_LINE_ANNOT_CIRCLE, 420 HPDF_LINE_ANNOT_DIAMOND, 421 HPDF_LINE_ANNOT_OPENARROW, 422 HPDF_LINE_ANNOT_CLOSEDARROW, 423 HPDF_LINE_ANNOT_BUTT, 424 HPDF_LINE_ANNOT_ROPENARROW, 425 HPDF_LINE_ANNOT_RCLOSEDARROW, 426 HPDF_LINE_ANNOT_SLASH 427 } HPDF_LineAnnotEndingStyle; 428 429 typedef enum _HPDF_LineAnnotCapPosition{ 430 HPDF_LINE_ANNOT_CAP_INLINE = 0, 431 HPDF_LINE_ANNOT_CAP_TOP 432 } HPDF_LineAnnotCapPosition; 433 434 typedef enum _HPDF_StampAnnotName{ 435 HPDF_STAMP_ANNOT_APPROVED = 0, 436 HPDF_STAMP_ANNOT_EXPERIMENTAL, 437 HPDF_STAMP_ANNOT_NOTAPPROVED, 438 HPDF_STAMP_ANNOT_ASIS, 439 HPDF_STAMP_ANNOT_EXPIRED, 440 HPDF_STAMP_ANNOT_NOTFORPUBLICRELEASE, 441 HPDF_STAMP_ANNOT_CONFIDENTIAL, 442 HPDF_STAMP_ANNOT_FINAL, 443 HPDF_STAMP_ANNOT_SOLD, 444 HPDF_STAMP_ANNOT_DEPARTMENTAL, 445 HPDF_STAMP_ANNOT_FORCOMMENT, 446 HPDF_STAMP_ANNOT_TOPSECRET, 447 HPDF_STAMP_ANNOT_DRAFT, 448 HPDF_STAMP_ANNOT_FORPUBLICRELEASE 449 } HPDF_StampAnnotName; 450 451 /*----------------------------------------------------------------------------*/ 452 /*------ border stype --------------------------------------------------------*/ 453 454 typedef enum _HPDF_BSSubtype { 455 HPDF_BS_SOLID, 456 HPDF_BS_DASHED, 457 HPDF_BS_BEVELED, 458 HPDF_BS_INSET, 459 HPDF_BS_UNDERLINED 460 } HPDF_BSSubtype; 461 462 463 /*----- blend modes ----------------------------------------------------------*/ 464 465 typedef enum _HPDF_BlendMode { 466 HPDF_BM_NORMAL, 467 HPDF_BM_MULTIPLY, 468 HPDF_BM_SCREEN, 469 HPDF_BM_OVERLAY, 470 HPDF_BM_DARKEN, 471 HPDF_BM_LIGHTEN, 472 HPDF_BM_COLOR_DODGE, 473 HPDF_BM_COLOR_BUM, 474 HPDF_BM_HARD_LIGHT, 475 HPDF_BM_SOFT_LIGHT, 476 HPDF_BM_DIFFERENCE, 477 HPDF_BM_EXCLUSHON, 478 HPDF_BM_EOF 479 } HPDF_BlendMode; 480 481 /*----- slide show -----------------------------------------------------------*/ 482 483 typedef enum _HPDF_TransitionStyle { 484 HPDF_TS_WIPE_RIGHT = 0, 485 HPDF_TS_WIPE_UP, 486 HPDF_TS_WIPE_LEFT, 487 HPDF_TS_WIPE_DOWN, 488 HPDF_TS_BARN_DOORS_HORIZONTAL_OUT, 489 HPDF_TS_BARN_DOORS_HORIZONTAL_IN, 490 HPDF_TS_BARN_DOORS_VERTICAL_OUT, 491 HPDF_TS_BARN_DOORS_VERTICAL_IN, 492 HPDF_TS_BOX_OUT, 493 HPDF_TS_BOX_IN, 494 HPDF_TS_BLINDS_HORIZONTAL, 495 HPDF_TS_BLINDS_VERTICAL, 496 HPDF_TS_DISSOLVE, 497 HPDF_TS_GLITTER_RIGHT, 498 HPDF_TS_GLITTER_DOWN, 499 HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT, 500 HPDF_TS_REPLACE, 501 HPDF_TS_EOF 502 } HPDF_TransitionStyle; 503 504 /*----------------------------------------------------------------------------*/ 505 506 typedef enum _HPDF_PageSizes { 507 HPDF_PAGE_SIZE_LETTER = 0, 508 HPDF_PAGE_SIZE_LEGAL, 509 HPDF_PAGE_SIZE_A3, 510 HPDF_PAGE_SIZE_A4, 511 HPDF_PAGE_SIZE_A5, 512 HPDF_PAGE_SIZE_B4, 513 HPDF_PAGE_SIZE_B5, 514 HPDF_PAGE_SIZE_EXECUTIVE, 515 HPDF_PAGE_SIZE_US4x6, 516 HPDF_PAGE_SIZE_US4x8, 517 HPDF_PAGE_SIZE_US5x7, 518 HPDF_PAGE_SIZE_COMM10, 519 HPDF_PAGE_SIZE_EOF 520 } HPDF_PageSizes; 521 522 523 typedef enum _HPDF_PageDirection { 524 HPDF_PAGE_PORTRAIT = 0, 525 HPDF_PAGE_LANDSCAPE 526 } HPDF_PageDirection; 527 528 529 typedef enum _HPDF_EncoderType { 530 HPDF_ENCODER_TYPE_SINGLE_BYTE, 531 HPDF_ENCODER_TYPE_DOUBLE_BYTE, 532 HPDF_ENCODER_TYPE_UNINITIALIZED, 533 HPDF_ENCODER_UNKNOWN 534 } HPDF_EncoderType; 535 536 537 typedef enum _HPDF_ByteType { 538 HPDF_BYTE_TYPE_SINGLE = 0, 539 HPDF_BYTE_TYPE_LEAD, 540 HPDF_BYTE_TYPE_TRIAL, 541 HPDF_BYTE_TYPE_UNKNOWN 542 } HPDF_ByteType; 543 544 545 typedef enum _HPDF_TextAlignment { 546 HPDF_TALIGN_LEFT = 0, 547 HPDF_TALIGN_RIGHT, 548 HPDF_TALIGN_CENTER, 549 HPDF_TALIGN_JUSTIFY 550 } HPDF_TextAlignment; 551 552 /*----------------------------------------------------------------------------*/ 553 554 /* Name Dictionary values -- see PDF reference section 7.7.4 */ 555 typedef enum _HPDF_NameDictKey { 556 HPDF_NAME_EMBEDDED_FILES = 0, /* TODO the rest */ 557 HPDF_NAME_EOF 558 } HPDF_NameDictKey; 559 560 #ifdef __cplusplus 561 } 562 #endif /* __cplusplus */ 563 564 #endif /* _HPDF_TYPES_H */ 565 566