Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

109 rader
3.1 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. * transform transformation test program
  10. * Copyright (c) 2008 Benjamin C. Wiley Sittler <bsittler@gmail.com>
  11. *
  12. * This file is a Php port of "examples/transform.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>transformation test program</title>
  28. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  29. </head>
  30. <body text="silver" bgcolor="black">
  31. <?php
  32. $pig = (
  33. ",--. ,--.\n" .
  34. "\\ /-~-\\ /\n" .
  35. " )' o O `(\n" .
  36. "( ,---. )\n" .
  37. " `(_o_o_)'\n" .
  38. " )`-'(\n");
  39. $duck = (
  40. " ,~~.\n" .
  41. " __ , ( O )>\n" .
  42. "___( o)> )`~~' (\n" .
  43. "\\ <_. ) ( .__) )\n" .
  44. " `---' `-.____,'\n");
  45. $cv = caca_create_canvas(80, 25);
  46. if(! $cv)
  47. {
  48. die("Can't created canvas\n");
  49. }
  50. $image = caca_create_canvas(70, 6);
  51. $tmp = caca_create_canvas(70, 6);
  52. $sprite = caca_create_canvas(0, 0);
  53. caca_set_color_ansi($sprite, CACA_LIGHTMAGENTA, CACA_BLACK);
  54. caca_import_string($sprite, $pig, "text");
  55. caca_blit($image, 55, 0, $sprite);
  56. caca_set_color_ansi($sprite, CACA_LIGHTGREEN, CACA_BLACK);
  57. caca_import_string($sprite, $duck, "text");
  58. caca_blit($image, 30, 1, $sprite);
  59. caca_set_color_ansi($image, CACA_LIGHTCYAN, CACA_BLACK);
  60. caca_put_str($image, 1, 1, "hahaha mais vieux porc immonde !! [⽼ ⾗]");
  61. caca_set_color_ansi($image, CACA_LIGHTRED, CACA_BLACK);
  62. caca_put_char($image, 38, 1, ord('|'));
  63. caca_set_color_ansi($image, CACA_YELLOW, CACA_BLACK);
  64. caca_put_str($image, 4, 2, "\\o\\ \\o| _o/ \\o_ |o/ /o/");
  65. caca_set_color_ansi($image, CACA_WHITE, CACA_LIGHTRED);
  66. caca_put_str($image, 7, 3, "▙▘▌▙▘▞▖▞▖▌ ▞▖▌ ▌▌");
  67. caca_put_str($image, 7, 4, "▛▖▌▛▖▚▘▚▘▚▖▚▘▚▖▖▖");
  68. caca_set_color_ansi($image, CACA_BLACK, CACA_LIGHTRED);
  69. caca_put_str($image, 4, 3, "▓▒░");
  70. caca_put_str($image, 4, 4, "▓▒░");
  71. caca_put_str($image, 24, 3, "░▒▓");
  72. caca_put_str($image, 24, 4, "░▒▓");
  73. /* Blit the transformed canvas onto the main canvas */
  74. caca_set_color_ansi($cv, CACA_WHITE, CACA_BLUE);
  75. caca_put_str($cv, 0, 0, "normal");
  76. caca_blit($cv, 10, 0, $image);
  77. caca_put_str($cv, 0, 6, "flip");
  78. caca_blit($tmp, 0, 0, $image);
  79. caca_flip($tmp);
  80. caca_blit($cv, 10, 6, $tmp);
  81. caca_put_str($cv, 0, 12, "flop");
  82. caca_blit($tmp, 0, 0, $image);
  83. caca_flop($tmp);
  84. caca_blit($cv, 10, 12, $tmp);
  85. caca_put_str($cv, 0, 18, "rotate");
  86. caca_blit($tmp, 0, 0, $image);
  87. caca_rotate_180($tmp);
  88. caca_blit($cv, 10, 18, $tmp);
  89. echo caca_export_string($cv, "html3");
  90. ?>
  91. </body>
  92. </html>