Class: Mosaiq::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/mosaiq/image.rb

Overview

Main class to create a Mosaiq Image

Instance Method Summary collapse

Constructor Details

#initialize(width, height, colors = Palette.black_and_white) ⇒ Image

Returns a new instance of Image.



8
9
10
11
12
13
14
# File 'lib/mosaiq/image.rb', line 8

def initialize(width, height, colors = Palette.black_and_white)
  @width = read_positive_integer(width: width)
  @height = read_positive_integer(height: height)
  @colors = read_colors(colors)

  build_canvas
end

Instance Method Details

#svgObject



16
17
18
# File 'lib/mosaiq/image.rb', line 16

def svg
  Mosaiq::Svg.new(@canvas).generate
end