class Pixelart::ImageColorBar
Public Class Methods
new( colors, size: 24 )
click to toggle source
make a color bar
keep auto-zoom 24x or such - why? why not?
Calls superclass method
Pixelart::Image::new
# File lib/pixelart/misc.rb, line 44 def initialize( colors, size: 24 ) img = ChunkyPNG::Image.new( colors.size*size, size, ChunkyPNG::Color::WHITE ) # why? why not? colors = colors.map {|color| Color.parse( color ) } colors.each_with_index do |color,i| size.times do |x| size.times do |y| img[x+size*i,y] = color end end end super( img.width, img.height, img ) end