Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1241
  • Last Modified:

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)
0
techpage
Asked:
techpage
1 Solution
 
jacobkristensenCommented:
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
);
0
 
techpageAuthor Commented:
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 ??
0
 
techpageAuthor Commented:
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 ??
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jacobkristensenCommented:
1) You rotate the DC.
2) Draw your rotated content.
3) Rotate back.
4) Draw your non-rotated content.
0
 
techpageAuthor Commented:
does it sacrifice much processing time??
0
 
jacobkristensenCommented:
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?
0
 
DanRollinsCommented:
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
0
 
Roshan DavisCommented:
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
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now