CVS update: php3/functions
| From: | steinm | Date: | Wed, 26 May 1999 19:03:32 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6031@lists.php.net to get a copy of this message | ||
Date: Wednesday May 26, 1999 @ 15:03
Author: steinm
Update of /repository/php3/functions
In directory php:/tmp/cvs-serv14789/functions
Modified Files:
cpdf.c php3_cpdf.h
Log Message:
- more functions
- additionale parameters for several functions
Index: php3/functions/cpdf.c
diff -u php3/functions/cpdf.c:1.3 php3/functions/cpdf.c:1.4
--- php3/functions/cpdf.c:1.3 Fri May 21 07:07:51 1999
+++ php3/functions/cpdf.c Wed May 26 15:03:32 1999
@@ -27,7 +27,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: cpdf.c,v 1.3 1999/05/21 11:07:51 steinm Exp $ */
+/* $Id: cpdf.c,v 1.4 1999/05/26 19:03:32 steinm Exp $ */
/* cpdflib.h -- C language API definitions for ClibPDF library
* Copyright (C) 1998 FastIO Systems, All Rights Reserved.
*/
@@ -83,6 +83,7 @@
{"cpdf_open", php3_cpdf_open, NULL},
{"cpdf_close", php3_cpdf_close, NULL},
{"cpdf_page_init", php3_cpdf_page_init, NULL},
+ {"cpdf_set_current_page", php3_cpdf_set_current_page, NULL},
{"cpdf_begin_text", php3_cpdf_begin_text, NULL},
{"cpdf_end_text", php3_cpdf_end_text, NULL},
{"cpdf_show", php3_cpdf_show, NULL},
@@ -111,7 +112,9 @@
{"cpdf_setlinewidth", php3_cpdf_setlinewidth, NULL},
{"cpdf_setdash", php3_cpdf_setdash, NULL},
{"cpdf_moveto", php3_cpdf_moveto, NULL},
+ {"cpdf_rmoveto", php3_cpdf_rmoveto, NULL},
{"cpdf_lineto", php3_cpdf_lineto, NULL},
+ {"cpdf_rlineto", php3_cpdf_rlineto, NULL},
{"cpdf_curveto", php3_cpdf_curveto, NULL},
{"cpdf_circle", php3_cpdf_circle, NULL},
{"cpdf_arc", php3_cpdf_arc, NULL},
@@ -133,6 +136,8 @@
{"cpdf_finalize", php3_cpdf_finalize, NULL},
{"cpdf_get_buffer", php3_cpdf_get_buffer, NULL},
{"cpdf_save_to_file", php3_cpdf_save_to_file, NULL},
+ {"cpdf_import_jpeg", php3_cpdf_import_jpeg, NULL},
+ {"cpdf_set_annotation", php3_cpdf_set_annotation, NULL},
{NULL, NULL, NULL}
};
@@ -344,43 +349,112 @@
}
/* }}} */
-/* {{{ proto void cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width)
+/* {{{ proto void cpdf_page_init(int pdfdoc, int pagenr, int orientation, int height, int width [,
double unit])
Starts page */
void php3_cpdf_page_init(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4, *arg5;
+ pval *argv[6];
int id, type, pagenr, orientation;
- int height, width;
+ int height, width, argc;
char buffer[40];
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4,
&arg5) == FAILURE) {
+ argc = ARG_COUNT(ht);
+ switch(argc) {
+ case 5:
+ case 6:
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
+ break;
+ default:
+ WRONG_PARAM_COUNT;
+ break;
+ }
+
+ convert_to_long(argv[0]);
+ convert_to_long(argv[1]);
+ convert_to_long(argv[2]);
+ convert_to_long(argv[3]);
+ convert_to_long(argv[4]);
+ convert_to_long(argv[5]);
+ id=argv[0]->value.lval;
+ pagenr=argv[1]->value.lval;
+ orientation=argv[2]->value.lval;
+ height = argv[3]->value.lval;
+ width = argv[4]->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ sprintf(buffer, "0 0 %d %d", width, height);
+ cpdf_pageInit(pagenr, orientation, buffer, buffer);
+ if(argc > 5) {
+ convert_to_double(argv[5]);
+ cpdf_setDefaultDomainUnit(argv[5]->value.dval);
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto void cpdf_finalize_page(int pdfdoc, int pagenr)
+ Ends the page to save memory */
+void php3_cpdf_finalize_page(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type, pagenr;
+ int *pdf;
+ CPDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(arg1);
convert_to_long(arg2);
- convert_to_long(arg3);
- convert_to_long(arg4);
- convert_to_long(arg5);
id=arg1->value.lval;
pagenr=arg2->value.lval;
- orientation=arg3->value.lval;
- height = arg4->value.lval;
- width = arg5->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- sprintf(buffer, "0 0 %d %d", width, height);
- cpdf_pageInit(pagenr, orientation, buffer, buffer);
+ cpdf_finalizePage(pagenr);
RETURN_TRUE;
}
/* }}} */
+/* {{{ proto void cpdf_set_current_page(int pdfdoc, int pagenr)
+ Sets page for output */
+void php3_cpdf_set_current_page(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *arg1, *arg2;
+ int id, type, pagenr;
+ int *pdf;
+ CPDF_TLS_VARS;
+
+ if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_long(arg1);
+ convert_to_long(arg2);
+ id=arg1->value.lval;
+ pagenr=arg2->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ cpdf_setCurrentPage(pagenr);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
/* {{{ proto void cpdf_begin_text(int pdfdoc)
Starts text section */
void php3_cpdf_begin_text(INTERNAL_FUNCTION_PARAMETERS) {
@@ -460,30 +534,39 @@
}
/* }}} */
-/* {{{ proto void cpdf_show_xy(int pdfdoc, string text, double x-koor, double y-koor)
+/* {{{ proto void cpdf_show_xy(int pdfdoc, string text, double x-koor, double y-koor [, int mode])
Output text at position */
void php3_cpdf_show_xy(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4;
- int id, type;
+ pval *argv[5];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) ==
FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 4) || (argc > 5))
WRONG_PARAM_COUNT;
- }
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
- convert_to_long(arg1);
- convert_to_string(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- id=arg1->value.lval;
+ convert_to_long(argv[0]);
+ convert_to_string(argv[1]);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- cpdf_rawText((float) arg3->value.dval, (float) arg4->value.dval, 0.0,
arg2->value.str.val);
+ if(argc == 5) {
+ convert_to_long(argv[4]);
+ mode = argv[4]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawText((float) argv[2]->value.dval, (float) argv[3]->value.dval, 0.0,
argv[1]->value.str.val);
+ else
+ cpdf_Text((float) argv[2]->value.dval, (float) argv[3]->value.dval, 0.0,
argv[1]->value.str.val);
RETURN_TRUE;
}
@@ -516,80 +599,75 @@
}
/* }}} */
-/* {{{ proto void cpdf_text(int pdfdoc, string text[, double x-koor, double y-koor[, double
orientation, [int alignmode]]])
+/* {{{ proto void cpdf_text(int pdfdoc, string text[, double x-koor, double y-koor[, int mode[,
double orientation[, int alignmode]]]])
Output text */
void php3_cpdf_text(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
- int id, type, argc;
+ pval *argv[7];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
argc = ARG_COUNT(ht);
- switch(argc) {
- case 2:
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 4:
- if (getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 5:
- if (getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 6:
- if (getParameters(ht, 6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) ==
FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- default:
+ if((argc < 2) || (argc == 3) || (argc > 7) || getParametersArray(ht, argc, argv) == FAILURE)
WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
- id=arg1->value.lval;
+ convert_to_long(argv[0]);
+ convert_to_string(argv[1]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
+ if(argc > 4) {
+ convert_to_long(argv[4]);
+ mode = argv[2]->value.lval;
+ }
switch(argc) {
case 2:
- cpdf_textShow(arg2->value.str.val);
+ cpdf_textShow(argv[1]->value.str.val);
break;
case 4:
- convert_to_double(arg3);
- convert_to_double(arg4);
- cpdf_rawText((float) arg3->value.dval,
- (float) arg4->value.dval,
- 0.0,
- arg2->value.str.val);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ cpdf_Text((float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ 0.0,
+ argv[1]->value.str.val);
break;
case 5:
- convert_to_double(arg3);
- convert_to_double(arg4);
- convert_to_double(arg5);
- cpdf_rawText((float) arg3->value.dval,
- (float) arg4->value.dval,
- (float) arg5->value.dval,
- arg2->value.str.val);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ convert_to_double(argv[4]);
+ if(mode == 1)
+ cpdf_rawText((float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ argv[1]->value.str.val);
+ else
+ cpdf_Text((float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ argv[1]->value.str.val);
break;
case 6:
- convert_to_double(arg3);
- convert_to_double(arg4);
- convert_to_double(arg5);
- convert_to_double(arg6);
- cpdf_rawTextAligned((float) arg3->value.dval,
- (float) arg4->value.dval,
- (float) arg5->value.dval,
- (float) arg6->value.dval,
- arg2->value.str.val);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ convert_to_double(argv[4]);
+ convert_to_double(argv[5]);
+ if(mode == 1)
+ cpdf_rawTextAligned((float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ (float) argv[5]->value.dval,
+ argv[1]->value.str.val);
+ else
+ cpdf_TextAligned((float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ (float) argv[5]->value.dval,
+ argv[1]->value.str.val);
break;
}
@@ -670,7 +748,7 @@
}
/* }}} */
-/* {{{ proto void cpdf_set_text_rendering(int pdfdoc, int mode)
+/* {{{ proto void cpdf_set_text_rendering(int pdfdoc, int rendermode)
Determines how text is rendered */
void php3_cpdf_set_text_rendering(INTERNAL_FUNCTION_PARAMETERS) {
pval *arg1, *arg2;
@@ -802,29 +880,38 @@
}
/* }}} */
-/* {{{ proto void cpdf_set_text_pos(int pdfdoc, double x, double y)
+/* {{{ proto void cpdf_set_text_pos(int pdfdoc, double x, double y[, int mode])
??? */
void php3_cpdf_set_text_pos(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3;
- int id, type;
+ pval *argv[4];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 3) || (argc > 4))
WRONG_PARAM_COUNT;
- }
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- id=arg1->value.lval;
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
-
- cpdf_rawSetTextPosition((float) arg2->value.dval, (float) arg3->value.dval);
+
+ if(argc > 3) {
+ convert_to_long(argv[3]);
+ mode = argv[3]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawSetTextPosition((float) argv[1]->value.dval, (float) argv[2]->value.dval);
+ else
+ cpdf_SetTextPosition((float) argv[1]->value.dval, (float) argv[2]->value.dval);
RETURN_TRUE;
}
@@ -1073,7 +1160,7 @@
RETURN_FALSE;
}
- cpdf_setflat((float) arg2->value.dval);
+ cpdf_setflat((int) arg2->value.dval);
RETURN_TRUE;
}
@@ -1232,187 +1319,323 @@
}
/* }}} */
-/* {{{ proto void cpdf_moveto(int pdfdoc, double x, double y)
+/* {{{ proto void cpdf_moveto(int pdfdoc, double x, double y[, int mode])
Sets current point */
void php3_cpdf_moveto(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3;
- int id, type;
+ pval *argv[4];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 3) || (argc > 4))
+ WRONG_PARAM_COUNT;
+ if (getParametersArray(ht, argc, argv) == FAILURE)
WRONG_PARAM_COUNT;
+
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ id=argv[0]->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
}
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- id=arg1->value.lval;
+ if(argc > 3) {
+ convert_to_long(argv[3]);
+ mode = argv[3]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawMoveto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
+ else
+ cpdf_moveto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto void cpdf_rmoveto(int pdfdoc, double x, double y[, int mode])
+ Sets current point */
+void php3_cpdf_rmoveto(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *argv[4];
+ int id, type, argc, mode=0;
+ int *pdf;
+ CPDF_TLS_VARS;
+
+ argc = ARG_COUNT(ht);
+ if((argc < 3) || (argc > 4))
+ WRONG_PARAM_COUNT;
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
+
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- cpdf_rawMoveto((float) arg2->value.dval, (float) arg3->value.dval);
+ if(argc > 3) {
+ convert_to_long(argv[3]);
+ mode = argv[3]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawRmoveto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
+ else
+ cpdf_rmoveto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
RETURN_TRUE;
}
/* }}} */
-/* {{{ proto void cpdf_curveto(int pdfdoc, double x1, double y1, double x2, double y2, double x3,
double y3)
+/* {{{ proto void cpdf_curveto(int pdfdoc, double x1, double y1, double x2, double y2, double x3,
double y3[, int mode])
Draws a curve */
void php3_cpdf_curveto(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4, *arg5, *arg6, *arg7;
- int id, type;
+ pval *argv[8];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 7 || getParameters(ht, 7, &arg1, &arg2, &arg3, &arg4,
&arg5, &arg6, &arg7) == FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 7) || (argc > 8))
WRONG_PARAM_COUNT;
- }
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- convert_to_double(arg5);
- convert_to_double(arg6);
- convert_to_double(arg7);
- id=arg1->value.lval;
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ convert_to_double(argv[4]);
+ convert_to_double(argv[5]);
+ convert_to_double(argv[6]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- cpdf_rawCurveto((float) arg2->value.dval,
- (float) arg3->value.dval,
- (float) arg4->value.dval,
- (float) arg5->value.dval,
- (float) arg6->value.dval,
- (float) arg7->value.dval);
+ if(argc > 7) {
+ convert_to_long(argv[7]);
+ mode = argv[7]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawCurveto((float) argv[1]->value.dval,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ (float) argv[5]->value.dval,
+ (float) argv[6]->value.dval);
+ else
+ cpdf_curveto((float) argv[1]->value.dval,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ (float) argv[5]->value.dval,
+ (float) argv[6]->value.dval);
RETURN_TRUE;
}
/* }}} */
-/* {{{ proto void cpdf_lineto(int pdfdoc, double x, double y)
+/* {{{ proto void cpdf_lineto(int pdfdoc, double x, double y[, int mode])
Draws a line */
void php3_cpdf_lineto(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3;
- int id, type;
+ pval *argv[4];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 3) || (argc > 4))
WRONG_PARAM_COUNT;
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
+
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ id=argv[0]->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
}
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- id=arg1->value.lval;
+ if(argc > 3) {
+ convert_to_long(argv[3]);
+ mode = argv[3]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawLineto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
+ else
+ cpdf_lineto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto void cpdf_rlineto(int pdfdoc, double x, double y[, int mode])
+ Draws a line relative to current point*/
+void php3_cpdf_rlineto(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *argv[4];
+ int id, type, argc, mode=0;
+ int *pdf;
+ CPDF_TLS_VARS;
+
+ argc = ARG_COUNT(ht);
+ if((argc < 3) || (argc > 4))
+ WRONG_PARAM_COUNT;
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
+
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- cpdf_rawLineto((float) arg2->value.dval, (float) arg3->value.dval);
+ if(argc > 3) {
+ convert_to_long(argv[3]);
+ mode = argv[3]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawRlineto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
+ else
+ cpdf_rlineto((float) argv[1]->value.dval, (float) argv[2]->value.dval);
RETURN_TRUE;
}
/* }}} */
-/* {{{ proto void cpdf_circle(int pdfdoc, double x, double y, double radius)
+/* {{{ proto void cpdf_circle(int pdfdoc, double x, double y, double radius[, int mode])
Draws a circle */
void php3_cpdf_circle(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4;
- int id, type;
+ pval *argv[5];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) ==
FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 4) || (argc > 5))
WRONG_PARAM_COUNT;
- }
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- id=arg1->value.lval;
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- cpdf_rawCircle((float) arg2->value.dval, (float) arg3->value.dval, (float)
arg4->value.dval);
+ if(argc > 4) {
+ convert_to_long(argv[4]);
+ mode = argv[4]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawCircle((float) argv[1]->value.dval, (float) argv[2]->value.dval, (float)
argv[3]->value.dval);
+ else
+ cpdf_circle((float) argv[1]->value.dval, (float) argv[2]->value.dval, (float)
argv[3]->value.dval);
RETURN_TRUE;
}
/* }}} */
-/* {{{ proto void cpdf_arc(int pdfdoc, double x, double y, double radius, double start, double end)
+/* {{{ proto void cpdf_arc(int pdfdoc, double x, double y, double radius, double start, double
end[, int mode])
Draws an arc */
void php3_cpdf_arc(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
- int id, type;
+ pval *argv[7];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 6 || getParameters(ht, 6, &arg1, &arg2, &arg3, &arg4,
&arg5, &arg6) == FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 6) || (argc > 7))
WRONG_PARAM_COUNT;
- }
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- convert_to_double(arg5);
- convert_to_double(arg6);
- id=arg1->value.lval;
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ convert_to_double(argv[4]);
+ convert_to_double(argv[5]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- cpdf_arc((float) arg2->value.dval, (float) arg3->value.dval, (float) arg4->value.dval,
(float) arg5->value.dval, (float) arg6->value.dval, 1);
+ if(argc > 6) {
+ convert_to_long(argv[6]);
+ mode = argv[6]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawArc((float) argv[1]->value.dval, (float) argv[2]->value.dval, (float)
argv[3]->value.dval, (float) argv[4]->value.dval, (float) argv[5]->value.dval, 1);
+ else
+ cpdf_arc((float) argv[1]->value.dval, (float) argv[2]->value.dval, (float)
argv[3]->value.dval, (float) argv[4]->value.dval, (float) argv[5]->value.dval, 1);
RETURN_TRUE;
}
/* }}} */
-/* {{{ proto void cpdf_rect(int pdfdoc, double x, double y, double width, double height)
+/* {{{ proto void cpdf_rect(int pdfdoc, double x, double y, double width, double height[, int
mode])
Draws a rectangle */
void php3_cpdf_rect(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4, *arg5;
- int id, type;
+ pval *argv[6];
+ int id, type, argc, mode=0;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4,
&arg5) == FAILURE) {
+ argc = ARG_COUNT(ht);
+ if((argc < 5) || (argc > 6))
WRONG_PARAM_COUNT;
- }
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
- convert_to_long(arg1);
- convert_to_double(arg2);
- convert_to_double(arg3);
- convert_to_double(arg4);
- convert_to_double(arg5);
- id=arg1->value.lval;
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ convert_to_double(argv[4]);
+ id=argv[0]->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php3_error(E_WARNING,"Unable to find file identifier %d",id);
RETURN_FALSE;
}
- cpdf_rawRect((float) arg2->value.dval,
- (float) arg3->value.dval,
- (float) arg4->value.dval,
- (float) arg5->value.dval);
+ if(argc > 5) {
+ convert_to_long(argv[5]);
+ mode = argv[5]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawRect((float) argv[1]->value.dval,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval);
+ else
+ cpdf_rect((float) argv[1]->value.dval,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval);
RETURN_TRUE;
}
@@ -1798,15 +2021,15 @@
}
/* }}} */
-/* {{{ proto void cpdf_set_transition(int pdfdoc, int transition, double duration, double
direction)
+/* {{{ proto void cpdf_set_transition(int pdfdoc, int transition, double duration, double
direction, int orientation, int inout)
Sets transition between pages */
void php3_cpdf_set_transition(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3, *arg4;
+ pval *arg1, *arg2, *arg3, *arg4, *arg5, *arg6;
int id, type;
int *pdf;
CPDF_TLS_VARS;
- if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) ==
FAILURE) {
+ if (ARG_COUNT(ht) != 6 || getParameters(ht, 6, &arg1, &arg2, &arg3, &arg4,
&arg5, &arg6) == FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -1814,6 +2037,8 @@
convert_to_long(arg2);
convert_to_double(arg3);
convert_to_double(arg4);
+ convert_to_long(arg5);
+ convert_to_long(arg6);
id=arg1->value.lval;
pdf = php3_list_find(id,&type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
@@ -1821,7 +2046,8 @@
RETURN_FALSE;
}
- cpdf_setPageTransition(arg2->value.lval, arg3->value.dval, arg4->value.dval, 0, 0);
+ cpdf_setPageTransition(arg2->value.lval, arg3->value.dval, arg4->value.dval,
+ arg5->value.lval, arg6->value.lval);
RETURN_TRUE;
}
@@ -1908,6 +2134,133 @@
}
cpdf_savePDFmemoryStreamToFile(arg2->value.str.val);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto void cpdf_import_jpeg(int pdfdoc, string filename, double x, double y, double angle,
double width, double height, double x-scale, double y-scale, int gsave[, int mode])
+ Includes jpeg image */
+void php3_cpdf_import_jpeg(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *argv[11];
+ int id, type, argc, mode=0;
+ float width, height, xscale, yscale;
+ int *pdf;
+ CPDF_TLS_VARS;
+
+ argc = ARG_COUNT(ht);
+ if((argc < 10) || (argc > 11))
+ WRONG_PARAM_COUNT;
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
+
+ convert_to_long(argv[0]);
+ convert_to_string(argv[1]);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ convert_to_double(argv[4]);
+ convert_to_double(argv[5]);
+ width = (float) argv[5]->value.dval;
+ convert_to_double(argv[6]);
+ height = (float) argv[6]->value.dval;
+ convert_to_double(argv[7]);
+ xscale = (float) argv[7]->value.dval;
+ convert_to_double(argv[8]);
+ yscale = (float) argv[8]->value.dval;
+ convert_to_long(argv[9]);
+ id=argv[0]->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ if(argc > 10) {
+ convert_to_long(argv[10]);
+ mode = argv[10]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawImportImage(argv[1]->value.str.val,
+ JPEG_IMG,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ &width,
+ &height,
+ &xscale,
+ &yscale,
+ argv[9]->value.lval);
+ else
+ cpdf_rawImportImage(argv[1]->value.str.val,
+ JPEG_IMG,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ &width,
+ &height,
+ &xscale,
+ &yscale,
+ argv[9]->value.lval);
+
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto void cpdf_set_annotation(int pdfdoc, double xll, double yll, double xur, double xur,
string title, string text[, int mode])
+ Sets annotation */
+void php3_cpdf_set_annotation(INTERNAL_FUNCTION_PARAMETERS) {
+ pval *argv[11];
+ int id, type, argc, mode=0;
+ int *pdf;
+ CPDFannotAttrib attrib;
+ CPDF_TLS_VARS;
+
+ argc = ARG_COUNT(ht);
+ if((argc < 7) || (argc > 8))
+ WRONG_PARAM_COUNT;
+ if (getParametersArray(ht, argc, argv) == FAILURE)
+ WRONG_PARAM_COUNT;
+
+ convert_to_long(argv[0]);
+ convert_to_double(argv[1]);
+ convert_to_double(argv[2]);
+ convert_to_double(argv[3]);
+ convert_to_double(argv[4]);
+ convert_to_string(argv[5]);
+ convert_to_string(argv[6]);
+ id=argv[0]->value.lval;
+ pdf = php3_list_find(id,&type);
+ if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
+ php3_error(E_WARNING,"Unable to find file identifier %d",id);
+ RETURN_FALSE;
+ }
+
+ attrib.flags = AF_NOZOOM | AF_NOROTATE | AF_READONLY;
+ attrib.border_array = "[0 0 1 [4 2]]";
+ attrib.BS = NULL;
+ attrib.r = 1.00;
+ attrib.g = 1.00;
+ attrib.b = 1.00;
+ if(argc > 7) {
+ convert_to_long(argv[7]);
+ mode = argv[7]->value.lval;
+ }
+ if(mode == 1)
+ cpdf_rawSetAnnotation((float) argv[1]->value.dval,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ argv[5]->value.str.val,
+ argv[6]->value.str.val,
+ &attrib);
+ else
+ cpdf_setAnnotation((float) argv[1]->value.dval,
+ (float) argv[2]->value.dval,
+ (float) argv[3]->value.dval,
+ (float) argv[4]->value.dval,
+ argv[5]->value.str.val,
+ argv[6]->value.str.val,
+ &attrib);
RETURN_TRUE;
}
Index: php3/functions/php3_cpdf.h
diff -u php3/functions/php3_cpdf.h:1.3 php3/functions/php3_cpdf.h:1.4
--- php3/functions/php3_cpdf.h:1.3 Fri May 21 07:07:51 1999
+++ php3/functions/php3_cpdf.h Wed May 26 15:03:32 1999
@@ -26,7 +26,7 @@
| Authors: Uwe Steinmann |
+----------------------------------------------------------------------+
*/
-/* $Id: php3_cpdf.h,v 1.3 1999/05/21 11:07:51 steinm Exp $ */
+/* $Id: php3_cpdf.h,v 1.4 1999/05/26 19:03:32 steinm Exp $ */
#ifndef _PHP3_CPDF_H
#define _PHP3_CPDF_H
@@ -48,6 +48,8 @@
extern void php3_cpdf_open(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_close(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_page_init(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_cpdf_finalize_page(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_cpdf_set_current_page(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_begin_text(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_end_text(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_show(INTERNAL_FUNCTION_PARAMETERS);
@@ -77,8 +79,10 @@
extern void php3_cpdf_setlinewidth(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_setdash(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_moveto(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_cpdf_rmoveto(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_curveto(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_lineto(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_cpdf_rlineto(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_circle(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_arc(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_rect(INTERNAL_FUNCTION_PARAMETERS);
@@ -101,6 +105,8 @@
extern void php3_cpdf_finalize(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_get_buffer(INTERNAL_FUNCTION_PARAMETERS);
extern void php3_cpdf_save_to_file(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_cpdf_set_annotation(INTERNAL_FUNCTION_PARAMETERS);
+extern void php3_cpdf_import_jpeg(INTERNAL_FUNCTION_PARAMETERS);
#else
#define cpdf_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