Class: Mosaiq::Image

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

Overview

Main class to create a Mosaiq Image

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width:, height:, palette: Palette.black_and_white) ⇒ Image

Returns a new instance of Image.



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

def initialize(width:, height:, palette: Palette.black_and_white)
  @width = read_positive_integer(width: width)
  @height = read_positive_integer(height: height)
  @palette = read_palette(palette)

  build_canvas
end

Instance Attribute Details

#canvasObject (readonly)

Returns the value of attribute canvas.



8
9
10
# File 'lib/mosaiq/image.rb', line 8

def canvas
  @canvas
end

Instance Method Details

#svgObject



18
19
20
# File 'lib/mosaiq/image.rb', line 18

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