Class TGrayscaleImage

Unit

Declaration

type TGrayscaleImage = class(TCastleImage)

Description

Grayscale image. Color is a simple Byte value.

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): PByte;
Public function RowPtr(const Y: Cardinal; const Z: Cardinal = 0): PByteArray;
Public procedure InvertColors; override;
Public procedure Clear(const Pixel: TVector4Byte); override;
Public function IsClear(const Pixel: TVector4Byte): boolean; override;
Public procedure Clear(const Pixel: Byte); reintroduce;
Public function IsClear(const Pixel: Byte): boolean; reintroduce;
Public procedure HalfColors;
Public function ToGrayscaleAlphaImage: TGrayscaleAlphaImage;
Public procedure LerpWith(const Value: Single; SecondImage: TCastleImage); override;
Public class procedure MixColors(const OutputColor: Pointer; const Weights: TVector4; const AColors: TVector4Pointer); override;
Public function AlphaChannel( const AlphaTolerance: Byte): TAlphaChannel; 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: PByte read GetPixels;
Public property GrayscalePixels: PByte read GetPixels; deprecated 'use Pixels';
Public property PixelsArray: PByteArray read GetPixelsArray;
Public property TreatAsAlpha: boolean read FTreatAsAlpha write FTreatAsAlpha;
Public property ColorWhenTreatedAsAlpha: TVector3Byte read FColorWhenTreatedAsAlpha write FColorWhenTreatedAsAlpha;

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): PByte;
 
Public function RowPtr(const Y: Cardinal; const Z: Cardinal = 0): PByteArray;
 
Public procedure InvertColors; override;
 
Public procedure Clear(const Pixel: TVector4Byte); override;
 
Public function IsClear(const Pixel: TVector4Byte): boolean; override;
 
Public procedure Clear(const Pixel: Byte); reintroduce;
 
Public function IsClear(const Pixel: Byte): boolean; reintroduce;
 
Public procedure HalfColors;

Every pixels value is halved (divided by 2). This is done by simple bitshift, so you can be sure that all components are < 2ˆ7 after this.

Public function ToGrayscaleAlphaImage: TGrayscaleAlphaImage;

Add an alpha channel. The newly created alpha channel will have constant opaque alpha, except in the special case of TGrayscaleImage.TreatAsAlpha = True (where the contents will be copied to alpha, and intensity set to white).

Public procedure LerpWith(const Value: Single; SecondImage: TCastleImage); override;
 
Public class procedure MixColors(const OutputColor: Pointer; const Weights: TVector4; const AColors: TVector4Pointer); override;
 
Public function AlphaChannel( const AlphaTolerance: Byte): TAlphaChannel; 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: PByte read GetPixels;

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

Public property GrayscalePixels: PByte read GetPixels; deprecated 'use Pixels';

Warning: this symbol is deprecated: use Pixels

 
Public property PixelsArray: PByteArray read GetPixelsArray;

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

Public property TreatAsAlpha: boolean read FTreatAsAlpha write FTreatAsAlpha;

Should we treat grayscale image as pure alpha channel (without any color information) when using this as a texture.

This property is meaningful only for a small subset of operations.

  1. When creating OpenGL texture from this image. If True, then the grayscale pixel data will be loaded as alpha channel contents (GL_ALPHA texture for OpenGL, it modifies only the fragments alpha value, it doesn't have any "color" in the normal sense). It is also the only way for TGrayscaleImage to return AlphaChannel <> acNone.

  2. When using DrawFrom / DrawTo methods. If True, this image is drawn like an RGBA image, with constant RGB color ColorWhenTreatedAsAlpha, and alpha channel taken from contents of this image.

Public property ColorWhenTreatedAsAlpha: TVector3Byte read FColorWhenTreatedAsAlpha write FColorWhenTreatedAsAlpha;
 

Generated by PasDoc 0.15.0.