Module: Punk::Skeleton
- Defined in:
- lib/punkmaker/type/skeleton.rb
Overview
make it a class - why? why not?
Constant Summary collapse
- BASE_M =
Image.read( "#{Pixelart::Module::Punkmaker.root}/config/skeleton-male.png" )
- BASE_F =
Image.read( "#{Pixelart::Module::Punkmaker.root}/config/skeleton-female.png" )
Class Method Summary collapse
Class Method Details
.derive_color_map(color) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/punkmaker/type/skeleton.rb', line 24 def self.derive_color_map( color ) color = Color.from_hex( color ) if color.is_a?( String ) # 122 pixels #e0e0e0 / rgb(224 224 224) - hsl( 0° 0% 88%) - 8-BIT GRAYSCALE #224 # 385 pixels #000000 / rgb( 0 0 0) - hsl( 0° 0% 0%) - α( 0%) - TRANSPARENT # 69 pixels #000000 / rgb( 0 0 0) - hsl( 0° 0% 0%) - BLACK base = color color_map = { '#e0e0e0' => base, } color_map end |
.make(color = nil, gender: 'm') ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/punkmaker/type/skeleton.rb', line 8 def self.make( color=nil, gender: 'm' ) base = gender == 'm' ? BASE_M : BASE_F ## note: make a copy of base punk = Image.new( base.width, base.height ) punk.compose!( base ) if color color_map = derive_color_map( color ) punk = punk.change_colors( color_map ) end punk end |