Tyvm.
I made procedure to not muck with it anymore. :)
procedure DrawBmpInBmp(var Bmp ,DestBmp :integer; x , y :integer );
var
MufasaBMP :TMufasaBitmap;
Tbmp : Tbitmap;
begin
Tbmp:= GetMufasaBitmap(DestBmp).ToTBitmap;
DrawBitmap(bmp,Tbmp.canvas,x,y);
MufasaBMP:= GetMufasaBitmap(DestBmp);
MufasaBMP.LoadFromTBitmap(Tbmp);
DestBmp:=BitmapFromString(MufasaBMP.Width, MufasaBMP.Height ,MufasaBMP.ToString);
Tbmp.Free;
MufasaBMP.Free;
end;
Test:
Put cross on code.
program Test;
{$i srl/srl.simba}
{$I srl/srl/misc/debug.simba}
var // //
w, h: integer;
bmpx ,bmpx2: Integer;
// //
TPA ,bTPA: TPointArray;
bound :tbox;
procedure DrawBmpInBmp(var Bmp ,DestBmp :integer; x , y :integer );
var
MufasaBMP :TMufasaBitmap;
Tbmp : Tbitmap;
begin
Tbmp:= GetMufasaBitmap(DestBmp).ToTBitmap;
DrawBitmap(bmp,Tbmp.canvas,x,y);
MufasaBMP:= GetMufasaBitmap(DestBmp);
MufasaBMP.LoadFromTBitmap(Tbmp);
DestBmp:=BitmapFromString(MufasaBMP.Width, MufasaBMP.Height ,MufasaBMP.ToString);
Tbmp.Free;
MufasaBMP.Free;
end;
begin
GetClientDimensions(w,h);
bmpx:= CreateBitmap(w, h);
CopyClientToBitmap(bmpx, 0, 0, w -1, h -1);
FindColorstolerance(TPA,16711680,msx1,msy1,w-1,h-1,5);
bound :=GetTpaBounds(TPA);
bmpx2:= CreateBitmap(1,1);
bmpx2:= Bitmapfromclient(bound.x1,bound.y1,bound.x2,bound.y2);
bmpx2 := posterizebitmap(bmpx2,200);
//now we want to draw bmpx2 inside bmpx
DrawBmpInBmp(bmpx2, bmpx, bound.x1, bound.y1 );
DebugBitmap(BMPX);
FreeBitmap(BMPX);
FreeBitmap(BMPX2);
end.
The following bitmaps were not freed: [1, 2]
Works good despite of little memory leak.:shifty:Anyway