Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. * demo.php demo for libcaca php binding
  10. * Copyright (c) 2008 Nicolas Vion <nico@yojik.eu>
  11. *
  12. * This file is a Php port of the official libcaca's sample program "demo.c"
  13. * which is:
  14. * Copyright (c) 2003 Sam Hocevar <sam@zoy.org>
  15. *
  16. * This program is free software. It comes without any warranty, to
  17. * the extent permitted by applicable law. You can redistribute it
  18. * and/or modify it under the terms of the Do What The Fuck You Want
  19. * To Public License, Version 2, as published by Sam Hocevar. See
  20. * http://sam.zoy.org/wtfpl/COPYING for more details.
  21. */
  22. ?>
  23. <head>
  24. <title>demo for libcaca php binding</title>
  25. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  26. </head>
  27. <body text="silver" bgcolor="black">
  28. <?php
  29. $string = <<<EOT
  30. |_|
  31. _,----._ | |
  32. (/ @ @ \) __
  33. | OO | |_
  34. \ `--' / |__
  35. `----'
  36. |_|
  37. Hello world! |
  38. EOT;
  39. $pig = caca_create_canvas(0, 0);
  40. caca_import_string($pig, $string, "text");
  41. $cv = caca_create_canvas(caca_get_canvas_width($pig) * 2, caca_get_canvas_height($pig) * 2);
  42. if (!$cv or !$pig) {
  43. die("Can't created canvas\n");
  44. }
  45. caca_blit($cv, 0, 0, $pig);
  46. caca_flip($pig);
  47. caca_blit($cv, caca_get_canvas_width($pig), 0, $pig);
  48. caca_flip($pig);
  49. caca_flop($pig);
  50. caca_blit($cv, 0, caca_get_canvas_height($pig), $pig);
  51. caca_flop($pig);
  52. caca_rotate_180($pig);
  53. caca_blit($cv, caca_get_canvas_width($pig), caca_get_canvas_height($pig), $pig);
  54. for($j = 0; $j < caca_get_canvas_height($cv); $j++) {
  55. for($i = 0; $i < caca_get_canvas_width($cv); $i += 2) {
  56. caca_set_color_ansi($cv, CACA_LIGHTBLUE + ($i + $j) % 6, CACA_DEFAULT);
  57. $a = caca_get_attr($cv, -1, -1);
  58. caca_put_attr($cv, $i, $j, $a);
  59. caca_put_attr($cv, $i + 1, $j, $a);
  60. }
  61. }
  62. echo caca_export_string($cv, "html3");
  63. caca_rotate_left($cv);
  64. echo caca_export_string($cv, "html3");
  65. ?>
  66. </body>
  67. </html>