]>
Commit | Line | Data |
---|---|---|
d38ed86b AM |
1 | diff -urN php-4.0.5.org/ext/pdf/pdf.c php-4.0.5/ext/pdf/pdf.c |
2 | --- php-4.0.5.org/ext/pdf/pdf.c Thu May 10 23:24:29 2001 | |
3 | +++ php-4.0.5/ext/pdf/pdf.c Tue May 8 02:23:58 2001 | |
4 | @@ -17,7 +17,7 @@ | |
5 | +----------------------------------------------------------------------+ | |
6 | */ | |
7 | ||
8 | -/* $Id$ */ | |
9 | +/* $Id$ */ | |
10 | /* Id: pdf.c,v 1.73 2001/02/26 06:07:11 andi Exp */ | |
11 | ||
12 | /* pdflib 2.02 ... 3.0x is subject to the ALADDIN FREE PUBLIC LICENSE. | |
13 | @@ -171,6 +171,8 @@ | |
14 | PHP_FE(pdf_add_annotation, NULL) | |
15 | #if HAVE_LIBGD13 | |
16 | PHP_FE(pdf_open_memory_image, NULL) | |
17 | +#else | |
18 | + PHP_FALIAS(pdf_open_memory_image, warn_not_available, NULL) | |
19 | #endif | |
20 | /* depreciatet after V4.0 of PDFlib */ | |
21 | PHP_FE(pdf_setgray_fill, NULL) | |
22 | @@ -185,6 +187,7 @@ | |
23 | PHP_FE(pdf_open_pdi, NULL) | |
24 | PHP_FE(pdf_close_pdi, NULL) | |
25 | PHP_FE(pdf_open_pdi_page, NULL) | |
26 | + PHP_FE(pdf_place_pdi_page, NULL) | |
27 | PHP_FE(pdf_close_pdi_page, NULL) | |
28 | PHP_FE(pdf_get_pdi_parameter, NULL) | |
29 | PHP_FE(pdf_get_pdi_value, NULL) | |
30 | @@ -198,6 +201,24 @@ | |
31 | PHP_FE(pdf_add_thumbnail, NULL) | |
32 | PHP_FE(pdf_initgraphics, NULL) | |
33 | PHP_FE(pdf_setmatrix, NULL) | |
34 | +#else | |
35 | + PHP_FALIAS(pdf_open_pdi, warn_not_available, NULL) | |
36 | + PHP_FALIAS(pdf_close_pdi, warn_not_available, NULL) | |
37 | + PHP_FALIAS(pdf_open_pdi_page, warn_not_available, NULL) | |
38 | + PHP_FALIAS(pdf_place_pdi_page, warn_not_available, NULL) | |
39 | + PHP_FALIAS(pdf_close_pdi_page, warn_not_available, NULL) | |
40 | + PHP_FALIAS(pdf_get_pdi_parameter, warn_not_available, NULL) | |
41 | + PHP_FALIAS(pdf_get_pdi_value, warn_not_available, NULL) | |
42 | + PHP_FALIAS(pdf_begin_pattern, warn_not_available, NULL) | |
43 | + PHP_FALIAS(pdf_end_pattern, warn_not_available, NULL) | |
44 | + PHP_FALIAS(pdf_begin_template, warn_not_available, NULL) | |
45 | + PHP_FALIAS(pdf_end_template, warn_not_available, NULL) | |
46 | + PHP_FALIAS(pdf_setcolor, warn_not_available, NULL) | |
47 | + PHP_FALIAS(pdf_makespotcolor, warn_not_available, NULL) | |
48 | + PHP_FALIAS(pdf_arcn, warn_not_available, NULL) | |
49 | + PHP_FALIAS(pdf_add_thumbnail, warn_not_available, NULL) | |
50 | + PHP_FALIAS(pdf_initgraphics, warn_not_available, NULL) | |
51 | + PHP_FALIAS(pdf_setmatrix, warn_not_available, NULL) | |
52 | #endif /* PDFlib >= V4 */ | |
53 | ||
54 | {NULL, NULL, NULL} | |
55 | @@ -293,7 +314,7 @@ | |
56 | #else | |
57 | php_info_print_table_row(2, "PDFlib GmbH Version", tmp ); | |
58 | #endif | |
59 | - php_info_print_table_row(2, "Revision", "$Revision$" ); | |
60 | + php_info_print_table_row(2, "Revision", "$Revision$" ); | |
61 | php_info_print_table_end(); | |
62 | ||
63 | } | |
64 | @@ -2684,24 +2705,50 @@ | |
65 | RETURN_LONG(pdi_image+PDFLIB_IMAGE_OFFSET); | |
66 | } | |
67 | ||
68 | -/* {{{ proto void pdf_close_pdi_page(int pdf, int doc, int page); | |
69 | +/* {{{ proto void pdf_place_pdi_page(int pdf, int page, double x, double y, double sx, double sy) | |
70 | + * Place a PDF page with the lower left corner at (x, y), and scale it. */ | |
71 | +PHP_FUNCTION(pdf_place_pdi_page) { | |
72 | + zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6; | |
73 | + PDF *pdf; | |
74 | + | |
75 | + if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { | |
76 | + WRONG_PARAM_COUNT; | |
77 | + } | |
78 | + | |
79 | + ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); | |
80 | + | |
81 | + convert_to_long_ex(arg2); | |
82 | + convert_to_double_ex(arg3); | |
83 | + convert_to_double_ex(arg4); | |
84 | + convert_to_double_ex(arg5); | |
85 | + convert_to_double_ex(arg6); | |
86 | + | |
87 | + PDF_place_pdi_page(pdf, | |
88 | + Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET, | |
89 | + (float) Z_DVAL_PP(arg3), | |
90 | + (float) Z_DVAL_PP(arg4), | |
91 | + (float) Z_DVAL_PP(arg5), | |
92 | + (float) Z_DVAL_PP(arg6)); | |
93 | + | |
94 | + RETURN_TRUE; | |
95 | +} | |
96 | + | |
97 | +/* {{{ proto void pdf_close_pdi_page(int pdf, int page); | |
98 | * Close the page handle, and free all page-related resources. */ | |
99 | PHP_FUNCTION(pdf_close_pdi_page) { | |
100 | - zval **arg1, **arg2, **arg3; | |
101 | + zval **arg1, **arg2; | |
102 | PDF *pdf; | |
103 | ||
104 | - if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) { | |
105 | + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { | |
106 | WRONG_PARAM_COUNT; | |
107 | } | |
108 | ||
109 | ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf); | |
110 | ||
111 | convert_to_long_ex(arg2); | |
112 | - convert_to_long_ex(arg3); | |
113 | ||
114 | PDF_close_pdi_page(pdf, | |
115 | - Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET, | |
116 | - Z_LVAL_PP(arg3)-PDFLIB_IMAGE_OFFSET); | |
117 | + Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET); | |
118 | ||
119 | RETURN_TRUE; | |
120 | } | |
121 | @@ -2854,7 +2901,7 @@ | |
122 | PHP_FUNCTION(pdf_setcolor) { | |
123 | zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7; | |
124 | PDF *pdf; | |
125 | - int c1; | |
126 | + double c1; | |
127 | ||
128 | if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) { | |
129 | WRONG_PARAM_COUNT; | |
130 | @@ -2870,11 +2917,11 @@ | |
131 | convert_to_double_ex(arg7); | |
132 | ||
133 | if (0 == (strcmp(Z_STRVAL_PP(arg3), "spot"))) { | |
134 | - c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET; | |
135 | + c1 = Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET; | |
136 | } else if(0 == (strcmp(Z_STRVAL_PP(arg3), "pattern"))) { | |
137 | - c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET; | |
138 | + c1 = Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET; | |
139 | } else { | |
140 | - c1 = (float) Z_DVAL_PP(arg4); | |
141 | + c1 = Z_DVAL_PP(arg4); | |
142 | } | |
143 | ||
144 | PDF_setcolor(pdf, | |
145 | diff -urN php-4.0.5.org/ext/pdf/php_pdf.h php-4.0.5/ext/pdf/php_pdf.h | |
146 | --- php-4.0.5.org/ext/pdf/php_pdf.h Thu May 10 23:24:29 2001 | |
147 | +++ php-4.0.5/ext/pdf/php_pdf.h Wed Mar 21 21:55:34 2001 | |
148 | @@ -16,7 +16,7 @@ | |
149 | +----------------------------------------------------------------------+ | |
150 | */ | |
151 | ||
152 | -/* $Id$ */ | |
153 | +/* $Id$ */ | |
154 | ||
155 | #ifndef PHP_PDF_H | |
156 | #define PHP_PDF_H | |
157 | @@ -151,6 +151,7 @@ | |
158 | PHP_FUNCTION(pdf_open_pdi); | |
159 | PHP_FUNCTION(pdf_close_pdi); | |
160 | PHP_FUNCTION(pdf_open_pdi_page); | |
161 | +PHP_FUNCTION(pdf_place_pdi_page); | |
162 | PHP_FUNCTION(pdf_close_pdi_page); | |
163 | PHP_FUNCTION(pdf_get_pdi_parameter); | |
164 | PHP_FUNCTION(pdf_get_pdi_value); |