- Timestamp:
- Oct 27, 2008, 6:15:08 PM (12 years ago)
- Location:
- libcaca/trunk/caca-php
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca-php/php_caca.c
r3119 r3120 88 88 PHP_FE(caca_create_frame, NULL) 89 89 PHP_FE(caca_free_frame, NULL) 90 PHP_FE(caca_create_dither, NULL) 90 91 PHP_FE(caca_set_dither_palette, NULL) 91 92 PHP_FE(caca_set_dither_brightness, NULL) … … 934 935 } 935 936 937 PHP_FUNCTION(caca_create_dither) { 938 long bpp, w, h, pitch, rmask, gmask, bmask, amask = 0; 939 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llllllll", &bpp, &w, &h, &pitch, &rmask, &gmask, &bmask, &amask) == FAILURE) { 940 RETURN_FALSE; 941 } 942 caca_dither_t *dither = caca_create_dither(bpp, w, h, pitch, rmask, gmask, bmask, amask); 943 ZEND_REGISTER_RESOURCE(return_value, dither, le_caca_dither); 944 } 945 936 946 PHP_FUNCTION(caca_set_dither_palette) { 937 947 } … … 1137 1147 1138 1148 PHP_FUNCTION(caca_dither_bitmap_gd) { 1139 zval *_zval; 1140 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &_zval) == FAILURE) { 1141 RETURN_FALSE; 1142 } 1143 gdImage *img = fetch_external_resource(_zval, "gd"); 1144 if (img) { 1145 printf("image size: %i x %i\n", img->sx, img->sy); 1149 zval *_zval1, *_zval2, *_zval3; 1150 long x, y, w, h = 0; 1151 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllrr", &_zval1, &x, &y, &w, &h, &_zval2, &_zval3) == FAILURE) { 1152 RETURN_FALSE; 1153 } 1154 1155 caca_canvas_t *canvas; 1156 ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval1, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas); 1157 caca_dither_t *dither; 1158 ZEND_FETCH_RESOURCE(dither, caca_dither_t*, &_zval2, -1, PHP_CACA_DITHER_RES_NAME, le_caca_dither); 1159 1160 gdImage *img = fetch_external_resource(_zval3, "gd"); 1161 if (!img) { 1162 RETURN_FALSE; 1163 } 1164 1165 printf("image size: %i x %i\n", img->sx, img->sy); 1166 if (img->trueColor) { 1167 printf("image is true color\n"); 1168 RETURN_SUCCESS(caca_dither_bitmap(canvas, x, y, w, h, dither, (void *) *(img->tpixels))); 1146 1169 } 1147 1170 } -
libcaca/trunk/caca-php/php_caca.h
r3119 r3120 105 105 PHP_FUNCTION(caca_create_frame); 106 106 PHP_FUNCTION(caca_free_frame); 107 PHP_FUNCTION(caca_create_dither); 107 108 PHP_FUNCTION(caca_set_dither_palette); 108 109 PHP_FUNCTION(caca_set_dither_brightness);
Note: See TracChangeset
for help on using the changeset viewer.