1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-04 16:35:15 -05:00

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@304 3f818213-9676-44b0-a9b4-5e4c4e03d09d

This commit is contained in:
Raymond 2009-12-20 23:23:16 +00:00
parent 4c33f0798a
commit f80a36be1b
4 changed files with 31 additions and 3 deletions

View File

@ -20,6 +20,10 @@
Bitmap.inc for the Mufasa Macro Library
}
function GetMufasaBitmap(bmp : integer): TMufasaBitmap;
begin;
result := CurrThread.Client.MBitmaps.Bmp[bmp];
end;
function CreateBitmap(w,h : integer):integer;
begin

View File

@ -137,6 +137,7 @@ AddFunction(@rs_GetUpText, 'function rs_GetUpText: string;');
{Bitmaps}
AddFunction(@GetMufasaBitmap,'function GetMufasaBitmap(bmp : integer) : TMufasaBitmap;');
AddFunction(@CreateBitmap,'function CreateBitmap(w,h :integer) : integer;');
AddFunction(@FreeBitmap,'procedure FreeBitmap(Bmp : integer);');
AddFunction(@SaveBitmap,'procedure SaveBitmap(Bmp : integer; path : string);');

View File

@ -304,22 +304,43 @@ begin
end;
procedure SIRegister_Mufasa(cl: TPSPascalCompiler);
var
Ptr : PtrUInt;
begin;
with cl.AddClassN(cl.FindClass('TObject'),'TMufasaBitmap') do
begin;
RegisterMethod('constructor create');
RegisterMethod('procedure Free');
RegisterMethod('function SaveToFile(const FileName : string) :boolean;');
RegisterMethod('procedure LoadFromFile(const FileName : string);');
RegisterProperty('Index','Integer',iptR);
end;
end;
function CreateMufasaBitmap : TMufasaBitmap;
begin;
result := CurrThread.Client.MBitmaps.Bmp[ CurrThread.Client.MBitmaps.CreateBMP(0,0)];
end;
procedure FreeMufasaBitmap(Self : TMufasaBitmap);
begin;
CurrThread.Client.MBitmaps.FreeBMP(Self.Index);
end;
procedure MufasaBitmapIndex(self : TMufasaBitmap; var Index : integer);
begin;
Index := self.Index;
end;
procedure RIRegister_Mufasa(cl: TPSRuntimeClassImporter);
begin;
with cl.Add(TMufasaBitmap) do
begin
RegisterConstructor(@TMufasaBitmap.Create,'CREATE');
RegisterConstructor(@CreateMufasaBitmap,'CREATE');
RegisterMethod(@FreeMufasaBitmap,'FREE');
RegisterMethod(@TMufasaBitmap.SaveToFile, 'SAVETOFILE');
RegisterMethod(@TMufasaBitmap.LoadFromFile, 'LOADFROMFILE');
RegisterPropertyHelper(@MufasaBitmapIndex,nil,'INDEX');
end;
end;

View File

@ -37,11 +37,13 @@ type
w,h : integer;
TransparentColor : TRGB32;
TransparentSet : boolean;
FIndex : integer;
public
OnDestroy : procedure(Bitmap : TMufasaBitmap) of object;
FakeData : array of TRGB32;
FData : PRGB32;
Index : integer;
BmpName : string; //Optional?
property Index : integer read FIndex write FIndex;
procedure SetSize(AWidth,AHeight : integer);
procedure StretchResize(AWidth,AHeight : integer);
property Width : Integer read w;