class ChunkyPNG::Chunk::Transparency

@see ChunkyPNG::Palette
@see ChunkyPNG::Chunk::Palette
chunk should not be included.
Images having a color mode that already includes an alpha channel, this
fully transparent.
* For truecolor images, it contains the color that should be considered
considered fully transparent.
* For grayscale images, it contains the grayscale teint that should be
defined in the Palette (PLTE) chunk.
* For indexed images, it contains the alpha channel for the colors
A transparency (tRNS) chunk defines the transparency for an image.

def grayscale_entry(bit_depth)

Returns:
  • (Integer) - The (grayscale) color to replace with fully
def grayscale_entry(bit_depth)
  value = ChunkyPNG::Canvas.send(:"decode_png_resample_#{bit_depth}bit_value", content.unpack('n')[0])
  ChunkyPNG::Color.grayscale(value)
end

def palette_alpha_channel

Returns:
  • (Array) - Returns an array of alpha channel values
def palette_alpha_channel
  content.unpack('C*')
end

def truecolor_entry(bit_depth)

Returns:
  • (Integer) - The color to replace with fully transparent pixels.
def truecolor_entry(bit_depth)
  values = content.unpack('nnn').map do |c|
    ChunkyPNG::Canvas.send(:"decode_png_resample_#{bit_depth}bit_value", c)
  end
  ChunkyPNG::Color.rgb(*values)
end