BGRA Bilinear Zoom lazarus / 39-Graphics ---------------------------------------------------------------------- Gigatron · 2024-06-20 17:42 Hi, In this Haujobb - Megademo 2000 - Amiga Demo (AGA), a cool fx is what i would like to remake ; Bilinear zoom from Optima the coder of the demo. https://www.youtube.com/watch?v=woMBJhQoi9E&t=176s Picture is from JCS; here is the code with trilinear zoom for better than demo ; no math function used; maybe there are some complex filtering method with anisotropic etc..; Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,  BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes; type   { TForm1 }   TForm1 = class(TForm)    BGRAVirtualScreen1: TBGRAVirtualScreen;    Timer1: TTimer;    procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);    procedure FormCreate(Sender: TObject);    procedure Timer1Timer(Sender: TObject);  private   public   end; var  Form1: TForm1;  bm : TBGRABitmap;  alpha,z : integer;    // zoom  implementation {$R *.lfm} { TForm1 }   procedure TForm1.FormCreate(Sender: TObject);begin      bm := TBGRABitmap.Create('girls2.png');      alpha := 255;end; procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);var  bw: TBGRABitmap;  bw2: TBGRABitmap;  bw3: TBGRABitmap;begin      bw := bm.FilterGrayScale as TBGRABitmap;      bw2:= bm.FilterGrayScale as TBGRABitmap;      bw3:= bm.FilterGrayScale as TBGRABitmap;       bitmap.StretchPutImage(Rect(0-z,0- z,0+640+z,0+400+z),bm,dmSet,alpha);       // Trilinear zoom test ;    bitmap.StretchPutImage(Rect(0-z,0- z,0+640+z,0+400+z),bw2,dmFastBlend,-alpha);      if(alpha=1) then    begin        bitmap.StretchPutImage(Rect(2-z,2-z,2+640+z,2+400+z),bw,dmFastBlend, 150);        bitmap.StretchPutImage(Rect(4-z,4- z,4+640+z,4+400+z),bw3,dmFastBlend,100);       endend; procedure TForm1.Timer1Timer(Sender: TObject);begin          dec(alpha);        if(alpha <1) then          begin            alpha :=1;            inc (z,1);             if (z>655) then            begin            z  := 0;             end;           end;          BGRAVirtualScreen1.RedrawBitmap;end; end.