[Overview][Constants][Types][Classes][Index] Reference for unit 'ptc' (#ptc)

TPTCFormatFactory.CreateNew

Creates a pixel format object.

Declaration

Source position: line 0

class function TPTCFormatFactory.CreateNew: IPTCFormat;

class function TPTCFormatFactory.CreateNew(

  ABits: Integer

):IPTCFormat;

class function TPTCFormatFactory.CreateNew(

  ABits: Integer;

  ARedMask: Uint32;

  AGreenMask: Uint32;

  ABlueMask: Uint32;

  AAlphaMask: Uint32 = 0

):IPTCFormat;

class function TPTCFormatFactory.CreateNew(

  AFormat: IPTCFormat

):IPTCFormat;

Arguments

ABits

  

The number of bits per pixel.

Arguments

ABits

  

The number of bits per pixel.

ARedMask

  

The red color component.

AGreenMask

  

The green color component.

ABlueMask

  

The blue color component.

AAlphaMask

  

The alpha color component (defaults to zero).

Description

The default constructor sets ABits, AR, AG, AB, AA to zero. When only ABits is specified, the constructor creates an indexed pixel format where each pixel entry represents an index into a palette. Currently the only indexed format supported is 8-bit indexed color, ie. 256 color. When all AR, AG, AB (and optionally AA) are specified, the constructor creates a direct pixel format with the red, green, blue and alpha masks AR, AG, AB and AA. For each of the mask values set bits (1) represent bits allocated to the color component, and clear bits (0) represent unused bits. Here are some common direct color pixel formats:

{ 32-bit RGB888 }
format := TPTCFormatFactory.CreateNew(32, $00FF0000, $0000FF00, $000000FF);

{ 24-bit RGB888 }
format := TPTCFormatFactory.CreateNew(24, $FF0000, $00FF00, $0000FF);

{ 16-bit RGB565 }
format := TPTCFormatFactory.CreateNew(16, $F800, $07E0, $001F);

{ 15-bit RGB555 }
format := TPTCFormatFactory.CreateNew(16, $7C00, $03E0, $001F);

{ 8-bit RGB332 }
format := TPTCFormatFactory.CreateNew(8, $E0, $1C, $03);

{ 32-bit ARGB8888 }
format := TPTCFormatFactory.CreateNew(32, $00FF0000, $0000FF00, $000000FF, $FF000000);

{ 16-bit ARGB1555}
format := TPTCFormatFactory.CreateNew(16, $7C00, $03E0, $001F, $8000);

An error exception is raised if the ABits parameter is not 8, 16, 24 or 32.

Errors

TPTCError - a TPTCError exception is raised on failure.