Changeset 3134 for libcaca/trunk/caca-php
- Timestamp:
- Oct 29, 2008, 12:13:15 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca-php/php_caca.c
r3132 r3134 427 427 FETCH_CANVAS(canvas); 428 428 RETURN_STRING((char *) caca_get_canvas_chars(canvas), 1); 429 //TODO: check that return \0 terminated string430 429 } 431 430 … … 434 433 FETCH_CANVAS(canvas); 435 434 RETURN_STRING((char *) caca_get_canvas_attrs(canvas), 1); 436 //TODO: check that return \0 terminated string437 435 } 438 436 … … 1021 1019 1022 1020 PHP_FUNCTION(caca_set_dither_palette) { 1021 zval *zval_res, *arr; 1022 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ra", &zval_res, &arr) == FAILURE) { 1023 RETURN_FALSE; 1024 } 1025 1026 caca_dither_t *dither; 1027 ZEND_FETCH_RESOURCE(dither, caca_dither_t*, &zval_res, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_dither); 1028 1029 uint32_t tbl[4][256]; 1030 zval **color, **value; 1031 int i, j; 1032 for (i = 0; i < 256; i++) { 1033 if (zend_hash_index_find(Z_ARRVAL_P(arr), i, (void**) &color) == FAILURE | Z_TYPE_P(*color) != IS_ARRAY) { 1034 RETURN_FALSE; 1035 } 1036 for (j = 0; j < 4; j++) { 1037 if (zend_hash_index_find(Z_ARRVAL_P(*color), j, (void**) &value) == FAILURE) { 1038 RETURN_FALSE; 1039 } 1040 convert_to_long_ex(value); 1041 tbl[j][i] = Z_LVAL_PP(value); 1042 } 1043 } 1044 RETURN_SUCCESS(caca_set_dither_palette(dither, &tbl[0][0], &tbl[1][0], &tbl[2][0], &tbl[3][0])); 1023 1045 } 1024 1046
Note: See TracChangeset
for help on using the changeset viewer.