Components

TPNGImage

Components > TPNGObject > Properties > Scanline


Provides memory pointer to have direct access to the png contents

property
Scanline[const Index: Integer]: Pointer;

Description

Like delphi
TBitmap, TPNGObject now also supports direct access to the image contents (include to alpha information using AlphaScanline). This property is intended to be used by experienced graphics programmers. Also the contents depends on the current color type and bit depth values (See header property) as the table shows bellow:

Image kind

 Number of bits for each pixel

 Recommended typecast to access the scanline data

  COLOR_GRAYSCALE - Each pixel is intensity from 0 to 2^BitDepth - 1
  COLOR_PALETTE     - Each pixel is a index to the palette table
  Bitdepth = 1

1 bit

pByteArray (windows.pas)
(Except for 8 and 16, bit manangement algorithms should be used since there's more than one pixel per byte)

  Bitdepth = 2

  4 bits (not 2)

  Bitdepth = 4

4 bits

  Bitdepth = 8

  1 byte

  Bitdepth = 16
   (Grayscale)

 1 byte

  COLOR_RGB - Each pixel contains values for Red, Green, Blue intensities
  COLOR_RGBALPHA - Same as RGB but followed by an Alpha Value
  COLOR_GRAYSCALEALPHA - Same as GRAYSCALE but with alpha value
  Bitdepth = 8

 1 byte per sample

TRGBLine = array[word] of TRGBTriple;
pRGBLine = ^TRGBLine;

  Bitdepth = 16

  1 byte per sample