Class: Exerb::Resource::Icon
Overview
#
Instance Attribute Summary collapse
-
#bit_count ⇒ Object
Returns the value of attribute bit_count.
-
#height ⇒ Object
Returns the value of attribute height.
-
#value ⇒ Object
Returns the value of attribute value.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Icon
constructor
A new instance of Icon.
- #pack ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ Icon
Returns a new instance of Icon.
21 22 23 24 25 26 27 |
# File 'lib/exerb/resource/icon.rb', line 21 def initialize super() @width = nil @height = nil @bit_count = nil @value = nil end |
Instance Attribute Details
#bit_count ⇒ Object
Returns the value of attribute bit_count.
29 30 31 |
# File 'lib/exerb/resource/icon.rb', line 29 def bit_count @bit_count end |
#height ⇒ Object
Returns the value of attribute height.
29 30 31 |
# File 'lib/exerb/resource/icon.rb', line 29 def height @height end |
#value ⇒ Object
Returns the value of attribute value.
29 30 31 |
# File 'lib/exerb/resource/icon.rb', line 29 def value @value end |
#width ⇒ Object
Returns the value of attribute width.
29 30 31 |
# File 'lib/exerb/resource/icon.rb', line 29 def width @width end |
Class Method Details
.read(input, width, height, bit_count) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/exerb/resource/icon.rb', line 31 def self.read(input, width, height, bit_count) icon_file = Exerb::Win32::IconFile.read(input) icon_entry = icon_file.entries.find { |entry| entry.width == width && entry.height == height && entry.bit_count == bit_count } raise(Exerb::ExerbError, "no such icon #{width}x#{height}x#{bit_count} in #{input}") unless icon_entry icon = self.new icon.width = icon_entry.width icon.height = icon_entry.height icon.bit_count = icon_entry.bit_count icon.value = icon_entry.value return icon end |
Instance Method Details
#pack ⇒ Object
45 46 47 |
# File 'lib/exerb/resource/icon.rb', line 45 def pack return @value end |