Class: MinecraftAvatars::Face
- Defined in:
- lib/minecraft-avatars/face.rb
Instance Attribute Summary
Attributes inherited from BaseImage
Instance Method Summary collapse
-
#initialize(player_name, size = 64) ⇒ Face
constructor
A new instance of Face.
Methods inherited from BaseImage
Constructor Details
#initialize(player_name, size = 64) ⇒ Face
Returns a new instance of Face.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/minecraft-avatars/face.rb', line 8 def initialize(player_name, size=64) throw InvalidResolutionException unless (size & (size-1)) == 0 skin = RawSkin.new(player_name) self.chunky = ChunkyPNG::Image.new(8, 8, ChunkyPNG::Color::TRANSPARENT) self.chunky.compose!(skin.sections[:head_front], 0, 0) self.chunky.compose!(skin.sections[:head_accessory], 0, 0) self.chunky.resample_nearest_neighbor!(size, size) end |