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, #hash, #inspect, #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



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/zpng/bmp/reader.rb', line 46

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