Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: Onur2x on July 06, 2020, 09:33:47 pm

Title: TBGRAWinBitmap.ReallocBitmap: Windows error 87
Post by: Onur2x on July 06, 2020, 09:33:47 pm
Hello circular i am write new components.
But I encounter some errors. I sent the files in the attachment. The error I received is where do I make an error in the txt file. Can you help me? RAM is constantly increasing.
My english very bad. I am sorry.
TBGRAWinBitmap.ReallocBitmap: Windows error 87
Title: Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
Post by: circular on July 07, 2020, 03:35:58 pm
I suppose the memory leak comes from the following.

When you call GetPart or Resample, you get a new image. After using it, you need to free it.
Title: Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
Post by: Onur2x on July 07, 2020, 08:39:22 pm
procedure TONButton.Paint;
var
img:TBGRABitmap;
begin
    if FSkindata <> nil then
    begin
    img:=TBGRABitmap.Create(FSkindata.Images);
      try
        Fresim.SetSize(Self.Width,Self.Height);
        if Enabled = True then
        begin
          case FDurum of
            bsNormal: DR := Rect(FNormal.FSSOL,
                FNormal.FSUST, FNormal.FSSAG, FNormal.FSALT);
            bsbasili: DR := Rect(FBasili.FSSOL,
                FBasili.FSUST, FBasili.FSSAG, FBasili.FSALT);
            bsuzerinde: DR :=Rect(FUzerinde.FSSOL,
                FUzerinde.FSUST, FUzerinde.FSSAG, FUzerinde.FSALT);
          end;
        end
        else
        begin
          DR := Rect(FPasif.FSSOL, FPasif.FSUST, FPasif.FSSAG, FPasif.FSALT);
        end;

        Fresim.StretchPutImage(Rect(0,0,Self.Width,Self.Height),img.GetPart(DR),dmLinearBlend);

        if Crop=true then
         CropToimg(Fresim);
      finally
        FreeAndNil(img);
      end;
    end;
  inherited;
end;
     
I guess you meant that way? 
Title: Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
Post by: circular on July 07, 2020, 08:47:42 pm
No.

I meant something like:
Code: Pascal  [Select][+][-]
  1. part := img.GetPart(DR);
  2. ...
  3. part.Free;
  4.  
Title: Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
Post by: Onur2x on July 07, 2020, 08:54:37 pm
Thnks
Title: Re: TBGRAWinBitmap.ReallocBitmap: Windows error 87
Post by: circular on July 07, 2020, 09:13:10 pm
You're welcome.
TinyPortal © 2005-2018