Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-05

"unexpected feature" of TPaintBox

5 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Engelbert Buxbaum

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?

Thanks in advance

Engelbert

--------------------------------------------------------------------------------------------------

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;
___________________________________________________________
NEU: WEB.DE DSL f?r 19,99 EUR/mtl. und ohne Mindest-Laufzeit!
http://produkte.web.de/go/02/

Reply by email

Mattias Gaertner
to Engelbert Buxbaum
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

Show quoted text 35 lines
-------------------------------------------------------------------------------------------------- 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;

Reply by email

Vincent Snijders
to Engelbert Buxbaum: the code below is part of a program to draw the Mandelbrot-set. It works, if the canvas…
Engelbert Buxbaum 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 widgetset / OS do you use?

Maybe see: http://bugs.freepascal.org/view.php?id=15822

Vincent

Reply by email

Martin
to Engelbert Buxbaum: the code below is part of a program to draw the Mandelbrot-set. It works, if the canvas…
Engelbert Buxbaum 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?

*Sound* *like* a known bug in certain MS-Windows versions.

They ignore SetPixel for all x coordinates with bit 8=1

you can setpixels from 0 to 255, 512, to 767, 1024 to ....

It doesn't matter in which language, you program, the bug is in windows itself

Martin

Reply by email

Marc Weustink
to Martin
Martin wrote 16 lines
On 27/05/2010 11:30, Engelbert Buxbaum 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? > *Sound* *like* a known bug in certain MS-Windows versions. They ignore SetPixel for all x coordinates with bit 8=1 you can setpixels from 0 to 255, 512, to 767, 1024 to .... It doesn't matter in which language, you program, the bug is in windows itself

AFAIK it is fixed in trunk.

Marc

Reply by email