Line weight minimum?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9647
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Line weight minimum?

Post by dunbarx » Fri Nov 03, 2017 3:15 pm

I am implementing the creation, under script control, of CAD-like drawings in a project. Everything works fine, especially given the limited capabilities of LC in this regard.

But the minimum line weight (lineSize) of a LC control is 1 pixel, far heavier than I want.

I was hoping that creating an image of a line exported from a CAD program, where I have far greater flexibility in the choice of that property, would do the trick, but it seems that however thin the line in the source, once exported into LC the rendered image reverts back to 1 pixel.

I can make the rendered controls a little less visually "heavy" by increasing the blend level, but this is not what I really want.

So is there a way to have my cake after I have already eaten it? In other words, can LC support any sort of visible control that has a lineSize less than 1?

I do not mind kludges. Also, this might make me migrate to v.8 if a widget could perform this trick.

Craig Newman

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Line weight minimum?

Post by MaxV » Fri Nov 03, 2017 6:06 pm

Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9647
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Line weight minimum?

Post by dunbarx » Fri Nov 03, 2017 7:26 pm

Thanks, Max, but this is for desktop. Should have mentioned that.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Line weight minimum?

Post by jacque » Sat Nov 04, 2017 4:52 pm

Since the smallest unit on a display is one pixel, no app can draw a line thinner than that. The higher the screen resolution, the thinner the line will appear visually. Drawing programs accomplish the illusion using antialiasing, which you could apply to the line along with a slightly lighter color. That's about as close as you can get.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9647
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Line weight minimum?

Post by dunbarx » Sun Nov 05, 2017 2:52 am

Jacque.

Thanks, as usual. It is all as I thought and feared.

Modifying the blendLevel produces a "lighter" appearance, just as a small color change does. Setting or clearing the antialiased does not seem to make a difference. I can use a little bit of those kludges, but not a lot, since a clean black line is expected in the "look" of the drawings I am producing.

But CAD programs can render a line far finer than LC can, very crisp, on the same monitor. If LC is limited to a single pixel, are not those programs as well? They have to be doing something different. I just wonder what.

I cannot be the only person that would like to have finer lineWeights...

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Line weight minimum?

Post by jacque » Sun Nov 05, 2017 7:16 am

I've heard people requesting that LC should implement sub-pixel positioning which I think is what you need but I'm not sure how that works.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Line weight minimum?

Post by FourthWorld » Sun Nov 05, 2017 10:45 am

dunbarx wrote:
Sun Nov 05, 2017 2:52 am
But CAD programs can render a line far finer than LC can, very crisp, on the same monitor. If LC is limited to a single pixel, are not those programs as well? They have to be doing something different. I just wonder what.
CAD programs use a separate routine for rendering to the printer (on screen of course anything smaller than 1px is an antialiased approximation, as Jacque noted).

One way to achieve this in LC would be to have the printed version be larger than the on-screen representation, perhaps 4x or thereabouts for laser-printer quality output.

Whether you handle this on screen by replicating and scaling groups algorithmically (which is more or less what CAD programs do) or let LC handle it with the stack's scale property (with its incumbent tradeoffs) is the hard choice....
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9647
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Line weight minimum?

Post by dunbarx » Sun Nov 05, 2017 4:06 pm

@Richard.

Hmmm

The current raw output is drawn on a single card, roughly proportioned to an 8.5 x 11 sheet of paper.

Output from my gadget will always "print to PDF", which is how that output will be transmitted to the client. Once they have the PDF, they may print to paper, and always 8.5 x 11.

Intriguing idea might be making the card representation of every other element representation (there are many) 4x and the lines of interest 1x. Then see if I can print down to the "real" scale. Not sure if that makes sense...

Craig

Post Reply

Return to “Talking LiveCode”