Class: ZPNG::BMP::Color

Inherits:
Color
  • Object
show all
Defined in:
lib/zpng/bmp/reader.rb

Constant Summary

Constants inherited from Color

Color::ANSI_COLORS, Color::ASCII_MAP, Color::BLACK, Color::BLUE, Color::CYAN, Color::GREEN, Color::PURPLE, Color::RED, Color::TRANSPARENT, Color::WHITE, Color::YELLOW

Instance Attribute Summary

Attributes inherited from Color

#a, #b, #depth, #g, #r

Instance Method Summary collapse

Methods inherited from Color

#&, #+, #-, #<=>, #==, #^, #black?, #euclidian, from_grayscale, from_html, #hash, #inspect, #op, #opaque?, #to_a, #to_ansi, #to_ascii, #to_css, #to_depth, #to_gray_alpha, #to_grayscale, #to_i, #to_s, #transparent?, #white?, #|

Methods included from DeepCopyable

#deep_copy

Constructor Details

#initialize(*a) ⇒ Color

BMP pixels are in perverted^w reverted order - BGR instead of RGB



133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/zpng/bmp/reader.rb', line 133

def initialize *a
  h = a.last.is_a?(Hash) ? a.pop : {}
  case a.size
  when 3
    # BGR
    super *a.reverse, h
  when 4
    # ABGR
    super a[2], a[1], a[0], a[3], h
  else
    super
  end
end