Module: Pixelart::Silvercoin

Defined in:
lib/punkart/silvercoin.rb

Constant Summary collapse

COIN_FRAME =

helpers

Image.read( "#{Module::Punkart.root}/config/silvercoin.png" )
COIN_PALETTE =

note: use dark to light

Gradient.new( '#4F5865',
'#636C78',
'#8B949E',
'#A5AEB6',
'#CAD3D9' ).colors( 256 )

Class Method Summary collapse

Class Method Details

.frameObject



27
# File 'lib/punkart/silvercoin.rb', line 27

def self.frame()  COIN_FRAME; end

.heightObject



29
# File 'lib/punkart/silvercoin.rb', line 29

def self.height() COIN_FRAME.height; end

.mint(img) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
# File 'lib/punkart/silvercoin.rb', line 5

def self.mint( img )
  raise ArgumentError, "sorry only 24x24 supported for now; called on image #{img.width}x#{img.height}"  unless img.width == 24 && img.height == 24

  ## change to coin color palette
  coin = Image.new( 32, 32 )
  coin.compose!( COIN_FRAME )
  coin.compose!( img.change_palette8bit( COIN_PALETTE ), 5, 3 )
  coin
end

.paletteObject



30
# File 'lib/punkart/silvercoin.rb', line 30

def self.palette() COIN_PALETTE; end

.widthObject



28
# File 'lib/punkart/silvercoin.rb', line 28

def self.width()  COIN_FRAME.width; end