Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ WindowCircleOp offset issue

WindowCircleOp offset issue

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #15 on Sat 28 Aug 2010 11:45 PM (UTC)
Message
Nick Gammon said:
Well looks like the rest of the day is going to be spent on this ... ;)

There's nothing I'd rather do than play with code. :D

Nick Gammon said:
It is certainly gratifying (excuse sarcasm) that the algorithm used by windows "sometimes" draws lines closer in appearance to the ones requested.

Rofl.

Nick Gammon said:
BTW testing your suggestion for wider lines certainly partly confirms what you said, but for something like an 8-pixel wide line, the rounded ends don't look very good.

Hmm, yes. It's only an approximation after all.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #16 on Sun 29 Aug 2010 02:03 AM (UTC)

Amended on Sun 29 Aug 2010 02:04 AM (UTC) by Nick Gammon

Message
Right, well this whole thing has turned out more complex than I imagined.

It seems we need control over the line end and join styles, something we didn't have before.

I have added another bitmask to the pen styles (where the default is what it always did, which was have a round end).

The results are a bit more obvious with large line widths.

This is the code for a miter join:


local win = "win"
WindowCreate(win, 0, 0, 250, 150, miniwin.pos_center_all, 0, ColourNameToRGB "green")

WindowPolygon (win, "20,50,180,50,180,20,230,70,180,120,180,90,20,90",
                    ColourNameToRGB ("cyan"),  -- pen colour
                    miniwin.pen_solid + miniwin.pen_join_miter,  -- pen style
                    10,      -- pen width
                    ColourNameToRGB("yellow"),   -- brush colour
                    miniwin.brush_solid,         -- brush style
                    true,    -- fill
                    false)   -- alternate fill

WindowShow(win, true)


Results:






Now changing the style line for a round join:


                    miniwin.pen_solid + miniwin.pen_join_round,  -- pen style


Results:







And a bevel join:


                    miniwin.pen_solid + miniwin.pen_join_bevel,  -- pen style


Results:



- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Twisol   USA  (2,257 posts)  Bio
Date Reply #17 on Sun 29 Aug 2010 02:08 AM (UTC)
Message
Slick! I didn't even realize that was possible. 4.59 will be a good release for miniwindows.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #18 on Sun 29 Aug 2010 02:26 AM (UTC)

Amended on Sun 29 Aug 2010 02:32 AM (UTC) by Nick Gammon

Message
And now line endings:


local win = "win"

WindowCreate (win, 0, 0, 100, 100, miniwin.pos_center_all, 0, ColourNameToRGB "green")

WindowLine (win, 20 , 40 , 50 , 40 , 
       ColourNameToRGB ("cyan"),  -- pen colour
       miniwin.pen_solid + miniwin.pen_endcap_flat,  -- pen style
       20)  -- pen width

WindowShow (win, true)








       miniwin.pen_solid + miniwin.pen_endcap_square,  -- pen style








       miniwin.pen_solid + miniwin.pen_endcap_round,  -- pen style





The difference between square and flat is whether the pen width overshoots the dimensions of the line (the round overshoots as well).

This shot in Photoshop shows that:



The red box is the requested width, and you can see that the line overshoots on either side (square, however) by half the pen size.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


46,701 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.