X-Git-Url: https://git.delphigl.com/?p=LazOpenGLCore.git;a=blobdiff_plain;f=doc%2FglBitmap.TglBitmap.html;fp=doc%2FglBitmap.TglBitmap.html;h=7f53bf58cd1b5c693b6bc359cbb4e9a86c3b71eb;hp=0000000000000000000000000000000000000000;hb=1f9d3b8b9ce7d5e05f7af88c7ab0fd094609d9e5;hpb=5a2eeb45d528c5a2406b2ae5d73a4c711b2ea7dc diff --git a/doc/glBitmap.TglBitmap.html b/doc/glBitmap.TglBitmap.html new file mode 100644 index 0000000..7f53bf5 --- /dev/null +++ b/doc/glBitmap.TglBitmap.html @@ -0,0 +1,2061 @@ + + + +glBitmap: Class TglBitmap + + + + + +
+

Class TglBitmap

+ + +
DescriptionHierarchyFieldsMethodsProperties
+

Unit

+ +

Declaration

+

+type TglBitmap = class(TObject)

+

Description

+

+base class for all glBitmap classes. used to manage OpenGL texture objects and to load, save and manipulate texture data

+

Hierarchy

+
  • TObject
  • +
  • TglBitmap

Overview

+

Fields

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ProtectedfID: GLuint;
ProtectedfTarget: GLuint;
ProtectedfAnisotropic: Integer;
ProtectedfDeleteTextureOnFree: Boolean;
ProtectedfFreeDataOnDestroy: Boolean;
ProtectedfFreeDataAfterGenTexture: Boolean;
ProtectedfData: PByte;
ProtectedfBorderColor: array[0..3] of Single;
ProtectedfDimension: TglBitmapSize;
ProtectedfMipMap: TglBitmapMipMap;
ProtectedfFormat: TglBitmapFormat;
ProtectedfPixelSize: Integer;
ProtectedfRowSize: Integer;
ProtectedfFilterMin: GLenum;
ProtectedfFilterMag: GLenum;
ProtectedfWrapS: GLenum;
ProtectedfWrapT: GLenum;
ProtectedfWrapR: GLenum;
ProtectedfSwizzle: array[0..3] of GLenum;
ProtectedfFilename: String;
ProtectedfCustomName: String;
ProtectedfCustomNameW: WideString;
ProtectedfCustomData: Pointer;
+

Methods

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Privatefunction GetFormatDesc: TglBitmapFormatDescriptor;
Protectedfunction GetWidth: Integer; virtual;
Protectedfunction GetHeight: Integer; virtual;
Protectedfunction GetFileWidth: Integer; virtual;
Protectedfunction GetFileHeight: Integer; virtual;
Protectedprocedure SetCustomData(const aValue: Pointer);
Protectedprocedure SetCustomName(const aValue: String);
Protectedprocedure SetCustomNameW(const aValue: WideString);
Protectedprocedure SetFreeDataOnDestroy(const aValue: Boolean);
Protectedprocedure SetDeleteTextureOnFree(const aValue: Boolean);
Protectedprocedure SetFormat(const aValue: TglBitmapFormat);
Protectedprocedure SetFreeDataAfterGenTexture(const aValue: Boolean);
Protectedprocedure SetID(const aValue: Cardinal);
Protectedprocedure SetMipMap(const aValue: TglBitmapMipMap);
Protectedprocedure SetTarget(const aValue: Cardinal);
Protectedprocedure SetAnisotropic(const aValue: Integer);
Protectedprocedure CreateID;
Protectedprocedure SetupParameters();
Protectedprocedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat; const aWidth: Integer = -1; const aHeight: Integer = -1); virtual;
Protectedprocedure GenTexture(const aTestTextureSize: Boolean = true); virtual; abstract;
Protectedfunction FlipHorz: Boolean; virtual;
Protectedfunction FlipVert: Boolean; virtual;
Publicprocedure AfterConstruction; override;
Publicprocedure BeforeDestruction; override;
Publicprocedure PrepareResType(var aResource: String; var aResType: PChar);
Publicprocedure LoadFromFile(const aFilename: String);
Publicprocedure LoadFromStream(const aStream: TStream); virtual;
Publicprocedure LoadFromFunc(const aSize: TglBitmapSize; const aFunc: TglBitmapFunction; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil);
Publicprocedure LoadFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil);
Publicprocedure LoadFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar);
Publicprocedure SaveToFile(const aFilename: String; const aFileType: TglBitmapFileType);
Publicprocedure SaveToStream(const aStream: TStream; const aFileType: TglBitmapFileType); virtual;
Publicfunction Convert(const aFunc: TglBitmapFunction; const aCreateTemp: Boolean; const aArgs: Pointer = nil): Boolean; overload;
Publicfunction Convert(const aSource: TglBitmap; const aFunc: TglBitmapFunction; aCreateTemp: Boolean; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil): Boolean; overload;
Publicfunction ConvertTo(const aFormat: TglBitmapFormat): Boolean; virtual;
Publicfunction AddAlphaFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Publicfunction AddAlphaFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Publicfunction AddAlphaFromFunc(const aFunc: TglBitmapFunction; const aArgs: Pointer = nil): Boolean; virtual;
Publicfunction AddAlphaFromFile(const aFileName: String; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Publicfunction AddAlphaFromStream(const aStream: TStream; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Publicfunction AddAlphaFromGlBitmap(const aBitmap: TglBitmap; aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
Publicfunction AddAlphaFromColorKey(const aRed, aGreen, aBlue: Byte; const aDeviation: Byte = 0): Boolean;
Publicfunction AddAlphaFromColorKeyRange(const aRed, aGreen, aBlue: Cardinal; const aDeviation: Cardinal = 0): Boolean;
Publicfunction AddAlphaFromColorKeyFloat(const aRed, aGreen, aBlue: Single; const aDeviation: Single = 0): Boolean;
Publicfunction AddAlphaFromValue(const aAlpha: Byte): Boolean;
Publicfunction AddAlphaFromValueRange(const aAlpha: Cardinal): Boolean;
Publicfunction AddAlphaFromValueFloat(const aAlpha: Single): Boolean;
Publicfunction RemoveAlpha: Boolean; virtual;
Publicfunction Clone: TglBitmap;
Publicprocedure Invert(const aUseRGB: Boolean = true; const aUseAlpha: Boolean = false);
Publicprocedure FreeData;
Publicprocedure FillWithColor(const aRed, aGreen, aBlue: Byte; const aAlpha: Byte = 255);
Publicprocedure FillWithColorRange(const aRed, aGreen, aBlue: Cardinal; const aAlpha: Cardinal = $FFFFFFFF);
Publicprocedure FillWithColorFloat(const aRed, aGreen, aBlue: Single; const aAlpha: Single = 1.0);
Publicprocedure SetFilter(const aMin, aMag: GLenum);
Publicprocedure SetWrap( const S: GLenum = GL_CLAMP_TO_EDGE; const T: GLenum = GL_CLAMP_TO_EDGE; const R: GLenum = GL_CLAMP_TO_EDGE);
Publicprocedure SetSwizzle(const r, g, b, a: GLenum);
Publicprocedure Bind(const aEnableTextureUnit: Boolean = true); virtual;
Publicprocedure Unbind(const aDisableTextureUnit: Boolean = true); virtual;
Publicconstructor Create; overload;
Publicconstructor Create(const aFileName: String); overload;
Publicconstructor Create(const aStream: TStream); overload;
Publicconstructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; aData: PByte = nil); overload;
Publicconstructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; const aFunc: TglBitmapFunction; const aArgs: Pointer = nil); overload;
Publicconstructor Create(const aInstance: Cardinal; const aResource: String; const aResType: PChar = nil); overload;
Publicconstructor Create(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar); overload;
Privatefunction LoadRAW(const aStream: TStream): Boolean;
Privateprocedure SaveRAW(const aStream: TStream);
Privatefunction LoadBMP(const aStream: TStream): Boolean;
Privateprocedure SaveBMP(const aStream: TStream);
Privatefunction LoadTGA(const aStream: TStream): Boolean;
Privateprocedure SaveTGA(const aStream: TStream);
Privatefunction LoadDDS(const aStream: TStream): Boolean;
Privateprocedure SaveDDS(const aStream: TStream);
+

Properties

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Protectedproperty Width: Integer read GetWidth;
Protectedproperty Height: Integer read GetHeight;
Protectedproperty FileWidth: Integer read GetFileWidth;
Protectedproperty FileHeight: Integer read GetFileHeight;
Publicproperty ID: Cardinal read fID write SetID;
Publicproperty Target: Cardinal read fTarget write SetTarget;
Publicproperty Format: TglBitmapFormat read fFormat write SetFormat;
Publicproperty MipMap: TglBitmapMipMap read fMipMap write SetMipMap;
Publicproperty Anisotropic: Integer read fAnisotropic write SetAnisotropic;
Publicproperty FormatDesc: TglBitmapFormatDescriptor read GetFormatDesc;
Publicproperty Filename: String read fFilename;
Publicproperty CustomName: String read fCustomName write SetCustomName;
Publicproperty CustomNameW: WideString read fCustomNameW write SetCustomNameW;
Publicproperty CustomData: Pointer read fCustomData write SetCustomData;
Publicproperty DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;
Publicproperty FreeDataOnDestroy: Boolean read fFreeDataOnDestroy write SetFreeDataOnDestroy;
Publicproperty FreeDataAfterGenTexture: Boolean read fFreeDataAfterGenTexture write SetFreeDataAfterGenTexture;
Publicproperty Dimension: TglBitmapSize read fDimension;
Publicproperty Data: PByte read fData;
+

Description

+

Fields

+ + + + + + +
ProtectedfID: GLuint;
+

+name of the OpenGL texture object

+
+ + + + + + +
ProtectedfTarget: GLuint;
+

+texture target (e.g. GL_TEXTURE_2D)

+
+ + + + + + +
ProtectedfAnisotropic: Integer;
+

+anisotropic level

+
+ + + + + + +
ProtectedfDeleteTextureOnFree: Boolean;
+

+delete OpenGL texture object when this object is destroyed

+
+ + + + + + +
ProtectedfFreeDataOnDestroy: Boolean;
+

+free stored data when this object is destroyed

+
+ + + + + + +
ProtectedfFreeDataAfterGenTexture: Boolean;
+

+free stored data after data was uploaded to video card

+
+ + + + + + +
ProtectedfData: PByte;
+

+data of this texture

+
+ + + + + + +
ProtectedfBorderColor: array[0..3] of Single;
+

+color of the texture border

+
+ + + + + + +
ProtectedfDimension: TglBitmapSize;
+

+size of this texture

+
+ + + + + + +
ProtectedfMipMap: TglBitmapMipMap;
+

+mipmap type

+
+ + + + + + +
ProtectedfFormat: TglBitmapFormat;
+

+format the texture data is stored in

+
+ + + + + + +
ProtectedfPixelSize: Integer;
+

+size of one pixel (in byte)

+
+ + + + + + +
ProtectedfRowSize: Integer;
+

+size of one pixel row (in byte)

+
+ + + + + + +
ProtectedfFilterMin: GLenum;
+

+min filter to apply to the texture

+
+ + + + + + +
ProtectedfFilterMag: GLenum;
+

+mag filter to apply to the texture

+
+ + + + + + +
ProtectedfWrapS: GLenum;
+

+texture wrapping for x axis

+
+ + + + + + +
ProtectedfWrapT: GLenum;
+

+texture wrapping for y axis

+
+ + + + + + +
ProtectedfWrapR: GLenum;
+

+texture wrapping for z axis

+
+ + + + + + +
ProtectedfSwizzle: array[0..3] of GLenum;
+

+color channel swizzle

+
+ + + + + + +
ProtectedfFilename: String;
+

+filename the texture was load from

+
+ + + + + + +
ProtectedfCustomName: String;
+

+user defined name

+
+ + + + + + +
ProtectedfCustomNameW: WideString;
+

+user defined name

+
+ + + + + + +
ProtectedfCustomData: Pointer;
+

+user defined data

+
+

Methods

+ + + + + + +
Privatefunction GetFormatDesc: TglBitmapFormatDescriptor;
Returns
+

format descriptor that describes the format of the stored data

+ + + + + + +
Protectedfunction GetWidth: Integer; virtual;
Returns
+

the actual width of the texture

+ + + + + + +
Protectedfunction GetHeight: Integer; virtual;
Returns
+

the actual height of the texture

+ + + + + + +
Protectedfunction GetFileWidth: Integer; virtual;
Returns
+

the width of the texture or 1 if the width is zero

+ + + + + + +
Protectedfunction GetFileHeight: Integer; virtual;
Returns
+

the height of the texture or 1 if the height is zero

+ + + + + + +
Protectedprocedure SetCustomData(const aValue: Pointer);
+

+set a new value for fCustomData

+
+ + + + + + +
Protectedprocedure SetCustomName(const aValue: String);
+

+set a new value for fCustomName

+
+ + + + + + +
Protectedprocedure SetCustomNameW(const aValue: WideString);
+

+set a new value for fCustomNameW

+
+ + + + + + +
Protectedprocedure SetFreeDataOnDestroy(const aValue: Boolean);
+

+set new value for fFreeDataOnDestroy

+
+ + + + + + +
Protectedprocedure SetDeleteTextureOnFree(const aValue: Boolean);
+

+set new value for fDeleteTextureOnFree

+
+ + + + + + +
Protectedprocedure SetFormat(const aValue: TglBitmapFormat);
+

+set new value for the data format. only possible if new format has the same pixel size. if you want to convert the texture data, see ConvertTo function

+
+ + + + + + +
Protectedprocedure SetFreeDataAfterGenTexture(const aValue: Boolean);
+

+set new value for fFreeDataAfterGenTexture

+
+ + + + + + +
Protectedprocedure SetID(const aValue: Cardinal);
+

+set name of OpenGL texture object

+
+ + + + + + +
Protectedprocedure SetMipMap(const aValue: TglBitmapMipMap);
+

+set new value for fMipMap

+
+ + + + + + +
Protectedprocedure SetTarget(const aValue: Cardinal);
+

+set new value for target

+
+ + + + + + +
Protectedprocedure SetAnisotropic(const aValue: Integer);
+

+set new value for fAnisotrophic

+
+ + + + + + +
Protectedprocedure CreateID;
+

+create OpenGL texture object (delete exisiting object if exists)

+
+ + + + + + +
Protectedprocedure SetupParameters();
+

+setup texture parameters

+
+ + + + + + +
Protectedprocedure SetDataPointer(var aData: PByte; const aFormat: TglBitmapFormat; const aWidth: Integer = -1; const aHeight: Integer = -1); virtual;
+

+set data pointer of texture data

+
Parameters
+
+
aData
+
pointer to new texture data (be carefull, aData could be freed by this function)
+
aFormat
+
format of the data stored at aData
+
aWidth
+
width of the texture data
+
aHeight
+
height of the texture data
+
+
+ + + + + + +
Protectedprocedure GenTexture(const aTestTextureSize: Boolean = true); virtual; abstract;
+

+generate texture (upload texture data to video card)

+
Parameters
+
+
aTestTextureSize
+
test texture size before uploading and raise exception if something is wrong
+
+
+ + + + + + +
Protectedfunction FlipHorz: Boolean; virtual;
+

+flip texture horizontal

+
Returns
+

True in success, False otherwise

+ + + + + + +
Protectedfunction FlipVert: Boolean; virtual;
+

+flip texture vertical

+
Returns
+

True in success, False otherwise

+ + + + + + +
Publicprocedure AfterConstruction; override;
+

+this method is called after the constructor and sets the default values of this object

+
+ + + + + + +
Publicprocedure BeforeDestruction; override;
+

+this method is called before the destructor and does some cleanup

+
+ + + + + + +
Publicprocedure PrepareResType(var aResource: String; var aResType: PChar);
+

+splits a resource identifier into the resource and it's type

+
Parameters
+
+
aResource
+
resource identifier to split and store name in
+
aResType
+
type of the resource
+
+
+ + + + + + +
Publicprocedure LoadFromFile(const aFilename: String);
+

+load a texture from a file

+
Parameters
+
+
aFilename
+
file to load texuture from
+
+
+ + + + + + +
Publicprocedure LoadFromStream(const aStream: TStream); virtual;
+

+load a texture from a stream

+
Parameters
+
+
aStream
+
stream to load texture from
+
+
+ + + + + + +
Publicprocedure LoadFromFunc(const aSize: TglBitmapSize; const aFunc: TglBitmapFunction; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil);
+

+use a function to generate texture data

+
Parameters
+
+
aSize
+
size of the texture
+
aFunc
+
callback to use for generation
+
aFormat
+
format of the texture data
+
aArgs
+
user defined paramaters (use at will)
+
+
+ + + + + + +
Publicprocedure LoadFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil);
+

+load a texture from a resource

+
Parameters
+
+
aInstance
+
resource handle
+
aResource
+
resource indentifier
+
aResType
+
resource type (if known)
+
+
+ + + + + + +
Publicprocedure LoadFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar);
+

+load a texture from a resource id

+
Parameters
+
+
aInstance
+
resource handle
+
aResource
+
resource ID
+
aResType
+
resource type
+
+
+ + + + + + +
Publicprocedure SaveToFile(const aFilename: String; const aFileType: TglBitmapFileType);
+

+save texture data to a file

+
Parameters
+
+
aFilename
+
filename to store texture in
+
aFileType
+
file type to store data into
+
+
+ + + + + + +
Publicprocedure SaveToStream(const aStream: TStream; const aFileType: TglBitmapFileType); virtual;
+

+save texture data to a stream

+
Parameters
+
+
aFilename
+
filename to store texture in
+
aFileType
+
file type to store data into
+
+
+ + + + + + +
Publicfunction Convert(const aFunc: TglBitmapFunction; const aCreateTemp: Boolean; const aArgs: Pointer = nil): Boolean; overload;
+

+convert texture data using a user defined callback

+
Parameters
+
+
aFunc
+
callback to use for converting
+
aCreateTemp
+
create a temporary buffer to use for converting
+
aArgs
+
user defined paramters (use at will)
+
+
Returns
+

True if converting was successful, False otherwise

+ + + + + + +
Publicfunction Convert(const aSource: TglBitmap; const aFunc: TglBitmapFunction; aCreateTemp: Boolean; const aFormat: TglBitmapFormat; const aArgs: Pointer = nil): Boolean; overload;
+

+convert texture data using a user defined callback

+
Parameters
+
+
aSource
+
glBitmap to read data from
+
aFunc
+
callback to use for converting
+
aCreateTemp
+
create a temporary buffer to use for converting
+
aFormat
+
format of the new data
+
aArgs
+
user defined paramters (use at will)
+
+
Returns
+

True if converting was successful, False otherwise

+ + + + + + +
Publicfunction ConvertTo(const aFormat: TglBitmapFormat): Boolean; virtual;
+

+convert texture data using a specific format

+
Parameters
+
+
aFormat
+
new format of texture data
+
+
Returns
+

True if converting was successful, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromResource(const aInstance: Cardinal; aResource: String; aResType: PChar = nil; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
+

+load alpha channel data from resource

+
Parameters
+
+
aInstance
+
resource handle
+
aResource
+
resource ID
+
aResType
+
resource type
+
aFunc
+
callback to use for converting
+
aArgs
+
user defined parameters (use at will)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromResourceID(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
+

+load alpha channel data from resource ID

+
Parameters
+
+
aInstance
+
resource handle
+
aResourceID
+
resource ID
+
aResType
+
resource type
+
aFunc
+
callback to use for converting
+
aArgs
+
user defined parameters (use at will)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromFunc(const aFunc: TglBitmapFunction; const aArgs: Pointer = nil): Boolean; virtual;
+

+add alpha channel data from function

+
Parameters
+
+
aFunc
+
callback to get data from
+
aArgs
+
user defined parameters (use at will)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromFile(const aFileName: String; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
+

+add alpha channel data from file (macro for: new glBitmap, LoadFromFile, AddAlphaFromGlBitmap)

+
Parameters
+
+
aFilename
+
file to load alpha channel data from
+
aFunc
+
callback to use for converting
+
aArgs
+
user defined parameters (use at will)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromStream(const aStream: TStream; const aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
+

+add alpha channel data from stream (macro for: new glBitmap, LoadFromStream, AddAlphaFromGlBitmap)

+
Parameters
+
+
aStream
+
stream to load alpha channel data from
+
aFunc
+
callback to use for converting
+
aArgs
+
user defined parameters (use at will)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromGlBitmap(const aBitmap: TglBitmap; aFunc: TglBitmapFunction = nil; const aArgs: Pointer = nil): Boolean;
+

+add alpha channel data from existing glBitmap object

+
Parameters
+
+
aBitmap
+
TglBitmap to copy alpha channel data from
+
aFunc
+
callback to use for converting
+
aArgs
+
user defined parameters (use at will)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromColorKey(const aRed, aGreen, aBlue: Byte; const aDeviation: Byte = 0): Boolean;
+

+add alpha to pixel if the pixels color is greter than the given color value

+
Parameters
+
+
aRed
+
red threshold (0-255)
+
aGreen
+
green threshold (0-255)
+
aBlue
+
blue threshold (0-255)
+
aDeviatation
+
accepted deviatation (0-255)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromColorKeyRange(const aRed, aGreen, aBlue: Cardinal; const aDeviation: Cardinal = 0): Boolean;
+

+add alpha to pixel if the pixels color is greter than the given color value

+
Parameters
+
+
aRed
+
red threshold (0-Range.r)
+
aGreen
+
green threshold (0-Range.g)
+
aBlue
+
blue threshold (0-Range.b)
+
aDeviatation
+
accepted deviatation (0-max(Range.rgb))
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromColorKeyFloat(const aRed, aGreen, aBlue: Single; const aDeviation: Single = 0): Boolean;
+

+add alpha to pixel if the pixels color is greter than the given color value

+
Parameters
+
+
aRed
+
red threshold (0.0-1.0)
+
aGreen
+
green threshold (0.0-1.0)
+
aBlue
+
blue threshold (0.0-1.0)
+
aDeviatation
+
accepted deviatation (0.0-1.0)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromValue(const aAlpha: Byte): Boolean;
+

+add a constand alpha value to all pixels

+
Parameters
+
+
aAlpha
+
alpha value to add (0-255)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromValueRange(const aAlpha: Cardinal): Boolean;
+

+add a constand alpha value to all pixels

+
Parameters
+
+
aAlpha
+
alpha value to add (0-max(Range.rgb))
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction AddAlphaFromValueFloat(const aAlpha: Single): Boolean;
+

+add a constand alpha value to all pixels

+
Parameters
+
+
aAlpha
+
alpha value to add (0.0-1.0)
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction RemoveAlpha: Boolean; virtual;
+

+remove alpha channel

+
Returns
+

True on success, False otherwise

+ + + + + + +
Publicfunction Clone: TglBitmap;
+

+create a clone of the current object

+
Returns
+

clone of this object

+ + + + + + +
Publicprocedure Invert(const aUseRGB: Boolean = true; const aUseAlpha: Boolean = false);
+

+invert color data (xor)

+
Parameters
+
+
aUseRGB
+
xor each color channel
+
aUseAlpha
+
xor alpha channel
+
+
+ + + + + + +
Publicprocedure FreeData;
+

+free texture stored data

+
+ + + + + + +
Publicprocedure FillWithColor(const aRed, aGreen, aBlue: Byte; const aAlpha: Byte = 255);
+

+fill complete texture with one color

+
Parameters
+
+
aRed
+
red color for border (0-255)
+
aGreen
+
green color for border (0-255)
+
aBlue
+
blue color for border (0-255)
+
aAlpha
+
alpha color for border (0-255)
+
+
+ + + + + + +
Publicprocedure FillWithColorRange(const aRed, aGreen, aBlue: Cardinal; const aAlpha: Cardinal = $FFFFFFFF);
+

+fill complete texture with one color

+
Parameters
+
+
aRed
+
red color for border (0-Range.r)
+
aGreen
+
green color for border (0-Range.g)
+
aBlue
+
blue color for border (0-Range.b)
+
aAlpha
+
alpha color for border (0-Range.a)
+
+
+ + + + + + +
Publicprocedure FillWithColorFloat(const aRed, aGreen, aBlue: Single; const aAlpha: Single = 1.0);
+

+fill complete texture with one color

+
Parameters
+
+
aRed
+
red color for border (0.0-1.0)
+
aGreen
+
green color for border (0.0-1.0)
+
aBlue
+
blue color for border (0.0-1.0)
+
aAlpha
+
alpha color for border (0.0-1.0)
+
+
+ + + + + + +
Publicprocedure SetFilter(const aMin, aMag: GLenum);
+

+set new texture filer

+
Parameters
+
+
aMin
+
min filter
+
aMag
+
mag filter
+
+
+ + + + + + +
Publicprocedure SetWrap( const S: GLenum = GL_CLAMP_TO_EDGE; const T: GLenum = GL_CLAMP_TO_EDGE; const R: GLenum = GL_CLAMP_TO_EDGE);
+

+set new texture wrapping

+
Parameters
+
+
S
+
texture wrapping for x axis
+
T
+
texture wrapping for y axis
+
R
+
texture wrapping for z axis
+
+
+ + + + + + +
Publicprocedure SetSwizzle(const r, g, b, a: GLenum);
+

+set new swizzle

+
Parameters
+
+
r
+
swizzle for red channel
+
g
+
swizzle for green channel
+
b
+
swizzle for blue channel
+
a
+
swizzle for alpha channel
+
+
+ + + + + + +
Publicprocedure Bind(const aEnableTextureUnit: Boolean = true); virtual;
+

+bind texture

+
Parameters
+
+
aEnableTextureUnit
+
enable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D))
+
+
+ + + + + + +
Publicprocedure Unbind(const aDisableTextureUnit: Boolean = true); virtual;
+

+bind texture

+
Parameters
+
+
aDisableTextureUnit
+
disable texture unit for this texture (e.g. glEnable(GL_TEXTURE_2D))
+
+
+ + + + + + +
Publicconstructor Create; overload;
+

+constructor - created an empty texture

+
+ + + + + + +
Publicconstructor Create(const aFileName: String); overload;
+

+constructor - creates a texture and load it from a file

+
Parameters
+
+
aFilename
+
file to load texture from
+
+
+ + + + + + +
Publicconstructor Create(const aStream: TStream); overload;
+

+constructor - creates a texture and load it from a stream

+
Parameters
+
+
aStream
+
stream to load texture from
+
+
+ + + + + + +
Publicconstructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; aData: PByte = nil); overload;
+

+constructor - creates a texture with the given size, format and data you can control this by setting DeleteTextureOnFree, FreeDataOnDestroy and FreeDataAfterGenTexture

+
Parameters
+
+
aSize
+
size of the texture
+
aFormat
+
format of the given data
+
aData
+
texture data - be carefull: the data will now be managed by the glBitmap object,
+
+
+ + + + + + +
Publicconstructor Create(const aSize: TglBitmapSize; const aFormat: TglBitmapFormat; const aFunc: TglBitmapFunction; const aArgs: Pointer = nil); overload;
+

+constructor - creates a texture with the given size and format and uses the given callback to create the data

+
Parameters
+
+
aSize
+
size of the texture
+
aFormat
+
format of the given data
+
aFunc
+
callback to use for generating the data
+
aArgs
+
user defined parameters (use at will)
+
+
+ + + + + + +
Publicconstructor Create(const aInstance: Cardinal; const aResource: String; const aResType: PChar = nil); overload;
+

+constructor - creates a texture and loads it from a resource

+
Parameters
+
+
aInstance
+
resource handle
+
aResource
+
resource indentifier
+
aResType
+
resource type (if known)
+
+
+ + + + + + +
Publicconstructor Create(const aInstance: Cardinal; const aResourceID: Integer; const aResType: PChar); overload;
+

+constructor - creates a texture and loads it from a resource

+
Parameters
+
+
aInstance
+
resource handle
+
aResourceID
+
resource ID
+
aResType
+
resource type (if known)
+
+
+ + + + + + +
Privatefunction LoadRAW(const aStream: TStream): Boolean;
+

+try to load a RAW image from a stream

+
Parameters
+
+
aStream
+
stream to load RAW image from
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Privateprocedure SaveRAW(const aStream: TStream);
+

+save texture data as RAW image to stream

+
Parameters
+
+
aStream
+
stream to save data to
+
+
+ + + + + + +
Privatefunction LoadBMP(const aStream: TStream): Boolean;
+

+try to load a BMP from a stream

+
Parameters
+
+
aStream
+
stream to load BMP from
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Privateprocedure SaveBMP(const aStream: TStream);
+

+save texture data as BMP to stream

+
Parameters
+
+
aStream
+
stream to save data to
+
+
+ + + + + + +
Privatefunction LoadTGA(const aStream: TStream): Boolean;
+

+try to load a TGA from a stream

+
Parameters
+
+
aStream
+
stream to load TGA from
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Privateprocedure SaveTGA(const aStream: TStream);
+

+save texture data as TGA to stream

+
Parameters
+
+
aStream
+
stream to save data to
+
+
+ + + + + + +
Privatefunction LoadDDS(const aStream: TStream): Boolean;
+

+try to load a DDS from a stream

+
Parameters
+
+
aStream
+
stream to load DDS from
+
+
Returns
+

True on success, False otherwise

+ + + + + + +
Privateprocedure SaveDDS(const aStream: TStream);
+

+save texture data as DDS to stream

+
Parameters
+
+
aStream
+
stream to save data to
+
+
+

Properties

+ + + + + + +
Protectedproperty Width: Integer read GetWidth;
+

+the actual width of the texture

+
+ + + + + + +
Protectedproperty Height: Integer read GetHeight;
+

+the actual height of the texture

+
+ + + + + + +
Protectedproperty FileWidth: Integer read GetFileWidth;
+

+the width of the texture or 1 if the width is zero

+
+ + + + + + +
Protectedproperty FileHeight: Integer read GetFileHeight;
+

+the height of the texture or 1 if the height is zero

+
+ + + + + + +
Publicproperty ID: Cardinal read fID write SetID;
+

+name of the OpenGL texture object

+
+ + + + + + +
Publicproperty Target: Cardinal read fTarget write SetTarget;
+

+texture target (e.g. GL_TEXTURE_2D)

+
+ + + + + + +
Publicproperty Format: TglBitmapFormat read fFormat write SetFormat;
+

+format the texture data is stored in

+
+ + + + + + +
Publicproperty MipMap: TglBitmapMipMap read fMipMap write SetMipMap;
+

+mipmap type

+
+ + + + + + +
Publicproperty Anisotropic: Integer read fAnisotropic write SetAnisotropic;
+

+anisotropic level

+
+ + + + + + +
Publicproperty FormatDesc: TglBitmapFormatDescriptor read GetFormatDesc;
+

+format descriptor that describes the format of the stored data

+
+ + + + + + +
Publicproperty Filename: String read fFilename;
+

+filename the texture was load from

+
+ + + + + + +
Publicproperty CustomName: String read fCustomName write SetCustomName;
+

+user defined name (use at will)

+
+ + + + + + +
Publicproperty CustomNameW: WideString read fCustomNameW write SetCustomNameW;
+

+user defined name (as WideString; use at will)

+
+ + + + + + +
Publicproperty CustomData: Pointer read fCustomData write SetCustomData;
+

+user defined data (use at will)

+
+ + + + + + +
Publicproperty DeleteTextureOnFree: Boolean read fDeleteTextureOnFree write SetDeleteTextureOnFree;
+

+delete texture object when this object is destroyed

+
+ + + + + + +
Publicproperty FreeDataOnDestroy: Boolean read fFreeDataOnDestroy write SetFreeDataOnDestroy;
+

+free stored data when this object is destroyed

+
+ + + + + + +
Publicproperty FreeDataAfterGenTexture: Boolean read fFreeDataAfterGenTexture write SetFreeDataAfterGenTexture;
+

+free stored data after it is uplaoded to video card

+
+ + + + + + +
Publicproperty Dimension: TglBitmapSize read fDimension;
+

+size of the texture

+
+ + + + + + +
Publicproperty Data: PByte read fData;
+

+texture data (or Nil if unset)

+
+
Generated by PasDoc 0.13.0 on 2014-12-21 15:05:48 + +