[Lazarus] "unexpected feature" of TPaintBox

Mattias Gaertner nc-gaertnma at netcologne.de
Thu May 27 12:45:58 CEST 2010


On Thu, 27 May 2010 12:30:44 +0200 (CEST)
Engelbert Buxbaum <engelbert_buxbaum at web.de> wrote:

> Hi,
> 
> the code below is part of a program to draw the Mandelbrot-set. It works, if the canvas is small (stamp-size). However, if the size is increased to 800x800, the middle 1/3 of the image is replaced by a vertical grey bar. Any ideas?

What is PB_Drawing?
If it is a TImage you have to resize it yourself. The Picture is not
resized automatically.

PB_drawing.Picture.Width:=PB_drawing.Width;
PB_drawing.Picture.Height:=PB_drawing.Height;

Mattias

 
> --------------------------------------------------------------------------------------------------
> 
> procedure TForm_MandelbrotSet.B_DrawClick(Sender: TObject);
> 
> var dp, dq : real;
>       np, nq : word;
> 
>  procedure Iterate (np, nq : word);
> 
>  var p, q, x, y, x_old : real;
>        k                       : word;
> 
>  begin
>    p := P_min + np * dp;
>    q := Q_min + nq * dq;
>    k := 0;
>    x := 0;
>    y := 0;
>    repeat
>      x_old := x;
>      x := x*x - y*y + p;
>      y := 2 * x_old * y + q;
>      inc(k);
>    until (x*x + y*y > r_max) or (k = k_max);
>    if k = k_max then k := 0;
>    PB_Drawing.Canvas.Pixels[np, PB_Drawing.Height-nq] := k;
>  end;
> 
> begin
>  dp := (P_max - P_min) / PB_Drawing.Width;
>  dq := (Q_max - Q_min) / PB_Drawing.Height;
>  for np := 1 to PB_Drawing.Width do
>  for nq := 1 to PB_Drawing.Height do
>  Iterate(np, nq);
> end;




More information about the Lazarus mailing list