]> granicus.if.org Git - php/commitdiff
Beta2 of PDFlib V4.0 will introduce on new function (PDF_place_pdi_page)
authorRainer Schaaf <rjs@php.net>
Wed, 21 Mar 2001 20:55:35 +0000 (20:55 +0000)
committerRainer Schaaf <rjs@php.net>
Wed, 21 Mar 2001 20:55:35 +0000 (20:55 +0000)
and PDF_close_pdi_page will lose one parameter.
These changes are done for the phpwrapper now.
This has no impact on PDFlib V3.x.

ext/pdf/pdf.c
ext/pdf/php_pdf.h

index 71c1a582cdb4232af3183bb250df377c7c416501..8ee4d657bcb3203a0efd7b9e575b82c51c44e72d 100644 (file)
@@ -185,6 +185,7 @@ function_entry pdf_functions[] = {
        PHP_FE(pdf_open_pdi, NULL)
        PHP_FE(pdf_close_pdi, NULL)
        PHP_FE(pdf_open_pdi_page, NULL)
+       PHP_FE(pdf_place_pdi_page, NULL)
        PHP_FE(pdf_close_pdi_page, NULL)
        PHP_FE(pdf_get_pdi_parameter, NULL)
        PHP_FE(pdf_get_pdi_value, NULL)
@@ -2684,24 +2685,50 @@ PHP_FUNCTION(pdf_open_pdi_page) {
        RETURN_LONG(pdi_image+PDFLIB_IMAGE_OFFSET);
 }
 
-/* {{{ proto void pdf_close_pdi_page(int pdf, int doc, int page);
+/* {{{ proto void pdf_place_pdi_page(int pdf, int page, double x, double y, double sx, double sy)
+ * Place a PDF page with the lower left corner at (x, y), and scale it. */
+PHP_FUNCTION(pdf_place_pdi_page) {
+       zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6;
+       PDF *pdf;
+
+       if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
+
+       convert_to_long_ex(arg2);
+       convert_to_double_ex(arg3);
+       convert_to_double_ex(arg4);
+       convert_to_double_ex(arg5);
+       convert_to_double_ex(arg6);
+
+       PDF_place_pdi_page(pdf,
+               Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET,
+               (float) Z_DVAL_PP(arg3),
+               (float) Z_DVAL_PP(arg4),
+               (float) Z_DVAL_PP(arg5),
+               (float) Z_DVAL_PP(arg6));
+
+       RETURN_TRUE;
+}
+
+/* {{{ proto void pdf_close_pdi_page(int pdf, int page);
  * Close the page handle, and free all page-related resources. */
 PHP_FUNCTION(pdf_close_pdi_page) {
-       zval **arg1, **arg2, **arg3;
+       zval **arg1, **arg2;
        PDF *pdf;
 
-       if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &arg1, &arg2, &arg3) == FAILURE) {
+       if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
 
        ZEND_FETCH_RESOURCE(pdf, PDF *, arg1, -1, "pdf object", le_pdf);
 
        convert_to_long_ex(arg2);
-       convert_to_long_ex(arg3);
 
        PDF_close_pdi_page(pdf,
-               Z_LVAL_PP(arg2)-PDFLIB_PDI_OFFSET,
-               Z_LVAL_PP(arg3)-PDFLIB_IMAGE_OFFSET);
+               Z_LVAL_PP(arg2)-PDFLIB_IMAGE_OFFSET);
 
        RETURN_TRUE;
 }
@@ -2854,7 +2881,7 @@ PHP_FUNCTION(pdf_end_template) {
 PHP_FUNCTION(pdf_setcolor) {
        zval **arg1, **arg2, **arg3, **arg4, **arg5, **arg6, **arg7;
        PDF *pdf;
-       int c1;
+       double c1;
 
        if (ZEND_NUM_ARGS() != 7 || zend_get_parameters_ex(7, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &arg7) == FAILURE) {
                WRONG_PARAM_COUNT;
@@ -2870,11 +2897,11 @@ PHP_FUNCTION(pdf_setcolor) {
        convert_to_double_ex(arg7);
 
        if (0 == (strcmp(Z_STRVAL_PP(arg3), "spot"))) {
-           c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET;
+           c1 = Z_DVAL_PP(arg4)-PDFLIB_SPOT_OFFSET;
        } else if(0 == (strcmp(Z_STRVAL_PP(arg3), "pattern"))) {
-           c1 = (int) Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET;
+           c1 = Z_DVAL_PP(arg4)-PDFLIB_PATTERN_OFFSET;
        } else {
-           c1 = (float) Z_DVAL_PP(arg4);
+           c1 = Z_DVAL_PP(arg4);
        }
 
        PDF_setcolor(pdf,
index a3050ebb3b4968fbd500b31fd85c7c43aec90be6..f04431a5e24b21647b89710cbcb69043a1041cce 100644 (file)
@@ -151,6 +151,7 @@ PHP_FUNCTION(pdf_open_memory_image);
 PHP_FUNCTION(pdf_open_pdi);
 PHP_FUNCTION(pdf_close_pdi);
 PHP_FUNCTION(pdf_open_pdi_page);
+PHP_FUNCTION(pdf_place_pdi_page);
 PHP_FUNCTION(pdf_close_pdi_page);
 PHP_FUNCTION(pdf_get_pdi_parameter);
 PHP_FUNCTION(pdf_get_pdi_value);