Link to home
Start Free TrialLog in
Avatar of techpage
techpage

asked on

round rectangle drawing algorithm needed!!!

I've written a roundrect algorithm which takes 6 arguments: Device Context, 4 CPoints, and angle (in degree) but I couldn't get it right, there must be cracks somewhere... so... i'm wondering is there any precoded algorithm to draw round rect (rotatable) or capsule??

"Pleeeaaaseee heeelpppp" (leeloo dallas)
Avatar of jacobkristensen
jacobkristensen

Using the Platform SDK method "SetWorldTransform" you can accomplish what you want!

From MSDN lib:

SetWorldTransform
The SetWorldTransform function sets a two-dimensional linear transformation between world space and page space for the specified device context. This transformation can be used to scale, rotate, shear, or translate graphics output.

BOOL SetWorldTransform(
  HDC hdc,               // handle to device context
  CONST XFORM *lpXform   // transformation data
);
Avatar of techpage

ASKER

waitt... from function's name, if i'm not mistaken... you use SetWorldTransform to transform the whole coordinate of the Device Context, arent you? so what if I want to transfrom only certain primitives and not all ??
waitt... from function's name, if i'm not mistaken... you use SetWorldTransform to transform the whole coordinate of the Device Context, arent you? so what if I want to transfrom only certain primitives and not all ??
ASKER CERTIFIED SOLUTION
Avatar of jacobkristensen
jacobkristensen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
does it sacrifice much processing time??
Well, of course it does take some processing time, but compared to having to write all the trivial drawing methods yourself (you can use all the standard medthods), it's probably worth it.

Also, if you are looking for optimization, maybe you can group the objects together (assuming several of them needs to be drawn in the same angle), to minimize rotation.

Does your app (graphics) need to be high performance?
Avatar of DanRollins
Hi techpage,
Experts-Exchange is performing an automated process to delete old questions.  There have been no responses to this question, so it will be DELETED within 3 days.

Your points will be refunded.

If you still need the answer to this question, you should ask it again, as a new question.  Your new question will appear at the top of the list, where many Experts will see it and respond.  Here are some general tips on getting Experts to work on your questions:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
1) Offer a high point level.  Experts often concentrate on higher-valued questions.
2) Choose the best Topic Area -- target the experts who have the specific skills that you need.
3) Include keywords in the Question Title that will attract the right Experts.
4) Provide FULL DETAILS in the question body so the Experts can get right to work on a solution.
5) When an Expert does make a comment, be sure to be responsive.

For more information on Asking Questions, see http://www.cityofangels.com/Experts/Member.htm
For information on how to finalize questions, see: http://www.cityofangels.com/Experts/Closing.htm
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Please DO NOT respond to this automated post.  DO NOT ACCEPT THIS COMMENT AS AN ANSWER.  Thank you for participating at Experts-Exchange.

CleanupGuy -- EE database cleanup volunteer
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by : jacobkristensen  

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer