Recent

Author Topic: TBitMap to TBGRABitmap then resize.  (Read 4142 times)

jipété

  • Full Member
  • ***
  • Posts: 182
Re: TBitMap to TBGRABitmap then resize.
« Reply #15 on: June 09, 2024, 06:21:38 pm »
4 years later, found 3 typos in ResizeMap !

Code: Pascal  [Select][+][-]
  1. procedure TForm1.ResizeMap;
  2. var  BRGAbitmap: TBGRABitmap;
  3. var aBitmap : Tbitmap;
  4. begin
  5.   aBitmap:=Tbitmap.Create;
  6.   aBitmap.SetSize(100, 100);
  7.   BRGABitmap := TBGRABitmap.Create(aBitmap);
  8.   BGRABitmap.DrawLineAntialias(0,0,100,100,clRed,5);
  9.  
  10.   BRGABitmap.ResampleFilter:=rfBestQuality;
  11.   BGRAReplace (BGRAbitmap, BRGABitmap.Resample(90, 90, rmFineResample) );
  12.   BGRAbitmap.draw(Canvas, 0,0);
  13.    BRGABitmap.Free;
  14.   ABitmap.Free;
  15.   End;
Code: Pascal  [Select][+][-]
  1. procedure TForm1.ResizeMap;
  2. var  BRGAbitmap: TBGRABitmap;
  3.   aBitmap : Tbitmap;
  4. begin
  5.   aBitmap := Tbitmap.Create;
  6.   aBitmap.SetSize(100, 100);
  7.   BRGABitmap := TBGRABitmap.Create(aBitmap);
  8. //BGRABitmap.DrawLineAntialias(0,0,100,100,clRed,5); typo
  9.   BRGABitmap.DrawLineAntialias(0,0,100,100,clRed,5);
  10.  
  11.   BRGABitmap.ResampleFilter:=rfBestQuality;
  12. //BGRAReplace(BGRAbitmap, BRGABitmap.Resample(90, 90, rmFineResample) ); typo
  13.   BGRAReplace(BRGAbitmap, BRGABitmap.Resample(90,90,rmFineResample));
  14. //BGRAbitmap.draw(Canvas, 0,0); typo
  15.   BRGAbitmap.draw(Canvas, 0,0);
  16.   BRGABitmap.Free;
  17.   ABitmap.Free;
  18. End;
  19.  

The lesson is : caution with BGRA <> BRGA !  8)

 

TinyPortal © 2005-2018