Module: Pixelart::Goldcoin

Defined in:
lib/punkart/goldcoin.rb

Constant Summary collapse

COIN_FRAME =

helpers

Image.read( "#{Module::Punkart.root}/config/goldcoin.png" )
COIN_FRAME_FRONT =
Image.read( "#{Module::Punkart.root}/config/goldcoin-front.png" )
COIN_FRAME_BACK =
Image.read( "#{Module::Punkart.root}/config/goldcoin-back.png" )
COIN_PALETTE =

note: use dark to light

Gradient.new( '#CA7128',
'#D9862C',
'#F2AF39',
'#F6C451',
'#FBE272' ).colors( 256 )

Class Method Summary collapse

Class Method Details

.frameObject



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

def self.frame()  COIN_FRAME; end

.heightObject



32
# File 'lib/punkart/goldcoin.rb', line 32

def self.height() COIN_FRAME.height; end

.mint(img) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
# File 'lib/punkart/goldcoin.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_BACK )
  coin.compose!( img.change_palette8bit( COIN_PALETTE ), 5, 3 )
  coin.compose!( COIN_FRAME_FRONT )
  coin
end

.paletteObject



33
# File 'lib/punkart/goldcoin.rb', line 33

def self.palette() COIN_PALETTE; end

.widthObject



31
# File 'lib/punkart/goldcoin.rb', line 31

def self.width()  COIN_FRAME.width; end