Polygon using POINTS

Polygon API require POINT* and  i have POINTS*. what is the best way to solve this issue? are there a way to convert between both types in one step without looping through all the points? also i searched for Polygon API that accept POINTS*, but i got nothing.

thanks
zhkhanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cupCommented:
What are POINTS?  It isn't a Win32 type.  

Where is it defined?  

What function is returning POINTS to you?
0
zhkhanAuthor Commented:
POINTS are defined in windef.h, as the following:

typedef struct tagPOINTS
{
#ifndef _MAC
    SHORT   x;
    SHORT   y;
#else
    SHORT   y;
    SHORT   x;
#endif
} POINTS, *PPOINTS, *LPPOINTS;

i am working in wince and trying to save memory, because my points count is huge, so prefer to use short instead of long for both x and y.
0
HappyCactusCommented:
I think there isn't, and it can't exist.
POINT and POINTS are different structures, so if you want to use a POINT you must convert it to POINTS. the loop is the only choice.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

cupCommented:
Just looked it up: never knew POINTS existed.  I think POINTS is same as COORD, which is only used in console mode.

Do you want a filled polygon or just to draw a polygon.  If it is just to draw one, then you could use MoveTo and LineTo.  If you want a filled polygon, you'll probably need to convert from POINTS to POINT before drawing.

How tight is the memory: How many points are you using and how much memory do you have?  It needs to be in the 100s and 1000s before it is a worthwhile saving.  Not worth worrying about if it is a small number.

Storing in POINTS might be a false saving as everything needs to be converted to 32 bits when it goes into the registers for drawing so you might actually be using more memory by using POINTS rather than POINT.

eg Some might think that

for (char ii = 0; ii < 20; ++ii)
   x[ii] = 0;

generates less code than

for (int ii  = 0; ii < 20; ++ii)
   x[ii] = 0;

but it is the other way round because a lot of code is generated when indexing ii as a char - it has to be extended to 32 bits before it can be used as an index and that generates more code.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pgnatyukCommented:
What do you mean in one step? You need to make a function that will convert your type into an array of POINT. It is a loop. You can use for example, vector from STL and use an algorithm, for example, for_each.
http://msdn.microsoft.com/en-us/library/c4x1w65f(VS.80).aspx
http://support.microsoft.com/kb/156345
0
cupCommented:
I think he means casting or some built in conversion function.
0
zhkhanAuthor Commented:
ya thats exactly what i meant.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.