Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
71
Task/Image-noise/Delphi/image-noise-1.delphi
Normal file
71
Task/Image-noise/Delphi/image-noise-1.delphi
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
unit Main;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Winapi.Windows, System.SysUtils, Vcl.Forms, Vcl.Graphics, Vcl.Controls,
|
||||
System.Classes, Vcl.ExtCtrls;
|
||||
|
||||
type
|
||||
TfmNoise = class(TForm)
|
||||
tmr1sec: TTimer;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormPaint(Sender: TObject);
|
||||
procedure tmr1secTimer(Sender: TObject);
|
||||
end;
|
||||
|
||||
var
|
||||
fmNoise: TfmNoise;
|
||||
Surface: TBitmap;
|
||||
FrameCount: Cardinal = 0;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfmNoise.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Surface := TBitmap.Create;
|
||||
Surface.SetSize(320, 240);
|
||||
Surface.PixelFormat := pf1bit;
|
||||
Randomize;
|
||||
end;
|
||||
|
||||
procedure TfmNoise.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
Surface.Free;
|
||||
end;
|
||||
|
||||
type
|
||||
PDWordArray = ^TDWordArray;
|
||||
|
||||
TDWordArray = array[0..16383] of DWord;
|
||||
|
||||
procedure TfmNoise.FormPaint(Sender: TObject);
|
||||
var
|
||||
x, y: Integer;
|
||||
line: PWordArray;
|
||||
begin
|
||||
with Surface do
|
||||
for y := 0 to Height - 1 do
|
||||
begin
|
||||
line := Surface.ScanLine[y];
|
||||
for x := 0 to (Width div 16) - 1 do
|
||||
line[x] := Random($FFFF);
|
||||
// Fill 16 pixels at same time
|
||||
end;
|
||||
|
||||
Canvas.Draw(0, 0, Surface);
|
||||
Inc(FrameCount);
|
||||
Application.ProcessMessages;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TfmNoise.tmr1secTimer(Sender: TObject);
|
||||
begin
|
||||
Caption := 'FPS: ' + FrameCount.ToString;
|
||||
FrameCount := 0;
|
||||
end;
|
||||
|
||||
end.
|
||||
16
Task/Image-noise/Delphi/image-noise-2.delphi
Normal file
16
Task/Image-noise/Delphi/image-noise-2.delphi
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
object fmNoise: TfmNoise
|
||||
Left = 0
|
||||
Top = 0
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'fmNoise'
|
||||
ClientHeight = 240
|
||||
ClientWidth = 320
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnPaint = FormPaint
|
||||
object tmr1sec: TTimer
|
||||
Interval = 2000
|
||||
OnTimer = tmr1secTimer
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue