Board index » delphi » Bug in draw polygon

Bug in draw polygon

I think I have found a bug when trying to draw a polygon on a form
canvas, although i'm unsure whether it is a video driver problem or a
bug with Borland Delphi 1 & Win3.1.

THE SETUP
--------------------
The machines in use are running win3.1 & Diamond Stealth 3D2000,
although a machine using WinNT Server 4 & Diamond Stealth 64 VRAM
doesn't seem to show the problem.

PROBLEM
-----------------
When drawing a filled polygon using the delphi polygon routine the pen
(border) color does not appear correct (Code 1), but only when the pen
width is 1, if it is 2 then it works.
Also if a TImage is put on the form, and the polygon is drawn on the
TImage canvas then there are no problems (Code 2).

CODE 1
-------------
With Canvas Do Begin
  Brush.Color:=clRed;
  Pen.Color:=clYellow;
  Pen.Mode:=pmCopy;
  Pen.Width:=1;
  Pen.Style:=psSolid;
  Polygon([Point(10,10), Point(100,10), Point(80,20), Point(30,20),  
                Point(10,10)]);
  Pen.Width:=2;
  Polygon([Point(10,50), Point(100,50), Point(80,60), Point(30,60),  
                Point(10,50)]);
End;

CODE 2
-------------
With Image1.Canvas Do Begin
  Brush.Color:=clRed;
  Pen.Color:=clYellow;
  Pen.Mode:=pmCopy;
  Pen.Width:=1;
  Pen.Style:=psSolid;
  Polygon([Point(10,10), Point(100,10), Point(80,20), Point(30,20),  
                Point(10,10)]);
  Pen.Width:=2;
  Polygon([Point(10,50), Point(100,50), Point(80,60), Point(30,60),  
                Point(10,50)]);
End;

SOLUTION
------------------
That's what i'm here for, but maybe using the WinAPI directly, I
haven't tried this yet.

Thanks in advance

Phill Demoore

 

Re:Bug in draw polygon


sci-cl...@sesame.dungeon.com (The Lads 'n' Lasses at Sci-Clone) wrote:

Okay after looking into the problem a bit more, it seems to be a
problem with the Diamond Stealth 3D2000 drivers, and no fix from
diamond yet (or ever by the looks of things).
The Diamond Stealth 64 DRAM works fine, and the Diamond Stealth 64
VRAM has a different problem, almost the opposite, perfect on form,
but not the image.
In addition to the symptoms listed below, the border color seems to be
whatever the last text color was, and the fix involves changing the
text color and writing a null string, forcing the change (BODGE)

With Canvas Do Begin
  Brush.Color:=clRed;
  Pen.Color:=clYellow;

  Font.Color:=clYellow;   TextOut(0,0,''); {********** FIX **********}

  Pen.Mode:=pmCopy;
  Pen.Width:=1;
  Pen.Style:=psSolid;
  Polygon([Point(10,10), Point(100,10), Point(80,20), Point(30,20),  
                Point(10,10)]);
  Pen.Width:=2;
  Polygon([Point(10,50), Point(100,50), Point(80,60), Point(30,60),  
                Point(10,50)]);
End;

Hope this helps someone.

Phill Demoore

Quote
>I think I have found a bug when trying to draw a polygon on a form
>canvas, although i'm unsure whether it is a video driver problem or a
>bug with Borland Delphi 1 & Win3.1.
>THE SETUP
>--------------------
>The machines in use are running win3.1 & Diamond Stealth 3D2000,
>although a machine using WinNT Server 4 & Diamond Stealth 64 VRAM
>doesn't seem to show the problem.
>PROBLEM
>-----------------
>When drawing a filled polygon using the delphi polygon routine the pen
>(border) color does not appear correct (Code 1), but only when the pen
>width is 1, if it is 2 then it works.
>Also if a TImage is put on the form, and the polygon is drawn on the
>TImage canvas then there are no problems (Code 2).
>CODE 1
>-------------
>With Canvas Do Begin
>  Brush.Color:=clRed;
>  Pen.Color:=clYellow;
>  Pen.Mode:=pmCopy;
>  Pen.Width:=1;
>  Pen.Style:=psSolid;
>  Polygon([Point(10,10), Point(100,10), Point(80,20), Point(30,20),  
>                Point(10,10)]);
>  Pen.Width:=2;
>  Polygon([Point(10,50), Point(100,50), Point(80,60), Point(30,60),  
>                Point(10,50)]);
>End;
>CODE 2
>-------------
>With Image1.Canvas Do Begin
>  Brush.Color:=clRed;
>  Pen.Color:=clYellow;
>  Pen.Mode:=pmCopy;
>  Pen.Width:=1;
>  Pen.Style:=psSolid;
>  Polygon([Point(10,10), Point(100,10), Point(80,20), Point(30,20),  
>                Point(10,10)]);
>  Pen.Width:=2;
>  Polygon([Point(10,50), Point(100,50), Point(80,60), Point(30,60),  
>                Point(10,50)]);
>End;
>SOLUTION
>------------------
>That's what i'm here for, but maybe using the WinAPI directly, I
>haven't tried this yet.
>Thanks in advance
>Phill Demoore

Other Threads