You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

82 lines
2.2 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. * fullwidth libcaca fullwidth Unicode characters test program
  10. * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>
  11. *
  12. * This file is a Php port of "examples/fullwidth.c"
  13. * which is:
  14. * Copyright (c) 2006 Sam Hocevar <sam@hocevar.net>
  15. * All Rights Reserved
  16. *
  17. * This program is free software. It comes without any warranty, to
  18. * the extent permitted by applicable law. You can redistribute it
  19. * and/or modify it under the terms of the Do What the Fuck You Want
  20. * to Public License, Version 2, as published by Sam Hocevar. See
  21. * http://www.wtfpl.net/ for more details.
  22. */
  23. ?>
  24. <head>
  25. <title>sample program for libcaca php binding</title>
  26. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  27. </head>
  28. <body text="silver" bgcolor="black">
  29. <?php
  30. define('CACA', "쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊쫊");
  31. $cv = caca_create_canvas(36, 12);
  32. if(! $cv)
  33. {
  34. die("Can't created canvas\n");
  35. }
  36. $caca = caca_create_canvas(6, 10);
  37. $line = caca_create_canvas(2, 1);
  38. /* Line of x's */
  39. for($i = 0; $i < 10; $i++)
  40. {
  41. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  42. caca_put_str($caca, 0, $i, CACA);
  43. caca_set_color_ansi($caca, CACA_WHITE, CACA_RED);
  44. caca_put_char($caca, $i - 2, $i, ord('x'));
  45. }
  46. caca_blit($cv, 1, 1, $caca);
  47. /* Line of ホ's */
  48. for($i = 0; $i < 10; $i++)
  49. {
  50. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  51. caca_put_str($caca, 0, $i, CACA);
  52. caca_set_color_ansi($caca, CACA_WHITE, CACA_GREEN);
  53. caca_put_str($caca, $i - 2, $i, "ホ");
  54. }
  55. caca_blit($cv, 15, 1, $caca);
  56. /* Line of canvas */
  57. caca_set_color_ansi($line, CACA_WHITE, CACA_MAGENTA);
  58. caca_put_str($line, 0, 0, "ほ");
  59. for($i = 0; $i < 10; $i++)
  60. {
  61. caca_set_color_ansi($caca, CACA_WHITE, CACA_BLUE);
  62. caca_put_str($caca, 0, $i, CACA);
  63. caca_blit($caca, $i - 2, $i, $line);
  64. }
  65. caca_blit($cv, 29, 1, $caca);
  66. echo caca_export_string($cv, "html3");
  67. ?>
  68. </body>
  69. </html>