Methods

Fractals::Renderers::ChunkyPNGRenderer

Renders fractals using the ChunkyPNG library. ChunkyPNG is the default renderer.

Public Instance Methods

to_blob() click to toggle source

Returns the fractal image as a BLOB.

# File lib/fractals/renderers.rb, line 104
      def to_blob()
        canvas = ChunkyPNG::Canvas.new(@width, @height, Array.new(@width * @height))
        render do |x, y, color|
          canvas[x, y] = ChunkyPNG::Color.rgb(*color)
        end

        canvas.to_blob
      end
write(file_path='fractal.png') click to toggle source

Writes the image to the specifiec file path.

# File lib/fractals/renderers.rb, line 114
      def write(file_path='fractal.png')
        File.open(file_path, 'wb') { |file| file.write(to_blob) }
      end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.