Demo Scene BGRA Circle Demo lazarus / 39-Graphics ---------------------------------------------------------------------- Gigatron · 2024-05-27 18:40 Hi, This is my fast coding from zero to 100 in less than 20 minutes ; Learning BGRA on progress; State of the art is demo on Amiga made by Spaceballs there is a nice fx on begining with the circles ; This code (60 lines ) reproduce this fx not yet perfect with math ; https://www.youtube.com/watch?v=5aXsrYI3S6g&t=37s 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 Timer1Timer(Sender: TObject);  private   public   end; var  Form1: TForm1;  angle : single; implementation {$R *.lfm} { TForm1 } procedure TForm1.Timer1Timer(Sender: TObject);begin      BGRAVirtualScreen1.RedrawBitmap;end; procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);var  i : integer;begin      i:=0;      for i:=0 to 29 do      begin        Bitmap.Ellipse(320+80*sin(-angle),220+40*cos(-angle),20+i*20, 20+i*20,BGRA($09,$7E,$00),10 ,dmSet);       end;       for i:=0 to 33 do      begin        Bitmap.Ellipse(580,220+140*cos(angle*1.5),20+i*20, 20+i*20,BGRA($7d,$00,$4e),10 ,dmSet); // This is now correct !      end;     angle := angle + PI/180;        end;end. ---------------------------------------------------------------------- circular · 2024-05-28 15:52 You can try dmXor instead of dmSet to combine the colors when they intersect. ---------------------------------------------------------------------- Gigatron · 2024-05-28 16:45 Quote from: circular on May 28, 2024, 05:52:21 pmYou can try dmXor instead of dmSet to combine the colors when they intersect. Nice , thank you Circular ; Just added draw mode Xor and it's working well; you can now play with different parameters of circles ; * Edit a bit optimized code V0.6 : 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, StdCtrls,  Spin, BGRAVirtualScreen, BGRABitmap, BGRABitmapTypes; type   { TForm1 }   TForm1 = class(TForm)    BGRAVirtualScreen1: TBGRAVirtualScreen;    ColorButton1: TColorButton;    ColorButton2: TColorButton;    ComboBox1: TComboBox;    GroupBox1: TGroupBox;    SpinEdit1: TSpinEdit;    SpinEdit2: TSpinEdit;    Timer1: TTimer;    procedure BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);    procedure ComboBox1Change(Sender: TObject);    procedure FormCreate(Sender: TObject);    procedure Timer1Timer(Sender: TObject);  private  public  end; var  Form1: TForm1;  angle : single;  space,wdt,dmode : integer; implementation {$R *.lfm} { TForm1 } procedure TForm1.FormCreate(Sender: TObject);begin  space := 12;  wdt   := 24;  dmode :=  0;    // draw mode !end; procedure TForm1.Timer1Timer(Sender: TObject);begin      angle := angle + PI/180;      space := SpinEdit1.Value;      wdt   := SpinEdit2.Value;      BGRAVirtualScreen1.RedrawBitmap;end; procedure TForm1.BGRAVirtualScreen1Redraw(Sender: TObject; Bitmap: TBGRABitmap);var  i : integer;  drawMode: TDrawMode;  sinAngle, cosAngle, cosAngle2: single;  col1, col2: TColor;begin       if dmode=0 then drawMode:=  dmSet      else      drawMode := dmXor;      sinAngle := sin(angle * 0.6);      cosAngle := cos(-angle * 2);      cosAngle2 := cos(angle * 1.5);      col1 := TColor(ColorButton2.ButtonColor);      col2 := TColor(ColorButton1.ButtonColor);      for i:=0 to 34 do      begin      Bitmap.Ellipse(320+300*sinAngle,220+120*cosAngle,1+i*wdt, 1+i*wdt,col1,space ,drawMode);      end;      for i:=0 to 34 do      begin        Bitmap.Ellipse(560,220+140*cosAngle2,1+i*wdt, 1+i*wdt,col2,space ,drawMode);      end;end; procedure TForm1.ComboBox1Change(Sender: TObject);begin      dmode := ComboBox1.ItemIndex;end; end. ---------------------------------------------------------------------- circular · 2024-05-28 21:36 Love it ---------------------------------------------------------------------- Gigatron · 2024-05-28 22:09 Thank you, All this is becoming reality thanks to your work on the BGRA component, and the Lazarus Fpc team;