Date: 06/26/98
- Next message: Christopher Curtis: "[PHP-DEV] Re: Bug #411 Updated: Segmentation fault w/fopen wrappers (update)"
- Previous message: ssb: "[PHP-DEV] CVS update: php31/ext/oracle"
- Next in thread: zeev: "[PHP-DEV] CVS update: php31/ext/gd"
- Maybe reply: zeev: "[PHP-DEV] CVS update: php31/ext/gd"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Friday June 26, 1998 @ 9:29
Author: ssb
Update of /repository/php31/ext/gd
In directory asf:/tmp/cvs-serv7371
Modified Files:
gd.c gdttf.c
Log Message:
apply GD changes
Index: php31/ext/gd/gd.c
diff -c php31/ext/gd/gd.c:1.1.1.1 php31/ext/gd/gd.c:1.2
*** php31/ext/gd/gd.c:1.1.1.1 Tue May 26 22:26:54 1998
--- php31/ext/gd/gd.c Fri Jun 26 09:29:21 1998
***************
*** 29,35 ****
+----------------------------------------------------------------------+
*/
! /* $Id: gd.c,v 1.1.1.1 1998/05/27 02:26:54 rasmus Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
--- 29,35 ----
+----------------------------------------------------------------------+
*/
! /* $Id: gd.c,v 1.2 1998/06/26 13:29:21 ssb Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
***************
*** 71,76 ****
--- 71,78 ----
#define M_PI 3.14159265358979323846
#endif
+ static void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int);
+
#ifdef THREAD_SAFE
DWORD GDlibTls;
static int numthreads=0;
***************
*** 128,133 ****
--- 130,136 ----
{"imagesy", php3_imagesyfn, NULL},
{"imagedashedline", php3_imagedashedline, NULL},
#if HAVE_LIBTTF
+ {"imagettfbbox", php3_imagettfbbox, NULL},
{"imagettftext", php3_imagettftext, NULL},
#endif
{NULL, NULL, NULL}
***************
*** 1393,1400 ****
--- 1396,1418 ----
}
#if HAVE_LIBTTF
+
+ #define TTFTEXT_DRAW 0
+ #define TTFTEXT_BBOX 1
+
+ void php3_imagettfbbox(INTERNAL_FUNCTION_PARAMETERS)
+ {
+ php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX);
+ }
+
void php3_imagettftext(INTERNAL_FUNCTION_PARAMETERS)
{
+ php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW);
+ }
+
+ static
+ void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode)
+ {
pval *IM, *PTSIZE, *ANGLE, *X, *Y, *C, *FONTNAME, *COL;
gdImagePtr im;
int col, x, y, l=0, i;
***************
*** 1407,1440 ****
GD_TLS_VARS;
! if (ARG_COUNT(ht) != 8 ||
! getParameters(ht, 8, &IM, &PTSIZE, &ANGLE, &X, &Y, &COL, &FONTNAME, &C) == FAILURE) {
! WRONG_PARAM_COUNT;
}
- convert_to_long(IM);
convert_to_double(PTSIZE);
convert_to_double(ANGLE);
- convert_to_long(X);
- convert_to_long(Y);
- convert_to_long(COL);
convert_to_string(FONTNAME);
convert_to_string(C);
- y = Y->value.lval;
- x = X->value.lval;
ptsize = PTSIZE->value.dval;
angle = ANGLE->value.dval * (M_PI/180); /* convert to radians */
- col = COL->value.lval;
string = (unsigned char *) C->value.str.val;
l = strlen(string);
fontname = (unsigned char *) FONTNAME->value.str.val;
! im = php3_list_find(IM->value.lval, &ind_type);
! if (!im || ind_type != GD_GLOBAL(le_gd)) {
! php3_error(E_WARNING, "Unable to find image pointer");
! RETURN_FALSE;
}
str = (int *)emalloc(l * sizeof(int));
--- 1425,1473 ----
GD_TLS_VARS;
! if (mode == TTFTEXT_BBOX) {
! if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &PTSIZE, &ANGLE, &FONTNAME, &C) == FAILURE) {
! WRONG_PARAM_COUNT;
! }
! } else {
! if (ARG_COUNT(ht) != 8 || getParameters(ht, 8, &IM, &PTSIZE, &ANGLE, &X, &Y, &COL, &FONTNAME, &C) == FAILURE) {
! WRONG_PARAM_COUNT;
! }
}
convert_to_double(PTSIZE);
convert_to_double(ANGLE);
convert_to_string(FONTNAME);
convert_to_string(C);
+ if (mode == TTFTEXT_BBOX) {
+ IM->type = IS_LONG;
+ IM->value.lval = -1;
+ col = x = y = -1;
+ } else {
+ convert_to_long(X);
+ convert_to_long(Y);
+ convert_to_long(IM);
+ convert_to_long(COL);
+ col = COL->value.lval;
+ y = Y->value.lval;
+ x = X->value.lval;
+ }
ptsize = PTSIZE->value.dval;
angle = ANGLE->value.dval * (M_PI/180); /* convert to radians */
string = (unsigned char *) C->value.str.val;
l = strlen(string);
fontname = (unsigned char *) FONTNAME->value.str.val;
! if (mode == TTFTEXT_BBOX) {
! im = NULL;
! } else {
! im = php3_list_find(IM->value.lval, &ind_type);
! if (!im || ind_type != GD_GLOBAL(le_gd)) {
! php3_error(E_WARNING, "Unable to find image pointer");
! RETURN_FALSE;
! }
}
str = (int *)emalloc(l * sizeof(int));
***************
*** 1452,1465 ****
efree(str);
}
-
if (error) {
php3_error(E_WARNING, error);
RETURN_FALSE;
}
! RETURN_TRUE;
}
#endif
#endif
--- 1485,1504 ----
efree(str);
}
if (error) {
php3_error(E_WARNING, error);
RETURN_FALSE;
}
! if (array_init(return_value) == FAILURE) {
! RETURN_FALSE;
! }
!
! /* return array with the text's bounding box */
! for (i = 0; i < 8; i++) {
! add_next_index_long(return_value, brect[i]);
! }
}
#endif
#endif
Index: php31/ext/gd/gdttf.c
diff -c php31/ext/gd/gdttf.c:1.1.1.1 php31/ext/gd/gdttf.c:1.2
*** php31/ext/gd/gdttf.c:1.1.1.1 Tue May 26 22:26:54 1998
--- php31/ext/gd/gdttf.c Fri Jun 26 09:29:21 1998
***************
*** 680,682 ****
--- 680,689 ----
}
#endif /* HAVE_LIBTTF */
+
+ /*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ */
- Next message: Christopher Curtis: "[PHP-DEV] Re: Bug #411 Updated: Segmentation fault w/fopen wrappers (update)"
- Previous message: ssb: "[PHP-DEV] CVS update: php31/ext/oracle"
- Next in thread: zeev: "[PHP-DEV] CVS update: php31/ext/gd"
- Maybe reply: zeev: "[PHP-DEV] CVS update: php31/ext/gd"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

