Module Fractals::Renderers::JRubyRenderer
In: lib/fractals/renderers.rb

Renders fractals using native Java libraries.

Methods

write  

Included Modules

Java

Public Instance methods

Writes the image to the specified file path.

[Source]

# File lib/fractals/renderers.rb, line 151
      def write(file_path='fractal.png')
        import java.awt.image.BufferedImage
        import javax.imageio.ImageIO

        buffered_image = BufferedImage.new(@width, @height, BufferedImage::TYPE_INT_RGB)
        render do |x, y, color|
          buffered_image.setRGB(x, y, to_rgb(color))
        end

        ImageIO.write(buffered_image, file_path.split('.').last, java.io.File.new(file_path))
      end

[Validate]