# How to draw hairlines

Hi
In Real Studio g.Penwidth = 0.01 was drawing a Hairline. in XOJO g.Penwidth = 0.01 is not visible, neither on display nor on printer.
Who knows, how to draw a hairline, like in RealStudio ?

BR
Karl

[quote=170487:@Karl Strassmann]In Real Studio g.Penwidth = 0.01 was drawing a Hairline. in XOJO g.Penwidth = 0.01 is not visible, neither on display nor on printer.
Who knows, how to draw a hairline, like in RealStudio ?[/quote]

Xojo’s penWidth is in pixels. So 0.01 is an impossibility, since by definition a pixel is the smallest possible unit in a picture. It may have worked in Real Studio, but the result was necessarily one pixel. You can easily verify it by looking at pictures generated in the past.

In practice, today, just set penwidth to 1. Or increase the size of the picture ten fold to get the same relative width as 0.01 for the line, with a resolution of 720 pixels per inch. At any rate, Xojo will always display at 72 dpi, even if you scale down.

it used to work with pen width = 0 and pen height = 1 to get 0.5 effectively on OS X.

See Feedback case 31234.

Seems to work on retina screen only with drawing scaled down picture.

Penwidth is now an integer value of pixels, and since a pixel cannot be partitioned, it makes sense.

A fractional part would work for Retina points, which represent several pixels, so 0.5 point would actually be one pixel. What I posted makes sense ; you can actually devise a 0.5 point hairline with a PenWidth value of 1 on a picture twice the size, displayed as @2x. But since there is no support for @2x Retina pictures yet, it looks a bit complex…

I cannot recall how it was in Real Studio, but from what you tell, it looks as if the value of penwidth was rounded Ceil fashion.

Thank you for answers. I programmed in RealBasic some years ago mathematical calculations with drawing Polar- and XY-diagrams.
The grid lines on the printer comes with g.Penwidth = 0.01 as hairlines, also today. I am working with OS X. Important for me is the printing and not Retina picture. Of course I am with you, that one pixel is one pixel and therefore integer ?1.

@ Michael: How I enlarge the printout to resolution 720 dpi ?

Set the MaxHorizontalResolution and MaxVerticalResolution properties of your printersetup before you open the printer.

There are many posts about how to get the printer max resolution. Just search for “printer resolution”. One of the best recent ones is IMHO https://forum.xojo.com/20027-graphics-pen-width-and-height

Printers are the most finicky of peripherals, so you may have to fiddle with the settings, but I just checked the Canon site, and the most basic printer has 2400 x 4800 resolution, so with recent printers, you should have plenty of room.