Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Draw sharp lines using Painter
Draw sharp lines using Painter [message #34207] Wed, 02 November 2011 13:54 Go to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
Hello all

I would like to draw sharp lines using Painter.

Using this code:
w.Move(x0, y0).Line(x0, y0).Line(x1, y1).Stroke(0.3, color);

I get the right line:

index.php?t=getfile&id=3494&private=0'

Comparing with the left one (1 pixel width), left one seems sharper. Changing Stroke() width I do not get a sharper view.

¿Is there anything else that can be done to get a sharper line?
  • Attachment: sharp.PNG
    (Size: 0.41KB, Downloaded 448 times)


Best regards
Iñaki

[Updated on: Wed, 02 November 2011 13:58]

Report message to a moderator

Re: Draw sharp lines using Painter [message #34210 is a reply to message #34207] Wed, 02 November 2011 14:04 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1400
Registered: September 2007
Senior Contributor
You need to pass coordinates with an added 0.5 for them to look sharp. The integer coordinate is actually at the "border between two pixels", that is why it is rendered as such. Adding 0.5 places it in the "middle" of the pixel.

So don't draw a box from (0, 0) to (9, 9), draw if from (0.5, 0.5) to (9.5, 9.5).
Re: Draw sharp lines using Painter [message #34218 is a reply to message #34210] Wed, 02 November 2011 16:11 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
Great! Smile

Thank you.


Best regards
Iñaki
Re: Draw sharp lines using Painter [message #34219 is a reply to message #34218] Wed, 02 November 2011 16:13 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1400
Registered: September 2007
Senior Contributor
Did it work?
Re: Draw sharp lines using Painter [message #34221 is a reply to message #34219] Wed, 02 November 2011 17:04 Go to previous message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
cbpporter wrote on Wed, 02 November 2011 16:13

Did it work?
Yes, of course.


Best regards
Iñaki
Previous Topic: Get an Image from a DrawingDraw
Next Topic: Problem with polygon inside polygon... in Painter
Goto Forum:
  


Current Time: Fri Nov 15 00:55:49 CET 2019

Total time taken to generate the page: 0.02494 seconds