Recent

Author Topic: BGRA Bilinear Zoom  (Read 460 times)

Gigatron

  • Full Member
  • ***
  • Posts: 154
  • Amiga Rulez !!
BGRA Bilinear Zoom
« on: June 20, 2024, 07:42:56 pm »
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][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  9.   BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     BGRAVirtualScreen1: TBGRAVirtualScreen;
  17.     Timer1: TTimer;
  18.     procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  19.     procedure FormCreate(Sender: TObject);
  20.     procedure Timer1Timer(Sender: TObject);
  21.   private
  22.  
  23.   public
  24.  
  25.   end;
  26.  
  27. var
  28.   Form1: TForm1;
  29.   bm : TBGRABitmap;
  30.   alpha,z : integer;
  31.     // zoom
  32.  
  33.  
  34. implementation
  35.  
  36. {$R *.lfm}
  37.  
  38. { TForm1 }
  39.  
  40.  
  41.  
  42. procedure TForm1.FormCreate(Sender: TObject);
  43. begin
  44.       bm := TBGRABitmap.Create('girls2.png');
  45.       alpha := 255;
  46. end;
  47.  
  48. procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);
  49. var
  50.   bw: TBGRABitmap;
  51.   bw2: TBGRABitmap;
  52.   bw3: TBGRABitmap;
  53. begin
  54.       bw := bm.FilterGrayScale as TBGRABitmap;
  55.       bw2:= bm.FilterGrayScale as TBGRABitmap;
  56.       bw3:= bm.FilterGrayScale as TBGRABitmap;
  57.  
  58.       bitmap.StretchPutImage(Rect(0-z,0-z,0+640+z,0+400+z),bm,dmSet,alpha);
  59.  
  60.       // Trilinear zoom test ;
  61.       bitmap.StretchPutImage(Rect(0-z,0-z,0+640+z,0+400+z),bw2,dmFastBlend,-alpha);
  62.       if(alpha=1) then
  63.       begin
  64.         bitmap.StretchPutImage(Rect(2-z,2-z,2+640+z,2+400+z),bw,dmFastBlend, 150);
  65.         bitmap.StretchPutImage(Rect(4-z,4-z,4+640+z,4+400+z),bw3,dmFastBlend,100);
  66.        end
  67. end;
  68.  
  69. procedure TForm1.Timer1Timer(Sender: TObject);
  70. begin
  71.           dec(alpha);
  72.           if(alpha <1) then
  73.           begin
  74.             alpha :=1;
  75.             inc (z,1);
  76.  
  77.             if (z>655) then
  78.             begin
  79.             z  := 0;
  80.  
  81.             end;
  82.  
  83.           end;
  84.           BGRAVirtualScreen1.RedrawBitmap;
  85. end;
  86.  
  87. end.
  88.  
  89.  
  90.  

« Last Edit: June 20, 2024, 07:50:43 pm by Gigatron »
Sub Quantum Technology ! Gigatron 68000 Colmar France;

 

TinyPortal © 2005-2018