Ignore:
Timestamp:
Oct 27, 2008, 8:14:32 PM (14 years ago)
Author:
nico
Message:
  • Add working sample program dithering.php (open logo-caca.png with Gd and render it with caca caca_dither_bitmap_gd)
  • Add a function to fetch a buffer of gd pixels in php_caca.c
Location:
libcaca/trunk/caca-php/examples
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/examples/dithering.php

    r3120 r3122  
    22<?
    33$img = imagecreatefrompng(dirname(__FILE__)."/logo-caca.png");
    4 //$img = imagecreatefromjpeg("/home/nicolas/images/Clown Fish-mini.jpg");
    54$canvas = caca_create_canvas(0, 0);
    65
    7 $dither = caca_create_dither(16, 128, 128, 3 * 256, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000);
    8 caca_set_dither_gamma($dither, -1.0);
     6$dither = caca_create_dither(32, 128, 128, 4 * 128, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000);
    97
    10 if (caca_dither_bitmap_gd($canvas, 0, 0, 30, 30, $dither, $img)) {
    11         $dp = caca_create_display($canvas);
    12         caca_refresh_display($dp);
    13         sleep(5);
    14 }
     8$display = caca_create_display($canvas);
     9caca_set_display_time($display, 80000);
    1510
     11caca_dither_bitmap_gd($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img);
     12caca_refresh_display($display);
     13
     14sleep(5);
     15
     16
     17
     18
Note: See TracChangeset for help on using the changeset viewer.