How to draw a rectangle with only two rounded corners?

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: How to draw a rectangle with only two rounded corners?

Post by bn » Sat Nov 20, 2021 9:27 pm

Hi Richmond,

could you have a look at the points of grc "Polygon" and make sure that the point of the first line of the points is the same as the point of the last line of the points

If not then copy the point of the first line and put it into a new line after the last line of the points.

Or try

Code: Select all

put the points of grc "polygon into tPoints
   if line 1 of tPoints is not line -1 of tPoints then put cr & line 1 of tPoints after tPoints
set the points of grc "polygon to tPoints
Kind regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4002
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: How to draw a rectangle with only two rounded corners?

Post by bn » Sat Nov 20, 2021 9:58 pm

Hi Richmond,

That was indeed the problem.

What you also could do is to set the "opaque" of grc "Polygon" to true, that also closes the points

Kind regards
Bernd

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: How to draw a rectangle with only two rounded corners?

Post by richmond62 » Sat Nov 20, 2021 10:00 pm

Thanks so much, Bernd.

Bedtime round these parts: I'll try tomorrow.

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: How to draw a rectangle with only two rounded corners?

Post by stam » Sun Nov 21, 2021 12:45 am

jacque wrote:
Sat Nov 20, 2021 8:53 pm
I wasn't able to get this link to work, even after removing the extra spaces.
Yeh the link posted above has issues. The correct link to Andreas' repo is https://github.com/Hoerwi/LC-Widget-customRect

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: How to draw a rectangle with only two rounded corners?

Post by richmond62 » Sun Nov 21, 2021 5:52 pm

SuperCard . . . I think it was called the Shrink Tool.
Well . . . I wonder how close SuperTalk is to LiveCode . . . ?

Of course Super Card is closed source as far as I know, so no "Chicken Nuggets".

But an attempt to copy functionality is not haram.

Will have to download a trial on one of my cranky old Macs that can cope with 32-bit apps.

[Yes, Happy Campers, SuperCard is both 32-bit and has stated it is not likely to become 64-bit anytime
soon . . .]

Andreas S.
Posts: 5
Joined: Fri Nov 19, 2021 1:12 pm
Location: Germany

Re: How to draw a rectangle with only two rounded corners?

Post by Andreas S. » Sun Nov 21, 2021 5:59 pm

stam wrote:
Sun Nov 21, 2021 12:45 am
jacque wrote:
Sat Nov 20, 2021 8:53 pm
I wasn't able to get this link to work, even after removing the extra spaces.
Yeh the link posted above has issues. The correct link to Andreas' repo is https://github. :twisted: com/Hoerwi/LC-Widget-customRect
Jepp... i know... i cant post links here... only with "Spaces" it will accepted

Btw.. i´m workin on customRect2

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: How to draw a rectangle with only two rounded corners?

Post by stam » Sun Nov 21, 2021 11:26 pm

Andreas S. wrote:
Sun Nov 21, 2021 5:59 pm
Jepp... i know... i cant post links here... only with "Spaces" it will accepted
Yeah, I think you need to have made some 7 or 10 posts or something like that before you can post links...
Andreas S. wrote:
Sun Nov 21, 2021 5:59 pm
Btw.. i´m workin on customRect2
Fantastic - look forward to it!

scott_morrow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 29
Joined: Tue Jun 27, 2006 8:35 pm
Location: Bellingham, WA USA
Contact:

Re: How to draw a rectangle with only two rounded corners?

Post by scott_morrow » Mon Nov 22, 2021 10:50 am

The widgets being discussed here: Ralf Bitter's "Universal Button" and Andreas Strauch's "CustomRect"... should we expect that they would display properly on Android? Both of them appear to provide a nice solution in the IDE... but when I run them on Android they don't draw correctly. So far, fiddling with AcceleratedRendering hasn't helped.
Elementary Software
...now with 20% less chalk dust!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: How to draw a rectangle with only two rounded corners?

Post by richmond62 » Mon Nov 22, 2021 1:16 pm

This is slightly OT, but I have been having a spot of recreation with Inkscape:

https://inkscape.org/
-
SShot 2021-11-22 at 14.14.36.png
SShot 2021-11-22 at 14.14.36.png (6.92 KiB) Viewed 5259 times
-
SShot 2021-11-22 at 14.15.11.png
SShot 2021-11-22 at 14.15.11.png (8.65 KiB) Viewed 5259 times
-
Which I wish were a capability in LiveCode.

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

Re: How to draw a rectangle with only two rounded corners?

Post by FourthWorld » Mon Nov 22, 2021 5:35 pm

richmond62 wrote:
Sun Nov 21, 2021 5:52 pm
SuperCard . . . I think it was called the Shrink Tool.
Well . . . I wonder how close SuperTalk is to LiveCode . . . ?
The two languages are very similar, but just different enough that after doing several ports from SC to LC I came to the opinion that the better strategy is redesign with reimplementation by hand.

The Shrink tool, however, draws our attention to the biggest difference - not between the languages, but between the IDEs.

SC had something I've not seen elsewhere, SuperEdit, a separate environment focused on layout where you can operate without any scripts running.

Written entirely in C, SuperEdit had a few goodies that weren't part of the language.

If memory serves (it's been quite while since I ran SC), the Shrink tool was present only in SuperEdit.

If that's true, there's a good chance its code came from SuperPaint, another popular app from the same original publisher, Silicon Beach Software.

Even if SC's Shrink tool was only in SuperEdit, it should still be possible to script a similar thing in LC. I vaguely recall someone having done something quite similar here in these forums some years ago.

But it wouldn't be as easy as just looking at a SuperCard script for inspiration. It would need to be written from scratch.

And the original being in compiled object code and an LC version being in script, we should expect the usual performance differences between native and interpreted code.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Andreas S.
Posts: 5
Joined: Fri Nov 19, 2021 1:12 pm
Location: Germany

Re: How to draw a rectangle with only two rounded corners?

Post by Andreas S. » Mon Nov 22, 2021 6:45 pm

scott_morrow wrote:
Mon Nov 22, 2021 10:50 am
The widgets being discussed here: Ralf Bitter's "Universal Button" and Andreas Strauch's "CustomRect"... should we expect that they would display properly on Android? Both of them appear to provide a nice solution in the IDE... but when I run them on Android they don't draw correctly. So far, fiddling with AcceleratedRendering hasn't helped.
hmm... since I never thought about using it on mobiles, I must confess that I never thought about it.

So my question is, how do widgets in general that are not written exclusively for mobile behave on Android or iOS?
On Win-Systems and on my Raspberry (Debian and Ubuntu) they work fine.
I'll have to see how this must be defined for androids in the LCB.

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

Re: How to draw a rectangle with only two rounded corners?

Post by jacque » Mon Nov 22, 2021 7:03 pm

@scott How does it draw on Android? A screenshot would help. I wonder if it has to do with the automatic card resizing that happens on mobile.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2682
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: How to draw a rectangle with only two rounded corners?

Post by stam » Mon Nov 22, 2021 9:14 pm

jacque wrote:
Mon Nov 22, 2021 7:03 pm
@scott How does it draw on Android? A screenshot would help. I wonder if it has to do with the automatic card resizing that happens on mobile.
+1!
That's a really good point @jacque - it probably needs careful scaling either with on resizeStack or with the geometry manager. Only a screenshot will tell!

scott_morrow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 29
Joined: Tue Jun 27, 2006 8:35 pm
Location: Bellingham, WA USA
Contact:

Re: How to draw a rectangle with only two rounded corners?

Post by scott_morrow » Tue Nov 23, 2021 1:02 am

I'm not sure how to change the way the widget is drawn. I don't believe these widgets can be scaled like, for instance, an image... where the width and height may be reduced without changing the amount of pixel information, thereby increasing the pixel density. Simply changing the width and height doesn't seem to have any effect on the visual discrepancy. Also, I am not using any of the fullscreenmode settings. (As a test I tried setting the fullscreenmode to "noscale" but that didn't seem to change anything.)

I'm attaching three images as a comparison between what draws in the IDE and what draws on iOS and Android. (the iOS screenshot was from when the app was in darkmode) Be sure to click the image in order see the detail of the "crosshatching" background color that is drawn on Android.
Attachments
IDE.png
iOS.png
Android.png
Elementary Software
...now with 20% less chalk dust!

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9385
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: How to draw a rectangle with only two rounded corners?

Post by richmond62 » Wed Nov 24, 2021 7:41 am

Sorry, I took so long, been away perverting young minds in my ESL school.

Thank you very much for this:

Code: Select all

What you also could do is to set the "opaque" of grc "Polygon" to true, that also closes the points
Fantastically useful bit of information.

Post Reply

Return to “Talking LiveCode”