CVS update: php3/functions

From: Date: Wed, 06 Jan 1999 14:26:07 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-3334@lists.php.net to get a copy of this message
Date: Wednesday January 6, 1999 @ 9:26 Author: steinm Update of /repository/php3/functions In directory asf:/u/temp/cvs-serv20815/functions Modified Files: pdf.c php3_pdf.h Log Message: - encoding parameter of pdf_set_font now int (was string) - new functions to insert jpeg images - updated documantation Index: php3/functions/pdf.c diff -c php3/functions/pdf.c:1.16 php3/functions/pdf.c:1.17 *** php3/functions/pdf.c:1.16 Wed Jan 6 01:18:26 1999 --- php3/functions/pdf.c Wed Jan 6 09:26:06 1999 *************** *** 27,33 **** +----------------------------------------------------------------------+ */ ! /* $Id: pdf.c,v 1.16 1999/01/06 06:18:26 rasmus Exp $ */ /* pdflib 0.6 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ --- 27,33 ---- +----------------------------------------------------------------------+ */ ! /* $Id: pdf.c,v 1.17 1999/01/06 14:26:06 steinm Exp $ */ /* pdflib 0.6 is subject to the ALADDIN FREE PUBLIC LICENSE. Copyright (C) 1997 Thomas Merz. */ *************** *** 63,68 **** --- 63,69 ---- static int numthreads=0; typedef struct pdflib_global_struct{ + int le_pdf_image; int le_pdf_info; int le_pdf; } pdflib_global_struct; *************** *** 73,78 **** --- 74,80 ---- #else # define PDF_GLOBAL(a) a # define PDF_TLS_VARS + int le_pdf_image; int le_pdf_info; int le_pdf; #endif *************** *** 135,140 **** --- 137,145 ---- {"pdf_add_outline", php3_pdf_add_outline, NULL}, {"pdf_set_transition", php3_pdf_set_transition, NULL}, {"pdf_set_duration", php3_pdf_set_duration, NULL}, + {"pdf_open_jpeg", php3_pdf_open_jpeg, NULL}, + {"pdf_close_image", php3_pdf_close_image, NULL}, + {"pdf_place_image", php3_pdf_place_image, NULL}, {NULL, NULL, NULL} }; *************** *** 156,163 **** --- 161,177 ---- if(info->Creator) efree(info->Creator); } + static void _free_pdf_image(PDF_image *image) + { + /* The first parameter isn't used in any of the image close + functions. It should be the PDF doc. + */ + PDF_close_image(NULL, image); + } + int php3_minit_pdf(INIT_FUNC_ARGS) { + PDF_GLOBAL(le_pdf_image) = register_list_destructors(_free_pdf_image, NULL); PDF_GLOBAL(le_pdf_info) = register_list_destructors(_free_pdf_info, NULL); PDF_GLOBAL(le_pdf) = register_list_destructors(php3_pdf_close, NULL); return SUCCESS; *************** *** 511,517 **** } /* }}} */ ! /* {{{ proto void pdf_set_font(int pdfdoc, string font, double size, string encoding) Select the current font face and size */ void php3_pdf_set_font(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3, *arg4; --- 525,531 ---- } /* }}} */ ! /* {{{ proto void pdf_set_font(int pdfdoc, string font, double size, int encoding) Select the current font face and size */ void php3_pdf_set_font(INTERNAL_FUNCTION_PARAMETERS) { pval *arg1, *arg2, *arg3, *arg4; *************** *** 526,532 **** convert_to_long(arg1); convert_to_string(arg2); convert_to_double(arg3); ! convert_to_string(arg4); id=arg1->value.lval; pdf = php3_list_find(id,&type); if(!pdf || type!=PDF_GLOBAL(le_pdf)) { --- 540,546 ---- convert_to_long(arg1); convert_to_string(arg2); convert_to_double(arg3); ! convert_to_long(arg4); id=arg1->value.lval; pdf = php3_list_find(id,&type); if(!pdf || type!=PDF_GLOBAL(le_pdf)) { *************** *** 534,540 **** RETURN_FALSE; } ! PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, builtin); RETURN_TRUE; } --- 548,554 ---- RETURN_FALSE; } ! PDF_set_font(pdf, arg2->value.str.val, (float) arg3->value.dval, arg4->value.lval); RETURN_TRUE; } *************** *** 1784,1789 **** --- 1798,1903 ---- } PDF_set_duration(pdf, (float) arg2->value.dval); + + RETURN_TRUE; + } + /* }}} */ + + /* {{{ proto int pdf_open_jpeg(void) + Returns a default info structure for a pdf document */ + void php3_pdf_open_jpeg(INTERNAL_FUNCTION_PARAMETERS) { + pval *arg1, *arg2; + int id, type; + PDF_image *pdf_image; + PDF *pdf; + PDF_TLS_VARS; + + if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + convert_to_string(arg2); + id=arg1->value.lval; + pdf = php3_list_find(id,&type); + if(!pdf || type!=PDF_GLOBAL(le_pdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + pdf_image = PDF_open_JPEG(pdf, arg2->value.str.val); + + if(!pdf_image) { + php3_error(E_WARNING, "Could not open image"); + RETURN_FALSE; + } + + id = php3_list_insert(pdf_image,PDF_GLOBAL(le_pdf_image)); + RETURN_LONG(id); + } + /* }}} */ + + /* {{{ proto void pdf_close_image(int pdfimage) + Closes the pdf image */ + void php3_pdf_close_image(INTERNAL_FUNCTION_PARAMETERS) { + pval *arg1; + int id, type; + PDF_image *pdf_image; + PDF_TLS_VARS; + + if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + id=arg1->value.lval; + pdf_image = php3_list_find(id,&type); + if(!pdf_image || type!=PDF_GLOBAL(le_pdf_image)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + /* See comment in _free_pdf_image() */ + PDF_close_image(NULL, pdf_image); + + RETURN_TRUE; + } + /* }}} */ + + /* {{{ proto void pdf_place_image(int pdfimage) + Places image in the pdf document */ + void php3_pdf_place_image(INTERNAL_FUNCTION_PARAMETERS) { + pval *arg1, *arg2, *arg3, *arg4, *arg5; + int id, type; + PDF_image *pdf_image; + PDF *pdf; + PDF_TLS_VARS; + + if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(arg1); + id=arg1->value.lval; + pdf = php3_list_find(id,&type); + if(!pdf || type!=PDF_GLOBAL(le_pdf)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + convert_to_long(arg2); + id=arg2->value.lval; + pdf_image = php3_list_find(id,&type); + if(!pdf_image || type!=PDF_GLOBAL(le_pdf_image)) { + php3_error(E_WARNING,"Unable to find file identifier %d",id); + RETURN_FALSE; + } + + convert_to_double(arg3); + convert_to_double(arg4); + convert_to_double(arg5); + + PDF_place_image(pdf, pdf_image, (float) arg3->value.dval, (float) arg4->value.dval, arg5->value.dval); RETURN_TRUE; } Index: php3/functions/php3_pdf.h diff -c php3/functions/php3_pdf.h:1.5 php3/functions/php3_pdf.h:1.6 *** php3/functions/php3_pdf.h:1.5 Fri Jan 1 12:59:16 1999 --- php3/functions/php3_pdf.h Wed Jan 6 09:26:07 1999 *************** *** 26,32 **** | Authors: Uwe Steinmann | +----------------------------------------------------------------------+ */ ! /* $Id: php3_pdf.h,v 1.5 1999/01/01 17:59:16 zeev Exp $ */ #ifndef _PHP3_PDF_H #define _PHP3_PDF_H --- 26,32 ---- | Authors: Uwe Steinmann | +----------------------------------------------------------------------+ */ ! /* $Id: php3_pdf.h,v 1.6 1999/01/06 14:26:07 steinm Exp $ */ #ifndef _PHP3_PDF_H #define _PHP3_PDF_H *************** *** 100,105 **** --- 100,108 ---- extern void php3_pdf_add_outline(INTERNAL_FUNCTION_PARAMETERS); extern void php3_pdf_set_transition(INTERNAL_FUNCTION_PARAMETERS); extern void php3_pdf_set_duration(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_pdf_open_jpeg(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_pdf_close_image(INTERNAL_FUNCTION_PARAMETERS); + extern void php3_pdf_place_image(INTERNAL_FUNCTION_PARAMETERS); #else #define pdf_module_ptr NULL #endif -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3334) next »