unit UNT_AM_Main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, jpeg, ComCtrls;
type
TFRM_Main =
class(TForm)
BTN_Options: TBitBtn;
BTN_Zeichnen: TBitBtn;
IMG_Apfelmann: TImage;
SHP_Unterteilung: TShape;
BTN_Close: TBitBtn;
BTN_Hilfe: TBitBtn;
PRB_Laden: TProgressBar;
procedure BTN_OptionsClick(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormCreate(Sender: TObject);
procedure BTN_ZeichnenClick(Sender: TObject);
procedure BTN_CloseClick(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure IMG_ApfelmannClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
FRM_Main: TFRM_Main;
implementation
uses UNT_AM_Options;
{$R *.dfm}
var x_bild,y_bild,kmax,k,rmax,xo,xu,yl,yr : integer;
x,xalt,y,dx,dy,creal,cimag : real;
xmax,xmin,ymax,ymin : real;
md : boolean;
procedure iteration(x_bild,y_bild: integer);
begin
x := xmin + x_bild*dx;
y := ymax - y_bild*dy;
creal := (x_bild) *dx+xmin;
cimag := (400-y_bild) *dy+ymin;
k := 0;
repeat
xalt := x;
x := sqr(x) - sqr(y) + creal;
y := 2*xalt*y + cimag;
inc(k);
until (sqr(x)+sqr(y)>rmax)
or (k>kmax);
if k >= kmax
then k:=0;
FRM_Main.IMG_Apfelmann.canvas.pixels[x_bild+1,y_bild+1] := 16000000div(k+1);
end;
procedure TFRM_Main.BTN_OptionsClick(Sender: TObject);
begin
FRM_Options.show;
end;
procedure TFRM_Main.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var a,b : real;
begin
a := xmin + (x-152)*(xmax-xmin)/500;
b := ymax - (y-8)*(ymax-ymin)/400;
FRM_Options.EDT_xmin.Text := floattostrf(a,fffixed,10,8);
FRM_Options.EDT_ymax.Text := floattostrf(b,fffixed,10,8);
xo := x; yl := y; xu := x; yr := y;
md := true;
end;
procedure TFRM_Main.FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
md := false;
end;
procedure TFRM_Main.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var a,b : real;
begin
if md
then
begin
a := xmin + (x-152)*(xmax-xmin)/500;
b := ymax - (y-8)*(ymax-ymin)/400;
FRM_Options.EDT_xmax.Text := floattostrf(a,fffixed,10,8);
FRM_Options.EDT_ymin.Text := floattostrf(b,fffixed,10,8);
IMG_Apfelmann.canvas.Pen.Mode := pmnotxor;
IMG_Apfelmann.canvas.Rectangle(xo,yl,xu,yr);
IMG_Apfelmann.canvas.Rectangle(xo,yl,x,y);
IMG_Apfelmann.canvas.Pen.Mode := pmcopy;
xu := x; yr := y;
end;
end;
procedure TFRM_Main.FormCreate(Sender: TObject);
begin
md := false;
end;
procedure TFRM_Main.BTN_ZeichnenClick(Sender: TObject);
var
I: Integer;
begin
PRB_Laden.Min:=0;
PRB_Laden.Max:=50000;
for I:=0
to 50000-1
do
PRB_Laden.Position:=I;
begin
xmax := strtofloat(FRM_Options.EDT_xmax.text);
xmin := strtofloat(FRM_Options.EDT_xmin.text);
ymax := strtofloat(FRM_Options.EDT_ymax.text);
ymin := strtofloat(FRM_Options.EDT_ymin.text);
kmax := strtoint(FRM_Options.EDT_kmax.text);
rmax := strtoint(FRM_Options.EDT_rmax.Text);
creal := strtofloat(FRM_Options.EDT_creal.text);
cimag := strtofloat(FRM_Options.EDT_cimag.text);
dx := (xmax-xmin)/500;
dy := (ymax-ymin)/400;
for x_bild := 0
to 500
do
for y_bild := 0
to 400
do iteration (x_bild,y_bild);
end;
end;
procedure TFRM_Main.BTN_CloseClick(Sender: TObject);
begin
FRM_Main.Close;
FRM_Options.Close;
end;
procedure TFRM_Main.BitBtn1Click(Sender: TObject);
procedure TFRM_Main.IMG_ApfelmannClick(Sender: TObject);
begin
end;
end.