1 /// 2 module harud.types; 3 4 alias HPDF_HANDLE = void*; 5 alias HPDF_Doc = HPDF_HANDLE; 6 alias HPDF_Page = HPDF_HANDLE; 7 alias HPDF_Pages = HPDF_HANDLE; 8 alias HPDF_Stream = HPDF_HANDLE; 9 alias HPDF_Image = HPDF_HANDLE; 10 alias HPDF_Font = HPDF_HANDLE; 11 alias HPDF_Outline = HPDF_HANDLE; 12 alias HPDF_Encoder = HPDF_HANDLE; 13 alias HPDF_Destination = HPDF_HANDLE; 14 alias HPDF_XObject = HPDF_HANDLE; 15 alias HPDF_Annotation = HPDF_HANDLE; 16 alias HPDF_ExtGState = HPDF_HANDLE; 17 18 /* boolean type (0: False, !0: True) */ 19 alias HPDF_BOOL = int; 20 21 /** errorNo type (32bit unsigned integer) */ 22 alias HPDF_STATUS = uint; 23 24 /** charactor-code type (16bit) */ 25 alias HPDF_CID = ushort; 26 alias HPDF_UNICODE = ushort; 27 28 /** Point struct */ 29 struct Point { 30 /// x coordinate 31 float x; 32 /// y coordinate 33 float y; 34 } 35 36 /** 37 * Rectangle 38 * 39 * -------------------- 40 * ^ 41 * top | +--------+ 42 * | | | 43 * bottom | +--------+ 44 * +--------------> 45 * left right 46 * 47 * -------------------- 48 */ 49 struct Rect { 50 /** 51 * The x-coordinates of bottom left corner 52 */ 53 float left; 54 /** 55 * The y-coordinates of bottom left corner 56 */ 57 float bottom; 58 /** 59 * The x-coordinates of top right corner 60 */ 61 float right; 62 63 /** 64 * The y-coordinates of top right corner 65 */ 66 float top; 67 } 68 69 alias HaruBox = Rect; 70 71 /** 72 * Datetime attribute in the info dictionary. 73 */ 74 struct HaruDate { 75 int year; 76 int month; 77 int day; 78 int hour; 79 int minutes; 80 int seconds; 81 byte ind; 82 int offHour; 83 int offMinutes; 84 } 85 86 /** 87 * Info dictionary types 88 */ 89 enum HaruInfoType { 90 /** date-time type parameters */ 91 creationDate = 0, 92 modDate, 93 94 /* string type parameters */ 95 author, 96 creator, 97 producer, 98 title, 99 subject, 100 keywords 101 } 102 103 enum PdfVer { 104 V12 = 0, 105 V13, 106 V14, 107 V15, 108 V16, 109 V17 110 } 111 112 /** 113 * Encrypt mode 114 */ 115 enum HaruEncryptMode { 116 /// Use "Revision 2" algorithm. "keyLen" automatically set to 5 (40 bits). 117 R2 = 2, 118 /// Use "Revision 3" algorithm. "keyLen" can be 5 (40 bits) to 16 (128bits). 119 R3 = 3 120 } 121 122 /** 123 * Describes a text width 124 */ 125 struct TextWidth { 126 uint numchars; 127 128 /** don't use this value (it may be change in the feature). 129 use numspace as alternated. */ 130 uint numwords; 131 132 uint width; 133 uint numspace; 134 } 135 136 struct DashMode { 137 ushort[8] ptn; 138 uint numPtn; 139 uint phase; 140 } 141 142 143 /** 144 * For certain types of drawing operations you may want to adjust (or transform, which is the proper term) the coordinates in some way 145 * The part of the graphic state that tracks this is called the current transformation matrix (CTM). 146 * 147 * To apply a transformation, you use the cm operator, which takes six operands 148 * that represent a standard 3x2 matrix. 149 * 150 * -------------- 151 * | Transformation | Operand | 152 * | --- | --- | 153 * | Translation | 1 0 0 1 tx ty | 154 * | Rotation | cosQ sinQ -sinQ cosQ 0 0 | 155 * | Skew | 1 tanA tabB 1 0 0 | 156 * -------------- 157 */ 158 159 struct TransMatrix { 160 float a; 161 float b; 162 float c; 163 float d; 164 float x; 165 float y; 166 } 167 168 /** 169 * The color space of the image. 170 */ 171 enum ColorSpace { 172 /** 173 * 8 bit gray scale image.$(BR) 174 * The gray scale describes each pixel with one byte. $(BR) 175 * For each byte, 0X00 is maximum dark, 0XFF maximum light. The size of the 176 * image data is (width * height) bytes.$(BR) 177 * The sequence of bytes for an 8-pixel 8-bit image with 2 rows and 4 columns would be: 178 * ----- 179 * 1 2 3 4 180 * 5 6 7 8 181 * ---- 182 */ 183 deviceGray = 0, 184 185 /** 186 * The RGB color model is an additive color model in which red, green, and 187 * blue light are added together in various ways to reproduce a broad array 188 * of colors. $(BR) 189 * The 24 bit RGB color image describes each pixel with three bytes (Red, 190 * Green, Blue). $(BR) 191 * For each byte, 0X00 is maximum dark, 0XFF maximum light. The size of the image data is (width * height * 3) bytes. 192 * The sequence of bytes for an 8-pixel 24-bit image with 2 rows and 4 columns would be: 193 * --- 194 * 1R 1G 1B 2R 2G 2B 3R 3G 3B 4R 4G 4B 195 * 5R 5G 5B 6R 6G 6B 7R 7G 7B 8R 8G 8B 196 * --- 197 */ 198 deviceRGB, 199 /** 200 * The CMYK color model (process color, four color) is a subtractive color 201 * model, used in color printing, and is also used to describe the printing 202 * process itself. $(BR) 203 * The 32 bit CMYK color image describes each pixel with four bytes (Cyan, 204 * Magenta, Yellow, Black). $(BR) 205 * The size of the image data is (width * height * 4) bytes. For each byte, 206 * 0X00 is maximum dark, 0XFF maximum light.$(BR) 207 * The sequence of bytes for an 8-pixel 32-bit image with 2 rows and 4 columns would be: 208 * --- 209 * 1C 1M 1Y 1K 2C 2M 2Y 2K 3C 3M 3Y 3K 4C 4M 4Y 4K 210 * 5C 5M 5Y 5K 6C 6M 6Y 6K 7C 7M 7Y 7K 8C 8M 8Y 8K 211 * --- 212 */ 213 deviceCMYK, 214 calGray, 215 calRGB, 216 lab, 217 iccBased, 218 separation, 219 deviceN, 220 indexed, 221 pattern 222 } 223 224 struct HaruRGBColor { 225 float red; 226 float green; 227 float blue; 228 } 229 230 struct HaruCMYKColor { 231 float cyan; 232 float magenta; 233 float yellow; 234 float key; 235 } 236 237 /// The line cap style 238 enum HaruLineCap { 239 buttEnd = 0, 240 roundEnd, 241 projectingScuareEnd, 242 lineCapEof 243 } 244 245 /// The line join style 246 enum HaruLineJoin { 247 miterJoin = 0, 248 roundJoin, 249 bevelJoin, 250 } 251 252 /// The text rendering mode 253 enum HaruTextRenderingMode { 254 fill = 0, 255 stroke, 256 fillThenStroke, 257 invisible, 258 fillClipping, 259 strokeClipping, 260 fillStrokeClipping, 261 clipping 262 } 263 264 /// Writing mode 265 enum HaruWritingMode { 266 horizontal = 0, 267 vertical, 268 } 269 270 /** 271 * The page layout enum 272 */ 273 enum PageLayout { 274 /// Only one page is displayed. 275 single = 0, 276 /// Display the pages in one column. 277 oneColumn, 278 /// Display in two columns. Odd page number is displayed left 279 twoColumnLeft, 280 /// Display in two columns. Odd page number is displayed right 281 twoColumnRight, 282 } 283 284 /** 285 * Compression mode 286 */ 287 enum CompressionMode : uint { 288 /// No compression. 289 none = 0x0, 290 /// Compress the contents stream of the page. 291 text = 0x01, 292 /// Compress the streams of the image objects. 293 image = 0x02, 294 /// Other stream datas (fonts, cmaps and so on) are compressed. 295 metadata = 0x04, 296 /// All stream datas are compressed 297 all = 0x0F 298 } 299 300 /** 301 * PageMode enum 302 */ 303 enum PageMode : uint { 304 /// Display the document with neither outline nor thumbnail. 305 useNone = 0, 306 /// Display the document with outline pane. 307 useOutline, 308 /// Display the document with thumbnail pane. 309 useThumbs, 310 /// Display the document with full screen mode. 311 fullScreen 312 } 313 314 enum PageNumStyle { 315 decimal = 0, 316 upperRoman, 317 lowerRoman, 318 upperLetters, 319 lowerLetters, 320 eof 321 } 322 323 enum DestinationType { 324 xyz = 0, 325 fit, 326 fitH, 327 fitV, 328 fitR, 329 fitB, 330 fitBh, 331 fitBv, 332 eof 333 } 334 335 enum HaruAnnotType { 336 textNotes, 337 link, 338 sound, 339 freeText, 340 stamp, 341 square, 342 circle, 343 strikeOut, 344 hightlight, 345 underline, 346 ink, 347 fileAttachment, 348 popup, 349 _3D 350 } 351 352 enum HaruAnnotFlgs { 353 invisible, 354 hidden, 355 print, 356 nozoom, 357 norotate, 358 noview, 359 readonly 360 } 361 362 enum HaruAnnotHighlightMode { 363 noHightlight = 0, 364 invertBox, 365 invertBorder, 366 downAppearance, 367 hightlightModeEof 368 } 369 370 enum HaruAnnotIcon { 371 comment = 0, 372 key, 373 note, 374 help, 375 newParagraph, 376 paragraph, 377 insert 378 } 379 380 // border stype 381 enum HaruBSSubtype { 382 solid, 383 dashed, 384 beveled, 385 inset, 386 underlined 387 } 388 389 // blend modes 390 enum HaruBlendMode { 391 normal, 392 multiply, 393 screen, 394 overlay, 395 darken, 396 lighten, 397 colorDodge, 398 colorBum, 399 hardLight, 400 softLight, 401 difference, 402 exclushon 403 } 404 405 /// slide show 406 enum HaruTransitionStyle { 407 wipeRight = 0, 408 wipeUp, 409 wipeLeft, 410 wipeDown, 411 barnDoorsHorizontalOut, 412 barnDoorsHorizontalIn, 413 barnDoorsVerticalOut, 414 barnDoorsVerticalIn, 415 boxOut, 416 boxIn, 417 blindsHorizontal, 418 blindsVertical, 419 dissolve, 420 glitterRight, 421 glitterDown, 422 glittertoplefttobottomright, 423 replace 424 } 425 426 enum PageSizes { 427 letter = 0, 428 legal, 429 A3, 430 A4, 431 A5, 432 B4, 433 B5, 434 executive, 435 us4x6, 436 us4x8, 437 us5x7, 438 comm10 439 } 440 441 enum PageDirection { 442 portrait = 0, 443 landscape 444 } 445 446 enum HaruEncoderType { 447 singleByte, 448 doubleByte, 449 uninitialized, 450 unknown 451 } 452 453 /** 454 * Byte type enum 455 */ 456 enum HaruByteType { 457 single = 0, 458 lead, 459 trial, 460 unknown 461 } 462 463 /** 464 * Text alignment 465 */ 466 enum HaruTextAlignment { 467 left = 0, /** The text is aligned to left. */ 468 right, /** The text is aligned to right. */ 469 center, /** The text is aligned to center. */ 470 justify /** Add spaces between the words to justify both left and right side. */ 471 } 472 473 /** 474 * Permission flags (only Revision 2 is supported) 475 */ 476 enum HaruPermission : uint { 477 /// user can read the document 478 read = 0, 479 /// user can print the document 480 print = 4, 481 /// user can add or modify the annotations and form fields of the document 482 editAll = 8, 483 /// user can copy the text and the graphics of the document 484 copy = 16, 485 /// user can edit the contents of the document other than annotations, form fields 486 edit = 32 487 } 488 489 /** 490 * Graphics mode 491 * 492 * Each page object maintains a flag named "graphics mode". 493 * The graphics mode corresponds to the graphics-object of the PDF specification. 494 * The graphics mode is changed by invoking particular functions. 495 * The functions that can be invoked are decided by the value of the graphics mode. 496 * 497 */ 498 enum GMode : ushort { 499 unknown = 0, 500 /** 501 * Allowed operators: 502 * $(UL 503 * $(LI General graphic state) 504 * $(LI Special graphic state) 505 * $(LI Color) 506 * $(LI Text state) 507 * ) 508 */ 509 pageDescription = 0x0001, 510 /** 511 * Allowed operators: 512 * $(UL 513 * $(LI Path construction) 514 * ) 515 */ 516 pathObject = 0x0002, 517 /** 518 * Allowed operators: 519 * $(UL 520 * $(LI Graphic state) 521 * $(LI Color) 522 * $(LI Text state) 523 * $(LI Text-shadowing) 524 * $(LI Text-positioning) 525 * ) 526 */ 527 textObject = 0x0004, 528 529 clippingPath = 0x0008, 530 shading = 0x0010, 531 inlineImage = 0x0020, 532 externalObject = 0x0040 533 }