Changeset 4333 for libcaca/trunk/caca-php/examples/truecolor.php
- Timestamp:
- Feb 8, 2010, 2:27:22 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/caca-php/examples/truecolor.php
r4148 r4333 2 2 <?php 3 3 /* 4 * truecolor 4 * truecolor truecolor canvas features 5 5 * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com> 6 6 * 7 7 * This file is a Php port of "examples/truecolor.c" 8 * which is: 8 * which is: 9 9 * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net> 10 * All Rights Reserved 11 * 12 * $Id$ 10 * All Rights Reserved 13 11 * 14 12 * This program is free software. It comes without any warranty, to … … 20 18 21 19 if (php_sapi_name() != "cli") { 22 20 die("You have to run this program with php-cli!\n"); 23 21 } 24 22 25 23 $cv = caca_create_canvas(32, 16); 26 24 if(!$cv) { 27 25 die("Failed to create canvas\n"); 28 26 } 29 27 30 28 $dp = caca_create_display($cv); 31 29 if(!$dp) { 32 30 die("Failed to create display\n"); 33 31 } 34 32 35 33 for($y = 0; $y < 16; $y++) 36 37 38 39 40 41 42 43 34 for($x = 0; $x < 16; $x++) 35 { 36 $bgcolor = 0xff00 | ($y << 4) | $x; 37 $fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8); 38 39 caca_set_color_argb($cv, $fgcolor, $bgcolor); 40 caca_put_str($cv, $x * 2, $y, "CA"); 41 } 44 42 45 43 caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE);
Note: See TracChangeset
for help on using the changeset viewer.