SRL Archive - Development

Lape + TMufasaBitmap


Wizzup?

2013-03-02 19:02:46

I've created an initial branch with a proof of concept function. Olly has promised to work on it, and I've also set up an autobuild for it, TESTING ONLY: http://l0.lt/builders/lape-tmb

Right now it doesn't do *anything* aside from adding a '.foo()' function:

program new;
var b: integer;
begin
b:=createbitmap(200, 200);
writeln(ptruint(getmufasabitmap(b)));
writeln(getmufasabitmap(b).foo());
freebitmap(b);
end.

Let's use this thread for progress and questions.

Oh, right now there's one limitation, we won't be able to use the following syntax (specific for Create, since that's only way to use it like this):

TMufasaBitmap.Create();

However, this will work, once .Create() has been added.


var b: TMufasaBitmap;
b := b.Create();

So yeah, this is kind of a pain, but we'll get it fixed.

Sin

2013-03-02 19:04:56

.foo()fighters!

Olly

2013-03-02 19:06:12

:spot:

CynicRus

2013-03-03 04:46:43

Nice! I will test it soon:)

Itankbots

2013-03-03 05:20:40

Awesome! cant wait to see progress on this :)

Wizzup?

2013-03-04 06:52:35

Implemented LoadFromFile and SaveToFile as examples in latest build.

program new;
var b: integer;
bmp: TMufasaBitmap;
begin
b:=createbitmap(200, 200);

bmp := GetMufasaBitmap(b);

writeln(ptruint(bmp));
//writeln(getmufasabitmap(b).foo());

bmp.loadfromfile('/tmp/foo.png');
bmp.savetofile('/tmp/foo_copy.png');
freebitmap(b);
end.

CynicRus

2013-04-01 04:10:56

The basic functionality is implemented.
Available functions for TMufasaBitmap in LaPe:

function SaveToFile(const FileName : string) :boolean;
procedure LoadFromFile(const FileName : string);
procedure Rectangle(const Box : TBox;FillCol : TColor);
procedure FloodFill(const StartPT : TPoint; const SearchCol, ReplaceCol : TColor);
procedure FastSetPixel(x,y : integer; Color : TColor);
procedure FastSetPixels(Points : TPointArray; Colors : TIntegerArray);
procedure DrawATPA(ATPA : T2DPointArray);
procedure DrawTPA(Points : TPointArray; Color : TColor);
procedure DrawToCanvas(x,y : integer; Canvas : TCanvas);
function CreateTPA(SearchCol : TColor) : TPointArray;
function FastGetPixel(x,y : integer) : TColor;
function FastGetPixels(Points : TPointArray) : TIntegerArray;
function GetAreaColors(xs,ys,xe,ye : integer) : T2DIntArray;
procedure FastDrawClear(Color : TColor);
procedure FastDrawTransparent(x, y: Integer; TargetBitmap: TMufasaBitmap);
procedure FastReplaceColor(OldColor, NewColor: TColor);
procedure RotateBitmap(angle: Extended;TargetBitmap : TMufasaBitmap );
procedure Desaturate(TargetBitmap : TMufasaBitmap);
procedure GreyScale(TargetBitmap : TMufasaBitmap);
procedure Brightness(TargetBitmap : TMufasaBitmap; br : integer);
procedure Contrast(TargetBitmap : TMufasaBitmap; co : Extended);
procedure Invert(TargetBitmap : TMufasaBitmap);
procedure Posterize(TargetBitmap : TMufasaBitmap; Po : integer);
function Copy(const xs,ys,xe,ye : integer) : TMufasaBitmap;
function ToString : string;
procedure SetTransparentColor(Col : TColor);
function GetTransparentColor : TColor;


program new;
var b: integer;
bmp,bmp2: TMufasaBitmap;
begin
b:=createbitmap(80, 80);

bmp := GetMufasaBitmap(b);

writeln(ptruint(bmp));
//writeln(getmufasabitmap(b).foo());

bmp.loadfromfile('C:\SPS.bmp');
//bmp.savetofile('C:\lpSPS.bmp');
bmp2:=bmp.Copy(10,20,40,60);
bmp2.SaveToFile('C:\lpSPS.bmp');
freebitmap(b);
end.