source: libcaca/trunk/caca-php/examples/dithering.php @ 3138

Last change on this file since 3138 was 3138, checked in by nico, 11 years ago
  • Add indexed colors image support for dither with gd resources
  • Property svn:executable set to *
File size: 661 bytes
Line 
1#!/usr/bin/php5
2<?php
3$img = imagecreatefrompng(dirname(__FILE__)."/logo-caca.png");
4//$img = imagecreatefromgif(dirname(__FILE__)."/logo-caca-idx.gif");
5if (!$img)
6        die("Can not open image.\n");
7
8$dither = caca_create_dither_gd($img);
9if (!$dither)
10        die("Can not create dither. Maybe this image is not truecolor.\n");
11
12$canvas = caca_create_canvas(0, 0);
13$display = caca_create_display($canvas);
14if (!$display)
15        die("Can not create display.\n");
16
17//caca_set_dither_palette_gd($dither, $img);
18caca_dither_bitmap_gd($canvas, 0, 0, caca_get_canvas_width($canvas), caca_get_canvas_height($canvas), $dither, $img);
19caca_refresh_display($display);
20
21sleep(5);
22
23?>
Note: See TracBrowser for help on using the repository browser.