Class TRGBImage

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TRGBImage = class(TCastleImage)

Description

Image with pixel represented as a TVector3Byte (red, green, blue).

Hierarchy

Overview

Methods

Public class function PixelSize: Cardinal; override;
Public class function ColorComponentsCount: Cardinal; override;
Public function PixelPtr(const X, Y: Cardinal; const Z: Cardinal = 0): PVector3Byte;
Public function RowPtr(const Y: Cardinal; const Z: Cardinal = 0): PArray_Vector3Byte;
Public procedure InvertRGBColors; override;
Public procedure SetColorRGB(const x, y: Integer; const v: TVector3Single); override;
Public procedure Clear(const Pixel: TVector4Byte); override;
Public function IsClear(const Pixel: TVector4Byte): boolean; override;
Public procedure TransformRGB(const Matrix: TMatrix3Single); override;
Public procedure ModulateRGB(const ColorModulator: TColorModulatorByteFunc); override;
Public function ToRGBAlphaImage_AlphaDontCare: TRGBAlphaImage;
Public function ToRGBAlphaImage_AlphaConst(Alpha: byte): TRGBAlphaImage;
Public function ToRGBAlphaImage_AlphaDecide( const AlphaColor: TVector3Byte; Tolerance: Byte; AlphaOnColor: Byte; AlphaOnNoColor: Byte): TRGBAlphaImage;
Public function ToRGBFloat: TRGBFloatImage;
Public function ToGrayscale: TGrayscaleImage;
Public procedure HorizontalLine(const x1, x2, y: Integer; const Color: TVector3Byte);
Public procedure VerticalLine(const x, y1, y2: Integer; const Color: TVector3Byte);
Public constructor CreateCombined(const MapImage: TRGBImage; var ReplaceWhiteImage, ReplaceBlackImage: TRGBImage);
Public procedure LerpWith(const Value: Single; SecondImage: TCastleImage); override;
Public class procedure MixColors(const OutputColor: Pointer; const Weights: TVector4Single; const Colors: TVector4Pointer); override;

Properties

Public property RGBPixels: PVector3Byte read GetRGBPixels;

Description

Methods

Public class function PixelSize: Cardinal; override;
 
Public class function ColorComponentsCount: Cardinal; override;
 
Public function PixelPtr(const X, Y: Cardinal; const Z: Cardinal = 0): PVector3Byte;
 
Public function RowPtr(const Y: Cardinal; const Z: Cardinal = 0): PArray_Vector3Byte;
 
Public procedure InvertRGBColors; override;
 
Public procedure SetColorRGB(const x, y: Integer; const v: TVector3Single); override;
 
Public procedure Clear(const Pixel: TVector4Byte); override;
 
Public function IsClear(const Pixel: TVector4Byte): boolean; override;
 
Public procedure TransformRGB(const Matrix: TMatrix3Single); override;
 
Public procedure ModulateRGB(const ColorModulator: TColorModulatorByteFunc); override;
 
Public function ToRGBAlphaImage_AlphaDontCare: TRGBAlphaImage;

Create a new TRGBAlphaImage object with RGB colors copied from this object, but alpha of each pixel is set to some random value (whatever was at that particular memory place at that time).

Public function ToRGBAlphaImage_AlphaConst(Alpha: byte): TRGBAlphaImage;

Like ToRGBAlphaImage_AlphaDontCare, but alpha of every pixel is set to given Alpha.

Public function ToRGBAlphaImage_AlphaDecide( const AlphaColor: TVector3Byte; Tolerance: Byte; AlphaOnColor: Byte; AlphaOnNoColor: Byte): TRGBAlphaImage;

Like ToRGBAlphaImage_AlphaDontCare, but alpha of every pixel is set to either AlphaOnColor (when color of pixel is equal to AlphaColor with Tolerance, see EqualRGB) or AlphaOnNoColor.

Public function ToRGBFloat: TRGBFloatImage;

Convert image to an TRGBFloatImage format.

Although float format offers superior precision compared to 8bit RGB, there is a slight chance of some unnoticeable loss of information in such convertion, since floating-point values are involved in calculation.

But generally this conversion is relatively safe (contrary to convertion float -> 8-bit RGB, which must be lossy).

But still you should note that doing such convertion has little sense since float format is useful only when you have colors that can't be expressed as simple 8-bit RGB. But by using this convertion you initially fill float image with data that does not have precision beyond standard 0..255 discreet range for each RGB component...

Public function ToGrayscale: TGrayscaleImage;
 
Public procedure HorizontalLine(const x1, x2, y: Integer; const Color: TVector3Byte);

Draw horizontal line. Must be y1 <= y2, else it is NOOP.

Public procedure VerticalLine(const x, y1, y2: Integer; const Color: TVector3Byte);

Draw vertical line. Must be x1 <= x2, else it is NOOP.

Public constructor CreateCombined(const MapImage: TRGBImage; var ReplaceWhiteImage, ReplaceBlackImage: TRGBImage);

Create image by merging two images according to a (third) mask image. This is a very special constructor. It creates image with the same size as MapImage. It also resizes ReplaceWhiteImage, ReplaceBlackImage to the size of MapImage.

Then it inits color of each pixel of our image with combined colors of two pixels on the same coordinates from ReplaceWhiteImage, ReplaceBlackImage, something like

  Pixel[x, y] := ReplaceWhiteImage[x, y] * S +
                 ReplaceBlackImage[x, y] * (S-1);

where S = average of red, gree, blue of color MapImage[x, y].

This means that final image will look like ReplaceWhiteImage in the areas where MapImage is white, and it will look like ReplaceBlackImage in the areas where MapImage is black.

Public procedure LerpWith(const Value: Single; SecondImage: TCastleImage); override;
 
Public class procedure MixColors(const OutputColor: Pointer; const Weights: TVector4Single; const Colors: TVector4Pointer); override;
 

Properties

Public property RGBPixels: PVector3Byte read GetRGBPixels;

This is the same pointer as RawPixels, only typecasted to PVector3Byte


Generated by PasDoc 0.13.0 on 2013-08-17 21:27:13