Solved

round rectangle drawing algorithm needed!!!

Posted on 2001-06-26
8
1,201 Views
Last Modified: 2013-11-20
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
Comment
Question by:techpage
8 Comments
 
LVL 1

Expert Comment

by:jacobkristensen
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

by:techpage
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

by:techpage
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 1

Accepted Solution

by:
jacobkristensen earned 30 total points
ID: 6230210
1) You rotate the DC.
2) Draw your rotated content.
3) Rotate back.
4) Draw your non-rotated content.
0
 
LVL 3

Author Comment

by:techpage
ID: 6232792
does it sacrifice much processing time??
0
 
LVL 1

Expert Comment

by:jacobkristensen
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

by:DanRollins
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.

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

Expert Comment

by:Roshan Davis
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:

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ShiftLeft challenge 21 86
Modbus - whats the maximum I can store in one register? 4 80
scoreUp challenge 14 64
Making an alias 7 101
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question