Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

57 řádky
1.5 KiB

  1. <?php
  2. header('Content-Type: text/html; charset=UTF-8');
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  7. <?php
  8. /*
  9. * truecolor truecolor canvas features
  10. * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>
  11. *
  12. * This file is a Php port of "examples/truecolor.c"
  13. * which is:
  14. * Copyright (c) 2006 Sam Hocevar <sam@zoy.org>
  15. * All Rights Reserved
  16. *
  17. * $Id$
  18. *
  19. * This program is free software. It comes without any warranty, to
  20. * the extent permitted by applicable law. You can redistribute it
  21. * and/or modify it under the terms of the Do What The Fuck You Want
  22. * To Public License, Version 2, as published by Sam Hocevar. See
  23. * http://sam.zoy.org/wtfpl/COPYING for more details.
  24. */
  25. ?>
  26. <head>
  27. <title>truecolor canvas features</title>
  28. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  29. </head>
  30. <body text="silver" bgcolor="black">
  31. <?php
  32. $cv = caca_create_canvas(32, 16);
  33. if(!$cv) {
  34. die("Failed to create canvas\n");
  35. }
  36. for($y = 0; $y < 16; $y++)
  37. for($x = 0; $x < 16; $x++)
  38. {
  39. $bgcolor = 0xff00 | ($y << 4) | $x;
  40. $fgcolor = 0xf000 | ((15 - $y) << 4) | ((15 - $x) << 8);
  41. caca_set_color_argb($cv, $fgcolor, $bgcolor);
  42. caca_put_str($cv, $x * 2, $y, "CA");
  43. }
  44. caca_set_color_ansi($cv, CACA_WHITE, CACA_LIGHTBLUE);
  45. caca_put_str($cv, 2, 1, " truecolor libcaca ");
  46. echo caca_export_string($cv, "html3");
  47. ?>
  48. </body>
  49. </html>