doc/classes/Coco.src/M000464.html in ripxplore-0.12.0 vs doc/classes/Coco.src/M000464.html in ripxplore-0.13.0

- old
+ new

@@ -3,53 +3,16 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>to_screendump (Coco)</title> + <title>pixels_between_characters (Coco)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> - <pre><span class="ruby-comment cmt"># File lib/host_systems/Coco.rb, line 78</span> -<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_screendump</span>(<span class="ruby-identifier">text</span>,<span class="ruby-identifier">screen_width</span>) - <span class="ruby-identifier">lines</span>=<span class="ruby-identifier">split_into_lines</span>(<span class="ruby-identifier">text</span>,<span class="ruby-identifier">screen_width</span>) - <span class="ruby-identifier">canvas</span> = <span class="ruby-constant">PNG</span><span class="ruby-operator">::</span><span class="ruby-constant">Canvas</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">font_width</span><span class="ruby-operator">*</span><span class="ruby-identifier">screen_width</span>, (<span class="ruby-identifier">pixels_between_characters</span><span class="ruby-operator">+</span><span class="ruby-identifier">font_height</span>)<span class="ruby-operator">*</span>[<span class="ruby-identifier">lines</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">screen_rows</span>].<span class="ruby-identifier">max</span>, <span class="ruby-identifier">default_background_colour</span> - <span class="ruby-identifier">line_number</span>=<span class="ruby-value">0</span> - <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">col</span>=<span class="ruby-value">0</span> - <span class="ruby-identifier">line</span>.<span class="ruby-identifier">each_byte</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">char</span><span class="ruby-operator">|</span> - <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">char</span><span class="ruby-operator">&gt;=</span><span class="ruby-value">0x80</span>) <span class="ruby-keyword kw">then</span> - <span class="ruby-identifier">colour_mask</span>=((<span class="ruby-identifier">char</span> <span class="ruby-operator">&amp;</span> <span class="ruby-value">0</span><span class="ruby-identifier">b01110000</span>)<span class="ruby-operator">&gt;&gt;</span><span class="ruby-value">4</span>) - <span class="ruby-identifier">foreground_colour</span>=<span class="ruby-constant">COCO_COLOURS</span>[<span class="ruby-identifier">colour_mask</span>] - <span class="ruby-value">4</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">quadrant</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">quadrant_mask</span>=<span class="ruby-value">1</span><span class="ruby-operator">&lt;&lt;</span><span class="ruby-identifier">quadrant</span> - <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">char</span> <span class="ruby-operator">&amp;</span> <span class="ruby-identifier">quadrant_mask</span>)<span class="ruby-operator">&gt;</span><span class="ruby-value">0</span> <span class="ruby-keyword kw">then</span> - <span class="ruby-identifier">block_colour</span>=<span class="ruby-identifier">foreground_colour</span> - <span class="ruby-keyword kw">else</span> - <span class="ruby-identifier">block_colour</span>=<span class="ruby-constant">PNG</span><span class="ruby-operator">::</span><span class="ruby-constant">Color</span><span class="ruby-operator">::</span><span class="ruby-constant">Black</span> - <span class="ruby-keyword kw">end</span> - - <span class="ruby-identifier">start_x</span>=(<span class="ruby-identifier">col</span><span class="ruby-operator">*</span><span class="ruby-value">8</span>)<span class="ruby-operator">+</span><span class="ruby-constant">COCO_BLOCK_QUADRANT_OFFSETS</span>[<span class="ruby-identifier">quadrant</span>][<span class="ruby-value">0</span>] - <span class="ruby-identifier">start_y</span>=(<span class="ruby-identifier">line_number</span><span class="ruby-operator">*</span><span class="ruby-value">12</span>)<span class="ruby-operator">+</span><span class="ruby-constant">COCO_BLOCK_QUADRANT_OFFSETS</span>[<span class="ruby-identifier">quadrant</span>][<span class="ruby-value">1</span>] - <span class="ruby-value">6</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">y_offset</span><span class="ruby-operator">|</span> - <span class="ruby-value">4</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">x_offset</span><span class="ruby-operator">|</span> - <span class="ruby-identifier">canvas</span>[<span class="ruby-identifier">start_x</span><span class="ruby-operator">+</span><span class="ruby-identifier">x_offset</span>, <span class="ruby-identifier">start_y</span><span class="ruby-operator">+</span><span class="ruby-identifier">y_offset</span>]=<span class="ruby-identifier">block_colour</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">else</span> <span class="ruby-comment cmt">#if char is 0..0x3F it's an inverse uppercase char </span> - <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">char</span> - <span class="ruby-keyword kw">when</span> <span class="ruby-value">0x00</span><span class="ruby-operator">..</span><span class="ruby-value">0x3</span><span class="ruby-constant">F</span> <span class="ruby-keyword kw">then</span> - <span class="ruby-identifier">draw_char_at</span>(<span class="ruby-identifier">canvas</span>,<span class="ruby-identifier">char</span>,<span class="ruby-identifier">line_number</span>,<span class="ruby-identifier">col</span>,<span class="ruby-identifier">default_background_colour</span>,<span class="ruby-identifier">default_foreground_colour</span>) - <span class="ruby-keyword kw">else</span> - <span class="ruby-identifier">draw_char_at</span>(<span class="ruby-identifier">canvas</span>,<span class="ruby-identifier">char</span><span class="ruby-operator">-</span><span class="ruby-value">0x40</span>,<span class="ruby-identifier">line_number</span>,<span class="ruby-identifier">col</span>,<span class="ruby-identifier">default_foreground_colour</span>,<span class="ruby-identifier">default_background_colour</span>) - <span class="ruby-keyword kw">end</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">col</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-identifier">line_number</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> - <span class="ruby-keyword kw">end</span> - <span class="ruby-constant">PNG</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">canvas</span>).<span class="ruby-identifier">raw_bytes</span> + <pre><span class="ruby-comment cmt"># File lib/host_systems/Coco.rb, line 48</span> +<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">pixels_between_characters</span> + <span class="ruby-value">0</span> <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file