hpdf_types.h 13 KB

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