From: Rainer Schaaf Date: Wed, 21 Mar 2001 20:55:35 +0000 (+0000) Subject: Beta2 of PDFlib V4.0 will introduce on new function (PDF_place_pdi_page) X-Git-Tag: php-4.0.6RC1~608 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9444df9e0bff1883347529e030e65494d660c79e;p=php Beta2 of PDFlib V4.0 will introduce on new function (PDF_place_pdi_page) 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. --- diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c index 71c1a582cd..8ee4d657bc 100644 --- a/ext/pdf/pdf.c +++ b/ext/pdf/pdf.c @@ -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, diff --git a/ext/pdf/php_pdf.h b/ext/pdf/php_pdf.h index a3050ebb3b..f04431a5e2 100644 --- a/ext/pdf/php_pdf.h +++ b/ext/pdf/php_pdf.h @@ -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);