Module: ZIMG::PNG::Scanline::Mixins::RGB24_TRNS

Defined in:
lib/zimg/png/scanline_mixins.rb

Overview

if image has tRNS chunk - 10% slower than RGB24

Instance Method Summary collapse

Instance Method Details

#[](x) ⇒ Object

rubocop:disable Naming/ClassAndModuleCamelCase



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/zimg/png/scanline_mixins.rb', line 46

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