Module: ZPNG::ScanLine::Mixins::RGB24_TRNS

Defined in:
lib/zpng/scan_line/mixins.rb

Overview

if image has tRNS chunk - 10% slower than RGB24

Instance Method Summary collapse

Instance Method Details

#[](x) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/zpng/scan_line/mixins.rb', line 44

def [] x
  t = x*3
  # color_class is for (limited) BMP support
  color = image.color_class.new(
    decoded_bytes.getbyte(t),
    decoded_bytes.getbyte(t+1),
    decoded_bytes.getbyte(t+2)
  )
  color.alpha = image._alpha_color(color)
  color
end