Changeset 3123
- Timestamp:
- Oct 27, 2008, 8:35:48 PM (12 years ago)
- Location:
- libcaca/trunk/caca-php
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca-php/examples/dithering.php
r3122 r3123 2 2 <? 3 3 $img = imagecreatefrompng(dirname(__FILE__)."/logo-caca.png"); 4 $dither = caca_create_dither_gd($img); 5 if (!$dither) 6 die("Can not create dither. Maybe this image is not truecolor.\n"); 7 4 8 $canvas = caca_create_canvas(0, 0); 5 6 $dither = caca_create_dither(32, 128, 128, 4 * 128, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000);7 8 9 $display = caca_create_display($canvas); 9 caca_set_display_time($display, 80000); 10 if (!$dither) 11 die("Can not create display.\n"); 10 12 11 13 caca_dither_bitmap_gd($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img); -
libcaca/trunk/caca-php/php_caca.c
r3122 r3123 89 89 PHP_FE(caca_free_frame, NULL) 90 90 PHP_FE(caca_create_dither, NULL) 91 PHP_FE(caca_create_dither_gd, NULL) 91 92 PHP_FE(caca_set_dither_palette, NULL) 92 93 PHP_FE(caca_set_dither_brightness, NULL) … … 964 965 } 965 966 967 PHP_FUNCTION(caca_create_dither_gd) { 968 zval *_zval; 969 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &_zval) == FAILURE) { 970 RETURN_FALSE; 971 } 972 973 gdImage *img = fetch_external_resource(_zval, "gd"); 974 if (!img | !img->trueColor) { 975 RETURN_FALSE; 976 } 977 caca_dither_t *dither = caca_create_dither(sizeof(int) * 8, img->sx, img->sy, img->sx * sizeof(int), 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000); 978 ZEND_REGISTER_RESOURCE(return_value, dither, le_caca_dither); 979 } 980 966 981 PHP_FUNCTION(caca_set_dither_palette) { 967 982 } -
libcaca/trunk/caca-php/php_caca.h
r3120 r3123 106 106 PHP_FUNCTION(caca_free_frame); 107 107 PHP_FUNCTION(caca_create_dither); 108 PHP_FUNCTION(caca_create_dither_gd); 108 109 PHP_FUNCTION(caca_set_dither_palette); 109 110 PHP_FUNCTION(caca_set_dither_brightness);
Note: See TracChangeset
for help on using the changeset viewer.