Skip to content

Commit

Permalink
The bitmap of animation is re-created only onresizing, not at each loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
fredvs committed Sep 23, 2020
1 parent 32d2a45 commit 9a7e7c5
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 302 deletions.
33 changes: 19 additions & 14 deletions src/imagedancer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ timagedancerfo = class(tdockform)
isbuzy : boolean = false;
evPauseImage: PRTLEvent;// for pausing
statusanim : integer = -1;

implementation

uses
Expand All @@ -69,6 +69,10 @@ implementation
bgragraphics,
msegl,mseglu,msesysutils,
imagedancer_mfm;

var
Bitmap: tbgrabitmap;


// Super Formula

Expand Down Expand Up @@ -161,17 +165,21 @@ procedure timagedancerfo.onpaint_imagedancerfo(const Sender: twidget;
x: double = 0;
y: double = 0;
y2: double = 0;
Bitmap: tbgrabitmap;
init: double = 0;
I, z : integer;
begin

if isbuzy = false then begin

isbuzy := true;

Bitmap := tbgrabitmap.Create(Sender.bounds_cx, Sender.bounds_cy);
isbuzy := true;

if (Bitmap.width <> Sender.bounds_cx) or (Bitmap.width <> Sender.bounds_cx)
then
begin
bitmap.free;
Bitmap := tbgrabitmap.Create(Sender.bounds_cx, Sender.bounds_cy);
end;

if dancernum = 0 then // Fractral Tree
begin

Expand All @@ -186,13 +194,7 @@ procedure timagedancerfo.onpaint_imagedancerfo(const Sender: twidget;
else
if dancernum = 1 then // Super Formula
begin
{
Bitmap.GradientFill(0, 0, Bitmap.Width, Bitmap.Height, BGRA(round(155 * multiplier),
round(200 * multiplier) , round(255 * multiplier)) , BGRA(round(155 * multiplier),
round(200 * multiplier) , round(255 * multiplier)),
gtLinear, PointF(0, 0), PointF(0, Bitmap.Height), dmSet);
}


Bitmap.GradientFill(0, 0, Bitmap.Width, Bitmap.Height, $FFEDDE , $FF9D4D,
gtlinear, PointF(0, 0), PointF(0, Bitmap.Height), dmSet);

Expand Down Expand Up @@ -228,6 +230,7 @@ procedure timagedancerfo.onpaint_imagedancerfo(const Sender: twidget;
else
if dancernum = 2 then // Hyper formula
begin

Bitmap.GradientFill(0, 0, Bitmap.Width, Bitmap.Height, cl_black, cl_black,
gtLinear, PointF(0, 0), PointF(0, Bitmap.Height), dmSet);

Expand Down Expand Up @@ -265,7 +268,6 @@ procedure timagedancerfo.onpaint_imagedancerfo(const Sender: twidget;
end;

Bitmap.draw(acanvas, 0, 0, False);
Bitmap.Free;
isbuzy := false;
end;

Expand Down Expand Up @@ -326,6 +328,7 @@ procedure timagedancerfo.ondestroy(const sender: TObject);
thethread.terminate();
application.waitforthread(thethread);
thethread.destroy();
Bitmap.Free;
RTLeventdestroy(evPauseImage);
end;

Expand All @@ -334,13 +337,15 @@ procedure timagedancerfo.ocreat(const sender: TObject);
evPauseImage := RTLEventCreate;
thethread:= tmsethread.create(@execute);
RTLeventResetEvent(evPauseImage);
Bitmap := tbgrabitmap.Create(1000,600);

end;

procedure timagedancerfo.onshow(const sender: TObject);
begin
openglwidget.fpsmax:= 30;
renderstart:= timestamp;
mainfo.tmainmenu1.menu[3].submenu[16].Caption := ' Hide Image Dancer ';
mainfo.tmainmenu1.menu[3].submenu[16].Caption := ' Hide Image Dancer ';
end;

procedure timagedancerfo.clientrectchangedexe(const sender: tcustomwindowwidget);
Expand Down
2 changes: 1 addition & 1 deletion src/songplayer.pas
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ procedure tsongplayerfo.LoopProcPlayer1();
// multiplier := ((ll1 + lr1) / 2) + ((ll2 + lr2) / 2);
RTLeventSetEvent(evPauseimage); // to resume
end;
end;
end;

if Caption = 'Player 1' then
if (spectrum1fo.spect1.Value = True) and (spectrum1fo.Visible = True) and
Expand Down
Binary file added src/strumpract
Binary file not shown.
Loading

0 comments on commit 9a7e7c5

Please sign in to comment.