Module: ZPNG::ScanLine::Mixins::RGBA32

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

Overview

RGBA 8 bits per sample = 32bpp

Instance Method Summary collapse

Instance Method Details

#[](x) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/zpng/scan_line/mixins.rb', line 59

def [] x
  # substring  => 1.50s on 270_000 pixels
  # getbyte(s) => 1.25s on 270_000 pixels
  t = x*4
  image.color_class.new(
    decoded_bytes.getbyte(t),
    decoded_bytes.getbyte(t+1),
    decoded_bytes.getbyte(t+2),
    decoded_bytes.getbyte(t+3)
  )
end