Board index » delphi » Variable array size for polygon(array of TPoint) ?

Variable array size for polygon(array of TPoint) ?

I need to draw filled polygons with a variable number of points.
Delphi requires an array of points for polygon().
Since there is no provision for specifying the number of points,
(as there is in the API call), how do I do this?

Delphi must use the size of the array as declared for the maximum case.
For a  variable number of points, I have to fill the unused elements in the
array with a repeated point!  Horrible, but it works.

What is the best (or correct) way to deal with this?

My polygon can have up to about 40 points, and even on a small
window say 300 X 300 pixels takes 10's to 100's of milliseconds
to display!  (on a 386DX40)

What is the fastest way to draw a filled polygon?
(other than on a Pentium!)

Thanks,
DG
Dennis Gibson        
djg...@rsphysse.anu.edu.au
Electronics Unit
Research School of Physical Sciences & Engineering
Australian National University , ACT 0200
Australia
Phone / Fax: (06) 249 4433      [ International: +61 6 249 4433]

 

Re:Variable array size for polygon(array of TPoint) ?


Quote
djg...@rsphysse.anu.edu.au (Dennis Gibson) wrote:
>I need to draw filled polygons with a variable number of points.
>Delphi requires an array of points for polygon().
>Since there is no provision for specifying the number of points,
>(as there is in the API call), how do I do this?

>Delphi must use the size of the array as declared for the maximum case.
>For a  variable number of points, I have to fill the unused elements in the
>array with a repeated point!  Horrible, but it works.

>What is the best (or correct) way to deal with this?

>My polygon can have up to about 40 points, and even on a small
>window say 300 X 300 pixels takes 10's to 100's of milliseconds
>to display!  (on a 386DX40)

>What is the fastest way to draw a filled polygon?
>(other than on a Pentium!)

        Use Wintypes.Polygon instead.

--
David Ullrich
Don't you guys find it tedious typing the same thing
after your signature each time you post something?
I know I do, but when in Rome...

Re:Variable array size for polygon(array of TPoint) ?


In article <djg113.14.009F0...@rsphysse.anu.edu.au>,
   djg...@rsphysse.anu.edu.au (Dennis Gibson) wrote:

Quote
>I need to draw filled polygons with a variable number of points.
>Delphi requires an array of points for polygon().
>Since there is no provision for specifying the number of points,
>(as there is in the API call), how do I do this?

Use the API call if that's what you need. That is all the method is calling
after sorting out all the arguements. There is no law that says you have to
use the Canvas method if you don't want to. It should also help your speed
problem a little.

Quote
>Delphi must use the size of the array as declared for the maximum case.
>For a  variable number of points, I have to fill the unused elements in the
>array with a repeated point!  Horrible, but it works.

>What is the best (or correct) way to deal with this?

>My polygon can have up to about 40 points, and even on a small
>window say 300 X 300 pixels takes 10's to 100's of milliseconds
>to display!  (on a 386DX40)

>What is the fastest way to draw a filled polygon?
>(other than on a Pentium!)

You could use a DIB and draw directly on the bitmap using your own ASM
routines. There is a lot of ASM source around for this on ftp://x2ftp.oulu.fi.

-----------------------------------------------
Mike Chapin
Powder River
mcha...@vcn.com
http://www.vcn.com/server/netizens/mchapin/first.html
Gillette, WY

Not the end of the earth but you can see it from
there.
-----------------------------------------------

Other Threads