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.
 
 
 
 
 
 

102 regels
3.8 KiB

  1. <?php header("Content-Type: text/html; charset=utf-8"); ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="GENERATOR" content="vim" />
  8. <meta name="Author" content="sam@zoy.org (Sam Hocevar)" />
  9. <meta name="Description" content="Libcaca study - Source code" />
  10. <meta name="Keywords" content="libcaca, ASCII, ASCII ART, console, text mode, ncurses, slang, AAlib, dithering, thresholding" />
  11. <title>Libcaca study - Source code</title>
  12. <link rel="icon" type="image/x-icon" href="/favicon.ico" />
  13. <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
  14. <link rel="stylesheet" type="text/css" href="/main.css" />
  15. <style type="text/css">
  16. .comment { color: #38d; }
  17. .string { color: #c33; }
  18. .const { color: #33a; }
  19. .keyword { color: #3a3; }
  20. .number { color: #c3c; }
  21. </style>
  22. </head>
  23. <body>
  24. <?php include($_SERVER["DOCUMENT_ROOT"]."/header.inc"); ?>
  25. <p> <span style="color: #aa0000; font-weight: bold;">Warning</span>: this
  26. document is still work in progress. Feel free to send comments but do not
  27. consider it final material. </p>
  28. <div style="float: left;">
  29. <a href="biblio.html">Bibliography &lt;&lt;&lt;</a>
  30. </div>
  31. <!--<div style="float: right;">
  32. <a href=""></a>
  33. </div>-->
  34. <div style="text-align: center;">
  35. <a href="index.html">^^^ Index</a>
  36. </div>
  37. <h2> Source code </h2>
  38. <p> This is the full Python source code to all examples presented in this
  39. document. It can also be downloaded as a standalone <tt><a
  40. href="study.py">study.py</a></tt> Python program. </p>
  41. <p> Just install the <tt>python-gd</tt> package on your favourite operating
  42. system and run the script. With the exception of the <a
  43. href="http://www.cs.cmu.edu/~chuck/lennapg/">original colour 512×512 Lena
  44. image</a>, all Lena images and gradients were generated from this program. If
  45. you have installed Inkscape, many graphics such as dither matrices will also
  46. be automatically generated. </p>
  47. <p> Many algorithms implemented here will seem rather inefficient to people
  48. used to writing image processing software. This is because clarity was almost
  49. always preferred over performance. We believe this document to be of important
  50. value to many researchers in the field, because it implements methods for which
  51. there is no public implementation. </p>
  52. <pre style="background-color: white; border: solid black 1px;
  53. padding: 10px; text-indent: 0em;"><?php
  54. $s = file($_SERVER["DOCUMENT_ROOT"]."/study/study.py");
  55. foreach ($s as $i => $l) {
  56. if(ereg('temporary cruft', $l))
  57. break;
  58. $l = htmlspecialchars($l);
  59. $c = 0;
  60. $l = preg_replace('/#[^0-9a-f].*/', '<span class="comment">\\0</span>',
  61. $l, -1, $c);
  62. if($c <= 0) {
  63. $l = preg_replace('/(&quot;.*&quot;|\\\\$)/',
  64. '<span class="string">\\0</span>', $l);
  65. $l = ereg_replace('[A-Z][A-Z][A-Z0-9_]*',
  66. '<span class="const">\\0</span>', $l);
  67. $l = preg_replace('/\b(for|def|in|return|while|if|elif|else|class |True|False|None|break|continue|and|or|not|print|global|import|try|catch|yield)\b/',
  68. '<span class="keyword">\\0</span>', $l);
  69. $l = preg_replace('/\b([0-9]+[.][0-9]*|[0-9]*[.][0-9]+|[0-9]+)\b/',
  70. '<span class="number">\\0</span>', $l);
  71. }
  72. echo $l;
  73. }
  74. ?></pre>
  75. <div style="float: left;">
  76. <a href="biblio.html">Bibliography &lt;&lt;&lt;</a>
  77. </div>
  78. <!--<div style="float: right;">
  79. <a href=""></a>
  80. </div>-->
  81. <div style="text-align: center;">
  82. <a href="index.html">^^^ Index</a>
  83. </div>
  84. <?php $rev = '$Id$';
  85. include($_SERVER['DOCUMENT_ROOT'].'/footer.inc'); ?>
  86. </body>
  87. </html>