No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

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