TPNGImage help

PNG Delphi

Components > TPNGObject > Methods > CreateBlank


Creates a new blank png image using the format specified.

constructor
CreateBlank(ColorType, Bitdepth: Cardinal; cx, cy: Integer);

Description

Use this method instead of standard constructor to create a blank png image from scratch.
Following are the possibilities for the paramenters:

Parameter Allowed values Description
ColorType COLOR_PALETTE Palette image - the component uses a default palette that may be changed using Palette property.
(Each pixel is a reference to a internal palette)
COLOR_GRAYSCALE Grayscale image where each pixel is a shade of gray.
COLOR_RGB RGB images where each pixel are Red, Green and Blue samples.
COLOR_GRAYSCALEALPHA Same as COLOR_GRAYSCALE but includes a second information for each pixel to define transparency.
COLOR_RGBALPHA Same as COLOR_RGB but includes a second information for each pixel to define transparency.
Bitdepth 1 Only for COLOR_PALETTE and COLOR_GRAYSCALE (each pixel uses 1 bit)
2 Only for COLOR_PALETTE and COLOR_GRAYSCALE (each pixel uses 2 bit)
Note: the component allows only loading in this bitdepth. It automatically converts to 4 bits.
4 Only for COLOR_PALETTE and COLOR_GRAYSCALE (each pixel uses 4 bits)
8 Supports all ColorType options.
  • COLOR_PALETTE and COLOR_GRAYSCALE - each pixel uses 8 bits
  • COLOR_RGB - each pixel uses 3 bytes (R, G, B)
  • COLOR_GRAYSCALEALPHA - each pixel uses 2 bytes (Shade of gray and alpha)
  • COLOR_RGBALPHA - each pixel uses 4 bytes (R, G, B and Alpha)
16 Does not supports COLOR_PALETTE only.
  • COLOR_GRAYSCALE - each pixel uses 2 bytes
  • COLOR_RGB - each pixel uses 6 bytes (R, G, B)
  • COLOR_GRAYSCALEALPHA - each pixel uses 4 bytes (Shade of gray and alpha)
  • COLOR_RGBALPHA - each pixel uses 8 bytes (R, G, B and Alpha)

This bitdepth is to support 48bits images. The component does not display in this high color resolution, instead it just stores it into an internal variable, ExtraScanline.

cx 0..UBound(Integer) Defines the new image width
cy 0..UBound(Integer) Defines the new image height