Changeset 3107


Ignore:
Timestamp:
Oct 26, 2008, 2:49:09 AM (11 years ago)
Author:
nico
Message:
  • Add php bindings for functions: caca_draw_line & caca_draw_thin_line
  • Create a new sample file demo.php (php port of demo.c)
Location:
libcaca/trunk/caca-php
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/php_caca.c

    r3105 r3107  
    585585
    586586PHP_FUNCTION(caca_draw_line) {
     587        zval *_zval;
     588        char *str;
     589        long str_len, xa, ya, xb, yb = 0;
     590        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllls", &_zval, &xa, &ya, &xb, &yb, &str, &str_len) == FAILURE) {
     591                RETURN_FALSE;
     592        }
     593        caca_canvas_t *canvas;
     594        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
     595        if (str_len != 1) {
     596                RETURN_FALSE;
     597        }
     598        RETURN_BOOL(caca_draw_line(canvas, xa, ya, xb, yb, str[0]) == 0);
    587599}
    588600
     
    591603
    592604PHP_FUNCTION(caca_draw_thin_line) {
     605        zval *_zval;
     606        long xa, ya, xb, yb = 0;
     607        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll", &_zval, &xa, &ya, &xb, &yb) == FAILURE) {
     608                RETURN_FALSE;
     609        }
     610        caca_canvas_t *canvas;
     611        ZEND_FETCH_RESOURCE(canvas, caca_canvas_t*, &_zval, -1, PHP_CACA_CANVAS_RES_NAME, le_caca_canvas);
     612        RETURN_BOOL(caca_draw_thin_line(canvas, xa, ya, xb, yb) == 0);
    593613}
    594614
     
    854874        caca_display_t *display;
    855875        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
    856         RETURN_BOOL(caca_set_display(display, value) == 0);
     876        RETURN_BOOL(caca_set_mouse(display, value) == 0);
    857877}
    858878
Note: See TracChangeset for help on using the changeset viewer.