-
June 20th, 2011, 11:25 AM
#1
A line
Hi!
I draw a line between 2 points in a view. If the line is vertical, or horizontal, i can see a line,
but for some dx/dy relations of the line i see a series of lines like a ladder or stair, trying to represent the line. I know that this is that way, and that it´s because of the pixels representation, but i want know if there is an easy way of draw lines more kindly to the sight. That seems smothers than this kind of stairs.
Thanks,
PERE.
-
June 20th, 2011, 11:44 AM
#2
Re: A line
Originally Posted by pererm
I draw a line between 2 points in a view. If the line is vertical, or horizontal, i can see a line,
but for some dx/dy relations of the line i see a series of lines like a ladder or stair, trying to represent the line. I know that this is that way, and that it´s because of the pixels representation, but i want know if there is an easy way of draw lines more kindly to the sight. That seems smothers than this kind of stairs.
The question is: HOW do you draw that line?
Here is something to read: Antialiasing with Lines and Curves
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
June 20th, 2011, 05:59 PM
#3
Re: A line
`Thanks a lot!
Is exactly what i want to know.
Thanks.
But is possible to implement antialiasing using C++ code?
In this article seems it´s impossible, Isn' t it.
PERE.
-
June 20th, 2011, 06:09 PM
#4
Re: A line
You still never answered the question asked, which is how you are drawing these lines.
The article Vladimir linked is about GDI+, but you never said anything about using GDI+ in your first post.
-
June 20th, 2011, 06:16 PM
#5
Re: A line
Ok!
I`m drawing simply using a pDC->LineTo(x,y,colorref) in the OnDraw() function.
I´m not using Gdi+. So these can be the problem. Is possible use Gdi+ in C++ code?
Thanks!
PERE
-
June 21st, 2011, 01:53 AM
#6
Re: A line
Hi,
to accomplish antialiasing you have more choices:
- GDI+ (like in the link given) can be used in c++ of course.
see http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx . The article starts with "Windows GDI+ is a class-based API for C/C++ programmers." - You can use a third party library. There are lots of them, some for free, some commercial. Google will help you to find that one you need.
- Antilaliasing can be done using "normal" Windows GDI programming too. It could be some kind of slow, but if you only need a couple of lines it could be ok too. But you've to "re-invent the wheel", which can be fun, but will be hard work anyway.
regards
PA
-
June 21st, 2011, 02:13 AM
#7
-
June 21st, 2011, 04:45 AM
#8
Re: A line
Originally Posted by pererm
Ok!
I`m drawing simply using a pDC->LineTo(x,y,colorref) in the OnDraw() function.
All of these GDI operations, line drawing, printing, etc. all depends on the device context that you're using. In other words, the "pDC" is the determining factor in all of these operations and how they perform.
If the video card you have has anti-aliasing features, then their drivers will automatically draw those lines "nicely". If you have a cheap video card that doesn't support it, then you get the jagged lines.
So unless you are trying to support bad video cards or drivers, it doesn't make sense to do anti-aliasing yourself. Let the video hardware handle it for you.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; June 21st, 2011 at 04:48 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|