Added TARGA and Texture units to represent & parse TARGA into and provide a standard texture format for use when drawing.
34 lines
641 B
ObjectPascal
34 lines
641 B
ObjectPascal
unit texture;
|
|
|
|
interface
|
|
|
|
uses
|
|
lmemorymanager, color;
|
|
|
|
type
|
|
TTexture = packed record
|
|
Width : uint32;
|
|
Height : uint32;
|
|
Size : uint32;
|
|
Pixels : PRGB32;
|
|
end;
|
|
PTexture = ^TTexture;
|
|
|
|
Function newTexture(width, height: uint32): PTexture;
|
|
|
|
implementation
|
|
|
|
Function newTexture(width, height: uint32): PTexture;
|
|
var
|
|
texture: PTexture;
|
|
|
|
begin
|
|
texture:= PTexture(kalloc(sizeof(TTexture)));
|
|
texture^.Pixels:= PRGB32(kalloc(width * height * sizeof(TRGB32)));
|
|
texture^.Width:= width;
|
|
texture^.Height:= height;
|
|
texture^.Size:= width * height;
|
|
newTexture:= texture;
|
|
end;
|
|
|
|
end. |