Solved

# round rectangle drawing algorithm needed!!!

Posted on 2001-06-26
Medium Priority
1,227 Views
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
Question by:techpage
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 1

Expert Comment

ID: 6228057
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

LVL 3

Author Comment

ID: 6229912
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

LVL 3

Author Comment

ID: 6229921
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

LVL 1

Accepted Solution

jacobkristensen earned 120 total points
ID: 6230210
1) You rotate the DC.
3) Rotate back.
0

LVL 3

Author Comment

ID: 6232792
does it sacrifice much processing time??
0

LVL 1

Expert Comment

ID: 6234196
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

LVL 49

Expert Comment

ID: 8440609
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.

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 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

LVL 23

Expert Comment

ID: 9490133
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:

Roshan Davis
EE Cleanup Volunteer
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
###### Suggested Courses
Course of the Month14 days, 4 hours left to enroll