hpdf 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. data/History +57 -0
  2. data/License +25 -0
  3. data/README +165 -0
  4. data/examples/arc_demo.rb +82 -0
  5. data/examples/demo.rb +92 -0
  6. data/examples/encryption.rb +41 -0
  7. data/examples/ext_gstater_demo.rb +171 -0
  8. data/examples/font_demo.rb +67 -0
  9. data/examples/jpfont_demo.rb +122 -0
  10. data/examples/line_demo.rb +301 -0
  11. data/examples/slide_show_demo.rb +139 -0
  12. data/examples/text_demo2.rb +189 -0
  13. data/examples/ttfont_demo.rb +106 -0
  14. data/ext/extconf.rb +6 -0
  15. data/ext/hpdf.c +3779 -0
  16. data/ext/hpdf_annotation.c +415 -0
  17. data/ext/hpdf_array.c +344 -0
  18. data/ext/hpdf_binary.c +117 -0
  19. data/ext/hpdf_boolean.c +47 -0
  20. data/ext/hpdf_catalog.c +354 -0
  21. data/ext/hpdf_destination.c +339 -0
  22. data/ext/hpdf_dict.c +488 -0
  23. data/ext/hpdf_doc.c +2020 -0
  24. data/ext/hpdf_doc_png.c +137 -0
  25. data/ext/hpdf_encoder.c +2991 -0
  26. data/ext/hpdf_encoder_cns.c +36359 -0
  27. data/ext/hpdf_encoder_cnt.c +15307 -0
  28. data/ext/hpdf_encoder_jp.c +16125 -0
  29. data/ext/hpdf_encoder_kr.c +27978 -0
  30. data/ext/hpdf_encrypt.c +632 -0
  31. data/ext/hpdf_encryptdict.c +240 -0
  32. data/ext/hpdf_error.c +114 -0
  33. data/ext/hpdf_ext_gstate.c +150 -0
  34. data/ext/hpdf_font.c +229 -0
  35. data/ext/hpdf_font_cid.c +1030 -0
  36. data/ext/hpdf_font_tt.c +406 -0
  37. data/ext/hpdf_font_type1.c +391 -0
  38. data/ext/hpdf_fontdef.c +56 -0
  39. data/ext/hpdf_fontdef_base14.c +4506 -0
  40. data/ext/hpdf_fontdef_cid.c +194 -0
  41. data/ext/hpdf_fontdef_cns.c +471 -0
  42. data/ext/hpdf_fontdef_cnt.c +250 -0
  43. data/ext/hpdf_fontdef_jp.c +1904 -0
  44. data/ext/hpdf_fontdef_kr.c +1572 -0
  45. data/ext/hpdf_fontdef_tt.c +2230 -0
  46. data/ext/hpdf_fontdef_type1.c +524 -0
  47. data/ext/hpdf_gstate.c +119 -0
  48. data/ext/hpdf_image.c +568 -0
  49. data/ext/hpdf_image_png.c +424 -0
  50. data/ext/hpdf_info.c +164 -0
  51. data/ext/hpdf_list.c +333 -0
  52. data/ext/hpdf_mmgr.c +243 -0
  53. data/ext/hpdf_name.c +71 -0
  54. data/ext/hpdf_null.c +31 -0
  55. data/ext/hpdf_number.c +49 -0
  56. data/ext/hpdf_objects.c +172 -0
  57. data/ext/hpdf_outline.c +329 -0
  58. data/ext/hpdf_page_label.c +74 -0
  59. data/ext/hpdf_page_operator.c +2764 -0
  60. data/ext/hpdf_pages.c +1508 -0
  61. data/ext/hpdf_real.c +61 -0
  62. data/ext/hpdf_streams.c +1435 -0
  63. data/ext/hpdf_string.c +189 -0
  64. data/ext/hpdf_utils.c +438 -0
  65. data/ext/hpdf_xref.c +348 -0
  66. data/ext/include/hpdf.h +1227 -0
  67. data/ext/include/hpdf_annotation.h +74 -0
  68. data/ext/include/hpdf_catalog.h +81 -0
  69. data/ext/include/hpdf_conf.h +76 -0
  70. data/ext/include/hpdf_consts.h +549 -0
  71. data/ext/include/hpdf_destination.h +41 -0
  72. data/ext/include/hpdf_doc.h +159 -0
  73. data/ext/include/hpdf_encoder.h +311 -0
  74. data/ext/include/hpdf_encrypt.h +156 -0
  75. data/ext/include/hpdf_encryptdict.h +66 -0
  76. data/ext/include/hpdf_error.h +201 -0
  77. data/ext/include/hpdf_ext_gstate.h +38 -0
  78. data/ext/include/hpdf_font.h +112 -0
  79. data/ext/include/hpdf_fontdef.h +403 -0
  80. data/ext/include/hpdf_gstate.h +80 -0
  81. data/ext/include/hpdf_image.h +72 -0
  82. data/ext/include/hpdf_info.h +48 -0
  83. data/ext/include/hpdf_list.h +85 -0
  84. data/ext/include/hpdf_mmgr.h +82 -0
  85. data/ext/include/hpdf_objects.h +587 -0
  86. data/ext/include/hpdf_outline.h +74 -0
  87. data/ext/include/hpdf_page_label.h +35 -0
  88. data/ext/include/hpdf_pages.h +128 -0
  89. data/ext/include/hpdf_streams.h +276 -0
  90. data/ext/include/hpdf_types.h +488 -0
  91. data/ext/include/hpdf_utils.h +161 -0
  92. data/tests/arc_demo.rb +82 -0
  93. data/tests/demo.rb +91 -0
  94. data/tests/encryption.rb +41 -0
  95. data/tests/ext_gstater_demo.rb +171 -0
  96. data/tests/font_demo.rb +67 -0
  97. data/tests/line_demo.rb +301 -0
  98. data/tests/slide_show_demo.rb +139 -0
  99. data/tests/test_all_examples.rb +31 -0
  100. data/tests/text_demo2.rb +189 -0
  101. metadata +147 -0
@@ -0,0 +1,189 @@
1
+ /*
2
+ * << Haru Free PDF Library 2.0.0 >> -- hpdf_string.h
3
+ *
4
+ * Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
5
+ *
6
+ * Permission to use, copy, modify, distribute and sell this software
7
+ * and its documentation for any purpose is hereby granted without fee,
8
+ * provided that the above copyright notice appear in all copies and
9
+ * that both that copyright notice and this permission notice appear
10
+ * in supporting documentation.
11
+ * It is provided "as is" without express or implied warranty.
12
+ *
13
+ */
14
+
15
+ #include "hpdf_conf.h"
16
+ #include "hpdf_utils.h"
17
+ #include "hpdf_objects.h"
18
+
19
+ static const HPDF_BYTE UNICODE_HEADER[] = {
20
+ 0xFE, 0xFF
21
+ };
22
+
23
+
24
+ HPDF_String
25
+ HPDF_String_New (HPDF_MMgr mmgr,
26
+ const char *value,
27
+ HPDF_Encoder encoder)
28
+ {
29
+ HPDF_String obj;
30
+
31
+ HPDF_PTRACE((" HPDF_String_New\n"));
32
+
33
+ obj = (HPDF_String)HPDF_GetMem (mmgr, sizeof(HPDF_String_Rec));
34
+ if (obj) {
35
+ HPDF_MemSet (&obj->header, 0, sizeof(HPDF_Obj_Header));
36
+ obj->header.obj_class = HPDF_OCLASS_STRING;
37
+
38
+ obj->mmgr = mmgr;
39
+ obj->error = mmgr->error;
40
+ obj->encoder = encoder;
41
+ obj->value = NULL;
42
+ obj->len = 0;
43
+
44
+ if (HPDF_String_SetValue (obj, value) != HPDF_OK) {
45
+ HPDF_FreeMem (obj->mmgr, obj);
46
+ return NULL;
47
+ }
48
+ }
49
+
50
+ return obj;
51
+ }
52
+
53
+
54
+ HPDF_STATUS
55
+ HPDF_String_SetValue (HPDF_String obj,
56
+ const char *value)
57
+ {
58
+ HPDF_UINT len;
59
+ HPDF_STATUS ret = HPDF_OK;
60
+
61
+ HPDF_PTRACE((" HPDF_String_SetValue\n"));
62
+
63
+ if (obj->value) {
64
+ HPDF_FreeMem (obj->mmgr, obj->value);
65
+ obj->len = 0;
66
+ }
67
+
68
+ len = HPDF_StrLen(value, HPDF_LIMIT_MAX_STRING_LEN + 1);
69
+
70
+ if (len > HPDF_LIMIT_MAX_STRING_LEN)
71
+ return HPDF_SetError (obj->error, HPDF_STRING_OUT_OF_RANGE, 0);
72
+
73
+ obj->value = (char *)HPDF_GetMem (obj->mmgr, len + 1);
74
+ if (!obj->value)
75
+ return HPDF_Error_GetCode (obj->error);
76
+
77
+ HPDF_StrCpy (obj->value, value, obj->value + len);
78
+ obj->len = len;
79
+
80
+ return ret;
81
+ }
82
+
83
+ void
84
+ HPDF_String_Free (HPDF_String obj)
85
+ {
86
+ if (!obj)
87
+ return;
88
+
89
+ HPDF_PTRACE((" HPDF_String_Free\n"));
90
+
91
+ HPDF_FreeMem (obj->mmgr, obj->value);
92
+ HPDF_FreeMem (obj->mmgr, obj);
93
+ }
94
+
95
+
96
+ HPDF_STATUS
97
+ HPDF_String_Write (HPDF_String obj,
98
+ HPDF_Stream stream,
99
+ HPDF_Encrypt e)
100
+ {
101
+ HPDF_STATUS ret;
102
+
103
+ /*
104
+ * When encoder is not NULL, text is changed to unicode using encoder,
105
+ * and it outputs by HPDF_write_binary method.
106
+ */
107
+
108
+ HPDF_PTRACE((" HPDF_String_Write\n"));
109
+
110
+ if (e)
111
+ HPDF_Encrypt_Reset (e);
112
+
113
+ if (obj->encoder == NULL) {
114
+ if (e) {
115
+ if ((ret = HPDF_Stream_WriteChar (stream, '<')) != HPDF_OK)
116
+ return ret;
117
+
118
+ if ((ret = HPDF_Stream_WriteBinary (stream, obj->value,
119
+ HPDF_StrLen (obj->value, -1), e)) != HPDF_OK)
120
+ return ret;
121
+
122
+ return HPDF_Stream_WriteChar (stream, '>');
123
+ } else {
124
+ return HPDF_Stream_WriteEscapeText (stream, obj->value);
125
+ }
126
+ } else {
127
+ HPDF_BYTE* src = obj->value;
128
+ HPDF_BYTE buf[HPDF_TEXT_DEFAULT_LEN * 2];
129
+ HPDF_UINT tmp_len = 0;
130
+ HPDF_BYTE* pbuf = buf;
131
+ HPDF_INT32 len = obj->len;
132
+ HPDF_ParseText_Rec parse_state;
133
+ HPDF_UINT i;
134
+
135
+ if ((ret = HPDF_Stream_WriteChar (stream, '<')) != HPDF_OK)
136
+ return ret;
137
+
138
+ if ((ret = HPDF_Stream_WriteBinary (stream, UNICODE_HEADER, 2, e))
139
+ != HPDF_OK)
140
+ return ret;
141
+
142
+ HPDF_Encoder_SetParseText (obj->encoder, &parse_state, src, len);
143
+
144
+ for (i = 0; i < len; i++) {
145
+ HPDF_BYTE b = src[i];
146
+ HPDF_UNICODE tmp_unicode;
147
+ HPDF_ByteType btype = HPDF_Encoder_ByteType (obj->encoder,
148
+ &parse_state);
149
+
150
+ if (tmp_len >= HPDF_TEXT_DEFAULT_LEN - 1) {
151
+ if ((ret = HPDF_Stream_WriteBinary (stream, buf,
152
+ tmp_len * 2, e)) != HPDF_OK)
153
+ return ret;
154
+
155
+ tmp_len = 0;
156
+ pbuf = buf;
157
+ }
158
+
159
+ if (btype != HPDF_BYTE_TYPE_TRIAL) {
160
+ if (btype == HPDF_BYTE_TYPE_LEAD) {
161
+ HPDF_BYTE b2 = src[i + 1];
162
+ HPDF_UINT16 char_code = (HPDF_UINT) b * 256 + b2;
163
+
164
+ tmp_unicode = HPDF_Encoder_ToUnicode (obj->encoder,
165
+ char_code);
166
+ } else {
167
+ tmp_unicode = HPDF_Encoder_ToUnicode (obj->encoder, b);
168
+ }
169
+
170
+ HPDF_UInt16Swap (&tmp_unicode);
171
+ HPDF_MemCpy (pbuf, (HPDF_BYTE*)&tmp_unicode, 2);
172
+ pbuf += 2;
173
+ tmp_len++;
174
+ }
175
+ }
176
+
177
+ if (tmp_len > 0) {
178
+ if ((ret = HPDF_Stream_WriteBinary (stream, buf, tmp_len * 2, e))
179
+ != HPDF_OK)
180
+ return ret;
181
+ }
182
+
183
+ if ((ret = HPDF_Stream_WriteChar (stream, '>')) != HPDF_OK)
184
+ return ret;
185
+ }
186
+
187
+ return HPDF_OK;
188
+ }
189
+
@@ -0,0 +1,438 @@
1
+ /*
2
+ * << Haru Free PDF Library 2.0.0 >> -- HPDF_utils.c
3
+ *
4
+ * Copyright (c) 1999-2004 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
5
+ *
6
+ * Permission to use, copy, modify, distribute and sell this software
7
+ * and its documentation for any purpose is hereby granted without fee,
8
+ * provided that the above copyright notice appear in all copies and
9
+ * that both that copyright notice and this permission notice appear
10
+ * in supporting documentation.
11
+ * It is provided "as is" without express or implied warranty.
12
+ *
13
+ */
14
+
15
+ #include <stdlib.h>
16
+ #include "hpdf_utils.h"
17
+ #include "hpdf_consts.h"
18
+
19
+ /*---------------------------------------------------------------------------*/
20
+
21
+ HPDF_INT
22
+ HPDF_AToI (const char *s)
23
+ {
24
+ HPDF_BOOL flg = HPDF_FALSE;
25
+ HPDF_INT v = 0;
26
+
27
+ /* increment pointer until the charactor of 's' is not
28
+ * white-space-charactor.
29
+ */
30
+ while (*s) {
31
+ if (HPDF_IS_WHITE_SPACE(*s))
32
+ s++;
33
+ else {
34
+ if (*s == '-') {
35
+ flg = HPDF_TRUE;
36
+ s++;
37
+ }
38
+ break;
39
+ }
40
+ }
41
+
42
+ while (*s >= '0' && *s <= '9') {
43
+ v *= 10;
44
+ v += *s - '0';
45
+ s++;
46
+ }
47
+
48
+ if (flg)
49
+ v *= -1;
50
+
51
+ return v;
52
+ }
53
+
54
+
55
+ HPDF_DOUBLE
56
+ HPDF_AToF (const char *s)
57
+ {
58
+ HPDF_BOOL flg = HPDF_FALSE;
59
+ HPDF_INT i = 0;
60
+ HPDF_DOUBLE v;
61
+ HPDF_INT tmp = 1;
62
+
63
+ /* increment pointer until the charactor of 's' is not
64
+ * white-space-charactor.
65
+ */
66
+ while (*s) {
67
+ if (HPDF_IS_WHITE_SPACE(*s))
68
+ s++;
69
+ else {
70
+ if (*s == '-') {
71
+ flg = HPDF_TRUE;
72
+ s++;
73
+ }
74
+ break;
75
+ }
76
+ }
77
+
78
+ while (*s >= '0' && *s <= '9') {
79
+ if (i > 3276)
80
+ break;
81
+
82
+ i *= 10;
83
+ i += *s - '0';
84
+ s++;
85
+ }
86
+
87
+ if (*s == '.') {
88
+ s++;
89
+ while (*s >= '0' && *s <= '9') {
90
+ if (i > 214748364)
91
+ break;
92
+
93
+ i *= 10;
94
+ i += *s - '0';
95
+ s++;
96
+ tmp *= 10;
97
+ }
98
+ }
99
+
100
+ v = (HPDF_DOUBLE)i / tmp;
101
+
102
+ if (flg)
103
+ v *= -1;
104
+
105
+ return v;
106
+ }
107
+
108
+
109
+ char*
110
+ HPDF_IToA (char *s,
111
+ HPDF_INT32 val,
112
+ char *eptr)
113
+ {
114
+ char* t;
115
+ char buf[HPDF_INT_LEN + 1];
116
+
117
+ if (val < 0) {
118
+ if (val < HPDF_LIMIT_MIN_INT)
119
+ val = HPDF_LIMIT_MIN_INT;
120
+ *s++ = '-';
121
+ val = -val;
122
+ } else if (val > HPDF_LIMIT_MAX_INT) {
123
+ val = HPDF_LIMIT_MAX_INT;
124
+ } else if (val == 0) {
125
+ *s++ = '0';
126
+ }
127
+
128
+ t = buf + HPDF_INT_LEN;
129
+ *t-- = 0;
130
+
131
+ while (val > 0) {
132
+ *t = (char)(val % 10) + '0';
133
+ val /= 10;
134
+ t--;
135
+ }
136
+
137
+ t++;
138
+ while (s < eptr && *t != 0)
139
+ *s++ = *t++;
140
+ *s = 0;
141
+
142
+ return s;
143
+ }
144
+
145
+
146
+ char*
147
+ HPDF_IToA2 (char *s,
148
+ HPDF_UINT32 val,
149
+ HPDF_UINT len)
150
+ {
151
+ char* t;
152
+ char* u;
153
+
154
+ if (val > HPDF_LIMIT_MAX_INT)
155
+ val = HPDF_LIMIT_MAX_INT;
156
+
157
+ u = s + len - 1;
158
+ *u = 0;
159
+ t = u - 1;
160
+ while (val > 0 && t >= s) {
161
+ *t = (char)(val % 10) + '0';
162
+ val /= 10;
163
+ t--;
164
+ }
165
+
166
+ while (s <= t)
167
+ *t-- = '0';
168
+
169
+ return s + len - 1;
170
+ }
171
+
172
+
173
+ char*
174
+ HPDF_FToA (char *s,
175
+ HPDF_REAL val,
176
+ char *eptr)
177
+ {
178
+ HPDF_INT32 int_val;
179
+ HPDF_INT32 fpart_val;
180
+ char buf[HPDF_REAL_LEN + 1];
181
+ char* sptr = s;
182
+ char* t;
183
+ HPDF_UINT32 i;
184
+
185
+ if (val > HPDF_LIMIT_MAX_REAL)
186
+ val = HPDF_LIMIT_MAX_REAL;
187
+ else
188
+ if (val < HPDF_LIMIT_MIN_REAL)
189
+ val = HPDF_LIMIT_MIN_REAL;
190
+
191
+ t = buf + HPDF_REAL_LEN;
192
+ *t-- = 0;
193
+
194
+ if (val < 0) {
195
+ *s++ = '-';
196
+ val = -val;
197
+ }
198
+
199
+ /* separate an integer part and a decimal part. */
200
+ int_val = (HPDF_INT32)(val + 0.000005);
201
+ fpart_val = (HPDF_INT32)((HPDF_REAL)(val - int_val + 0.000005) * 100000);
202
+
203
+ /* process decimal part */
204
+ for (i = 0; i < 5; i++) {
205
+ *t = (char)(fpart_val % 10) + '0';
206
+ fpart_val /= 10;
207
+ t--;
208
+ }
209
+
210
+ /* process integer part */
211
+ *t-- = '.';
212
+ *t = '0';
213
+ if (int_val == 0)
214
+ t--;
215
+
216
+ while (int_val > 0) {
217
+ *t = (char)(int_val % 10) + '0';
218
+ int_val /= 10;
219
+ t--;
220
+ }
221
+
222
+ t++;
223
+ while (s <= eptr && *t != 0)
224
+ *s++ = *t++;
225
+ s--;
226
+
227
+ /* delete an excessive decimal portion. */
228
+ while (s > sptr) {
229
+ if (*s == '0')
230
+ *s = 0;
231
+ else {
232
+ if (*s == '.')
233
+ *s = 0;
234
+ break;
235
+ }
236
+ s--;
237
+ }
238
+
239
+ return (*s == 0) ? s : ++s;
240
+ }
241
+
242
+
243
+ HPDF_BYTE*
244
+ HPDF_MemCpy (HPDF_BYTE* out,
245
+ const HPDF_BYTE *in,
246
+ HPDF_UINT n)
247
+ {
248
+ while (n > 0) {
249
+ *out++ = *in++;
250
+ n--;
251
+ }
252
+
253
+ return out;
254
+ }
255
+
256
+
257
+ HPDF_BYTE*
258
+ HPDF_StrCpy (char *out,
259
+ const char *in,
260
+ char *eptr)
261
+ {
262
+ if (in != NULL) {
263
+ while (eptr > out && *in != 0)
264
+ *out++ = *in++;
265
+ }
266
+
267
+ *out = 0;
268
+
269
+ return out;
270
+ }
271
+
272
+
273
+ HPDF_INT
274
+ HPDF_MemCmp (const HPDF_BYTE *s1,
275
+ const HPDF_BYTE *s2,
276
+ HPDF_UINT n)
277
+ {
278
+ if (n == 0)
279
+ return 0;
280
+
281
+ while (*s1 == *s2) {
282
+ n--;
283
+ if (n == 0)
284
+ return 0;
285
+ s1++;
286
+ s2++;
287
+ }
288
+
289
+ return *s1 - *s2;
290
+ }
291
+
292
+
293
+ HPDF_INT
294
+ HPDF_StrCmp (const char *s1,
295
+ const char *s2)
296
+ {
297
+ if (!s1 || !s2) {
298
+ if (!s1 && s2)
299
+ return -1;
300
+ else
301
+ return 1;
302
+ }
303
+
304
+ while (*s1 == *s2) {
305
+ s1++;
306
+ s2++;
307
+ if (*s1 == 0 || *s2 == 0)
308
+ break;
309
+ }
310
+
311
+ return (HPDF_BYTE)*s1 - (HPDF_BYTE)*s2;
312
+ }
313
+
314
+
315
+ void*
316
+ HPDF_MemSet (void *s,
317
+ HPDF_BYTE c,
318
+ HPDF_UINT n)
319
+ {
320
+ HPDF_BYTE* b = (HPDF_BYTE*)s;
321
+
322
+ while (n > 0) {
323
+ *b = c;
324
+ b++;
325
+ n--;
326
+ }
327
+
328
+ return b;
329
+ }
330
+
331
+
332
+ HPDF_UINT
333
+ HPDF_StrLen (const char *s,
334
+ HPDF_INT maxlen)
335
+ {
336
+ HPDF_INT len = 0;
337
+
338
+ if (!s)
339
+ return 0;
340
+
341
+ while (*s != 0 && (maxlen < 0 || len < maxlen)) {
342
+ s++;
343
+ len++;
344
+ }
345
+
346
+ return (HPDF_UINT)len;
347
+ }
348
+
349
+
350
+ const char*
351
+ HPDF_StrStr (const char *s1,
352
+ const char *s2,
353
+ HPDF_UINT maxlen)
354
+ {
355
+ HPDF_UINT len = HPDF_StrLen (s2, -1);
356
+
357
+ if (!s1)
358
+ return NULL;
359
+
360
+ if (len == 0)
361
+ return s1;
362
+
363
+ if (maxlen == 0)
364
+ maxlen = HPDF_StrLen (s1, -1);
365
+
366
+ if (maxlen < len)
367
+ return NULL;
368
+
369
+ maxlen -= len;
370
+ maxlen++;
371
+
372
+ while (maxlen > 0) {
373
+ if (HPDF_MemCmp (s1, s2, len) == 0)
374
+ return s1;
375
+
376
+ s1++;
377
+ maxlen--;
378
+ }
379
+
380
+ return NULL;
381
+ }
382
+
383
+
384
+ HPDF_Box
385
+ HPDF_ToBox (HPDF_INT16 left,
386
+ HPDF_INT16 bottom,
387
+ HPDF_INT16 right,
388
+ HPDF_INT16 top)
389
+ {
390
+ HPDF_Box box;
391
+
392
+ box.left = left;
393
+ box.bottom = bottom;
394
+ box.right = right;
395
+ box.top = top;
396
+
397
+ return box;
398
+ }
399
+
400
+
401
+ HPDF_Point
402
+ HPDF_ToPoint (HPDF_INT16 x,
403
+ HPDF_INT16 y)
404
+ {
405
+ HPDF_Point point;
406
+
407
+ point.x = x;
408
+ point.y = y;
409
+
410
+ return point;
411
+ }
412
+
413
+ HPDF_Rect
414
+ HPDF_ToRect (HPDF_REAL left,
415
+ HPDF_REAL bottom,
416
+ HPDF_REAL right,
417
+ HPDF_REAL top)
418
+ {
419
+ HPDF_Rect rect;
420
+
421
+ rect.left = left;
422
+ rect.bottom = bottom;
423
+ rect.right = right;
424
+ rect.top = top;
425
+
426
+ return rect;
427
+ }
428
+
429
+
430
+ void
431
+ HPDF_UInt16Swap (HPDF_UINT16 *value)
432
+ {
433
+ HPDF_BYTE u[2];
434
+
435
+ HPDF_MemCpy (u, (HPDF_BYTE*)value, 2);
436
+ *value = (HPDF_UINT16)((HPDF_UINT16)u[0] << 8 | (HPDF_UINT16)u[1]);
437
+ }
438
+