Class TRGBImage

Unit

Declaration

type TRGBImage = class(TCastleImage)

Description

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

Hierarchy

Overview

Methods

Protected procedure DrawFromCore(Source: TCastleImage; X, Y, SourceX, SourceY, SourceWidth, SourceHeight: Integer; const Mode: TDrawMode); override;
Protected function GetColors(const X, Y, Z: Integer): TCastleColor; override;
Protected procedure SetColors(const X, Y, Z: Integer; const C: TCastleColor); override;
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): PVector3ByteArray;
Public procedure InvertColors; override;
Public procedure Clear(const Pixel: TVector4Byte); override;
Public function IsClear(const Pixel: TVector4Byte): boolean; override;
Public procedure TransformRGB(const Matrix: TMatrix3); override;
Public procedure ModulateRGB(const ColorModulator: TColorModulatorByteFunc); override;
Public function ToRGBAlphaImage: TRGBAlphaImage; deprecated 'create TRGBAlphaImage and use TRGBAlphaImage.Assign';
Public function ToRGBFloat: TRGBFloatImage; deprecated 'create TRGBFloatImage and use TRGBFloatImage.Assign';
Public function ToGrayscale: TGrayscaleImage; deprecated 'create TGrayscaleImage and use TGrayscaleImage.Assign';
Public function ToFpImage: TInternalCastleFpImage; override;
Public procedure HorizontalLine(const x1, x2, y: Integer; const Color: TVector3Byte); overload;
Public procedure HorizontalLine(const x1, x2, y: Integer; const Color: TCastleColor); overload;
Public procedure VerticalLine(const x, y1, y2: Integer; const Color: TVector3Byte); overload;
Public procedure VerticalLine(const x, y1, y2: Integer; const Color: TCastleColor); overload;
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: TVector4; const AColors: TVector4Pointer); override;
Public procedure Assign(const Source: TCastleImage); override;
Public procedure FillEllipse(const x, y: single; const aRadiusX, aRadiusY: single; const aColor: TCastleColor); override;
Public procedure Ellipse(const x, y: single; const aRadiusX, aRadiusY: single; const aWidth: single; const aColor: TCastleColor); override;
Public procedure FillRectangle(const x1, y1, x2, y2: single; const aColor: TCastleColor); override;
Public procedure Rectangle(const x1, y1, x2, y2: single; const aWidth: single; const aColor: TCastleColor); override;
Public procedure Line(const x1, y1, x2, y2: single; const aWidth: single; const aColor: TCastleColor); override;

Properties

Public property Pixels: PVector3Byte read GetPixels;
Public property RGBPixels: PVector3Byte read GetPixels; deprecated 'use Pixels';
Public property PixelsArray: PVector3ByteArray read GetPixelsArray;

Description

Methods

Protected procedure DrawFromCore(Source: TCastleImage; X, Y, SourceX, SourceY, SourceWidth, SourceHeight: Integer; const Mode: TDrawMode); override;
 
Protected function GetColors(const X, Y, Z: Integer): TCastleColor; override;
 
Protected procedure SetColors(const X, Y, Z: Integer; const C: TCastleColor); override;
 
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): PVector3ByteArray;
 
Public procedure InvertColors; override;
 
Public procedure Clear(const Pixel: TVector4Byte); override;
 
Public function IsClear(const Pixel: TVector4Byte): boolean; override;
 
Public procedure TransformRGB(const Matrix: TMatrix3); override;
 
Public procedure ModulateRGB(const ColorModulator: TColorModulatorByteFunc); override;
 
Public function ToRGBAlphaImage: TRGBAlphaImage; deprecated 'create TRGBAlphaImage and use TRGBAlphaImage.Assign';

Warning: this symbol is deprecated: create TRGBAlphaImage and use TRGBAlphaImage.Assign

Create a new TRGBAlphaImage instance with RGB contents copied from this image, and alpha fully opaque.

Public function ToRGBFloat: TRGBFloatImage; deprecated 'create TRGBFloatImage and use TRGBFloatImage.Assign';

Warning: this symbol is deprecated: create TRGBFloatImage and use TRGBFloatImage.Assign

Convert image to an TRGBFloatImage format.

Generally this conversion is safe, since Single can express more-or-less precisely (and definitely uniquely) all values that Byte can express. (Yeah, we have autotest for this statement.)

Public function ToGrayscale: TGrayscaleImage; deprecated 'create TGrayscaleImage and use TGrayscaleImage.Assign';

Warning: this symbol is deprecated: create TGrayscaleImage and use TGrayscaleImage.Assign

 
Public function ToFpImage: TInternalCastleFpImage; override;
 
Public procedure HorizontalLine(const x1, x2, y: Integer; const Color: TVector3Byte); overload;

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

Public procedure HorizontalLine(const x1, x2, y: Integer; const Color: TCastleColor); overload;
 
Public procedure VerticalLine(const x, y1, y2: Integer; const Color: TVector3Byte); overload;

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

Public procedure VerticalLine(const x, y1, y2: Integer; const Color: TCastleColor); overload;
 
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: TVector4; const AColors: TVector4Pointer); override;
 
Public procedure Assign(const Source: TCastleImage); override;
 
Public procedure FillEllipse(const x, y: single; const aRadiusX, aRadiusY: single; const aColor: TCastleColor); override;
 
Public procedure Ellipse(const x, y: single; const aRadiusX, aRadiusY: single; const aWidth: single; const aColor: TCastleColor); override;
 
Public procedure FillRectangle(const x1, y1, x2, y2: single; const aColor: TCastleColor); override;
 
Public procedure Rectangle(const x1, y1, x2, y2: single; const aWidth: single; const aColor: TCastleColor); override;
 
Public procedure Line(const x1, y1, x2, y2: single; const aWidth: single; const aColor: TCastleColor); override;
 

Properties

Public property Pixels: PVector3Byte read GetPixels;

Pointer to pixels. Same as RawPixels, only typecasted to PVector3Byte.

Public property RGBPixels: PVector3Byte read GetPixels; deprecated 'use Pixels';

Warning: this symbol is deprecated: use Pixels

 
Public property PixelsArray: PVector3ByteArray read GetPixelsArray;

Pointer to pixels. Same as RawPixels, only typecasted to PVector3ByteArray.


Generated by PasDoc 0.16.0.