Originally Posted by
cairnswm
phxImage
One thing I found useful in the past is a Draw that draws the complete image.
My S2DL libraries (Basically what you are trying to do but using SDL and OpenGL instead) includes an image class as follows (private declarations removed):
[pascal]
TS2DLImage = Class
public
Name : String;
ImageSurface: PSDL_Surface;
Texture : TTexture;
SrcRect, DestRect: TSDL_Rect;
PatternWidthFrac, PatternHeightFrac : Single;
Transparent : Boolean;
Property Width : Integer read GetWidth;
Property Height : Integer read GetHeight;
Property PatternWidth : Integer read FPatternWidth write SetPatternWidth;
Property PatternHeight : Integer read FPatternHeight write SetPatternHeight;
Constructor Create;
Constructor CreateSizedSurface(Width,Height,ColorDepth : Integer);
Destructor Destroy; Override;
Procedure LoadFromFile(FileName : PChar); Overload;
Procedure LoadFromFile(FileName : String); Overload;
Procedure LoadFromFile(FileName : String; IsTransparent : Boolean); Overload;
Procedure DrawStretch(X,Y,W,H : Integer); Overload;
Procedure DrawStretch(X,Y,W,H, Pattern : Integer); Overload;
Procedure DrawStretchRotate(X,Y,W,H, Pattern,Degrees : Integer); Overload;
Procedure DrawStretchAlpha(X,Y,W,H, Pattern : Integer; Alpha : Single); Overload;
Procedure Draw(X,Y : Integer); Overload;
Procedure Draw(X,Y : Integer; Pattern : Integer); Overload;
Procedure DrawRotate(X,Y : Integer; Angle : Single); Overload;
Procedure DrawRotate(X,Y : Integer; Pattern : Integer; Angle : Single); Overload;
Procedure DrawAlpha(X,Y : Integer; Alpha : Single); Overload;
Procedure DrawAlpha(X,Y : Integer; Pattern : Integer; Alpha : Single); Overload;
Procedure DrawTiled(X,Y,W,H : Integer); Overload;
Procedure DrawTiled(X,Y,W,H,Pattern : Integer); Overload;
Procedure DrawArea(X,Y : Integer; IX, IY, IW, IH : Integer);
Procedure SetPixel(X,Y : Integer; Color : UInt32);
Procedure BindImage;
End;[/pascal]
Just as an idea
Bookmarks