Castle Game Engine: CastleImages: Class TGrayscaleImage

# Class TGrayscaleImage
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleImages ## Declaration `type TGrayscaleImage = class(TCastleImage)` ## Description Grayscale image. Color is a simple Byte value. ## Hierarchy TObject TEncodedImage TCastleImage TGrayscaleImage ## Overview ### Methods
| `class function PixelSize: Cardinal; override;`
| `class function ColorComponentsCount: Cardinal; override;`
| `function PixelPtr(const X, Y: Cardinal; const Z: Cardinal = 0): PByte;`
| `function RowPtr(const Y: Cardinal; const Z: Cardinal = 0): PByteArray;`
| `procedure Clear(const Pixel: Byte); reintroduce;`
| `function IsClear(const Pixel: Byte): boolean; reintroduce;`
| `procedure HalfColors;`
| `function ToGrayscaleAlphaImage: TGrayscaleAlphaImage;`
| `procedure LerpWith(const Value: Single; SecondImage: TCastleImage); override;`
| `class procedure MixColors(const OutputColor: Pointer; const Weights: TVector4Single; const Colors: TVector4Pointer); override;`
| `function AlphaChannel( const AlphaTolerance: Byte): TAlphaChannel; override;`
| `procedure Assign(const Source: TCastleImage); override;`
### Properties
| `property GrayscalePixels: PByte read GetGrayscalePixels;`
| `property TreatAsAlpha: boolean read FTreatAsAlpha write FTreatAsAlpha;`
## Description ### Methods
| `class function PixelSize: Cardinal; override;`
| `class function ColorComponentsCount: Cardinal; override;`
| `function PixelPtr(const X, Y: Cardinal; const Z: Cardinal = 0): PByte;`
| `function RowPtr(const Y: Cardinal; const Z: Cardinal = 0): PByteArray;`
| `procedure Clear(const Pixel: Byte); reintroduce;`
| `function IsClear(const Pixel: Byte): boolean; reintroduce;`
| `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.
| `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).
| `procedure LerpWith(const Value: Single; SecondImage: TCastleImage); override;`
| `class procedure MixColors(const OutputColor: Pointer; const Weights: TVector4Single; const Colors: TVector4Pointer); override;`
| `function AlphaChannel( const AlphaTolerance: Byte): TAlphaChannel; override;`
| `procedure Assign(const Source: TCastleImage); override;`
### Properties
| `property GrayscalePixels: PByte read GetGrayscalePixels;`
This is the same pointer as RawPixels, only typecasted to PByte
| `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, right now: only 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.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:10