Transparency to a button icon background

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Transparency to a button icon background

Post by richmond62 » Sun Feb 14, 2021 12:20 pm

As a heart attack survivor whose life was saved by the hard work of some wonderful
surgeons I have only admiration for your work.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Transparency to a button icon background

Post by richmond62 » Sun Feb 14, 2021 1:30 pm

segment-American-Heart-Association-bulls-eye-plot-demonstrating-the-distribution-of.png

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Transparency to a button icon background

Post by richmond62 » Sun Feb 14, 2021 5:38 pm

there is no problem knowing which graphic was clicked on
Well, Yes, BUT, what about penguins?
-
PPP.jpg
Attachments
KP.livecode.zip
Here's the stack.
(180.77 KiB) Downloaded 192 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Transparency to a button icon background

Post by dunbarx » Sun Feb 14, 2021 5:49 pm

Richmond.

I was too hasty, and deleted my post. Oval graphics won't work. I thought it would be simple to manage the rects of a pile of them, but it is not.

Polygon graphics work fine, but are tedious to create with smooth inner and outer curves.

Craig

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Transparency to a button icon background

Post by stam » Sun Feb 14, 2021 7:32 pm

Well after a bit more sleep i've redesigned everything. PNG images are the only way to go.

I used Affinity Designer (vector graphics app) to create each segment accurately (60°arcs, correct ring widths etc) with transparent backgrounds.
i exported these as both SVG and PNG.

The SVGs are a definite problem when importing as image control - the transparent space still acts as clickable area. If instead of importing SVGs as controls i create an SVG widget and copy the path to the widget, the same problem still occurs. Changing the layering does not produce fix the issue completely.

Importing the images as PNG with transparent background respects the transparent bits and no there is no overlapping of clickable areas (and the 'effective' keyword isn't needed).

I also fine-tuned this as a gadget that hold's its scoring internally, triggers popups to allow scoring of each individual segments, provides a useable API so i can reuse and uses 'inner glow' to colour each segment according to score (previously i fudged tis by exporting multiple .png files with various colours and hiding the ones i didn't want... very kludgy). Much smoother now...
Attachments
bullseye - revised.jpg

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Transparency to a button icon background

Post by dunbarx » Mon Feb 15, 2021 2:52 am

I said:
Polygon graphics work fine, but are tedious to create with smooth inner and outer curves.
It turns out that making polygon graphic portions of a circle are not so tedious. In the script of a 500 sided regular polygon:

Code: Select all

on mouseUp
   repeat with y = 126 to 250 -- or 1 to 125, 251 to 375, whatever
      put line y of the effective points of  grc "base" into line y of pointList
   end repeat
   put the loc of grc "base"  & return before  line 1 of pointList
   put return & the loc of grc "base" after last line of pointList
   
   create grc
   set the style of last grc to "polygon"
   set the  points of last grc to pointList
   set the left of last grc to the right of me + 10
   set the opaque of last grc to "true"
end mouseUp
These can be tailored with any "radius" and arcAngle, and stacked together to create the OP's cool bullseye, more recent small ones on top of the older and larger. No overlapping rects to interfere with the clickLoc. LC is not a drafting program, and I fool around with this to fool both it and myself.

Stam said:
PNG images are the only way to go.
Whether my little ditties are too old fashioned, with all these new fangled PNG's and SVG's, is another story.

Craig

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Transparency to a button icon background

Post by richmond62 » Mon Feb 15, 2021 9:01 am

How you generate your "wedges of cheese" is entirely up to you.

I would still favour using PNG images over graphic objects unless you are prepared to do all the "monkeying around"
to have them scale properly.
LC is not a drafting program
No, it isn't.

It is an easily accessible GUI + programming language.

But as all drafting programs are 'just' piles of clever code, there is no
earthly reason that one cannot have piles of clever code inwith LiveCode to do
some drafting with.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Transparency to a button icon background

Post by FourthWorld » Mon Feb 15, 2021 5:06 pm

richmond62 wrote:
Mon Feb 15, 2021 9:01 am
But as all drafting programs are 'just' piles of clever code, there is no
earthly reason that one cannot have piles of clever code inwith LiveCode to do
some drafting with.
Only one: available time.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10078
Joined: Fri Feb 19, 2010 10:17 am

Re: Transparency to a button icon background

Post by richmond62 » Mon Feb 15, 2021 5:35 pm

Tangentially messing around:
-
Screenshot 2021-02-15 at 18.34.13.png
Attachments
Archangel.livecode.zip
Here's the stack.
(937 Bytes) Downloaded 167 times

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Transparency to a button icon background

Post by stam » Mon Feb 15, 2021 8:43 pm

Hey Richmond, neat trick - will definitely remember that one.

Don't think i would be able to use something like this though... it would require twice the number of controls (2 ovals per segment) - and lining 32 controls up neatly would be a pain, not to mention the issue with clicking overlapping rects would probably multiply rather than diminish.

Even if there is there a way to just draw arcs/lines directly to make the shape of a segment in my bullseye, it's probably going to be much more time consuming that what i'm doing now. Affinity Designer (and i imagine most/all vector graphics apps) has a 'donut' tool that makes this a synch. I generated the vector graphics for all segments and exported as .png in about 15-20 mins, and i don't have to worry at all about layering overlapping rects :)
Just a pity there isn't a similar donut tool for LC! (admittedly use cases would really be limited but i would definitely have use for a robust donut ;))

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Transparency to a button icon background

Post by bogs » Mon Feb 15, 2021 9:00 pm

stam wrote:
Mon Feb 15, 2021 8:43 pm
Just a pity there isn't a similar donut tool for LC! (admittedly use cases would really be limited but i would definitely have use for a robust donut ;))
You mean like this? (2 minutes)

Image
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Transparency to a button icon background

Post by FourthWorld » Mon Feb 15, 2021 9:04 pm

stam wrote:
Mon Feb 15, 2021 8:43 pm
Just a pity there isn't a similar donut tool for LC! (admittedly use cases would really be limited but i would definitely have use for a robust donut ;))
Doable, but with so few use cases not yet done.

I had a similar need for a simple isometric polygon extrusion tool this weekend. Can't say when I'll finish it, since I don't even really need it myself. ;)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Transparency to a button icon background

Post by FourthWorld » Mon Feb 15, 2021 9:05 pm

bogs wrote:
Mon Feb 15, 2021 9:00 pm
stam wrote:
Mon Feb 15, 2021 8:43 pm
Just a pity there isn't a similar donut tool for LC! (admittedly use cases would really be limited but i would definitely have use for a robust donut ;))
You mean like this? (2 minutes)

Image
How does that handle hit testing for each region?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 3061
Joined: Sun Jun 04, 2006 9:39 pm

Re: Transparency to a button icon background

Post by stam » Mon Feb 15, 2021 9:28 pm

it's not just handling clicks for each segment - each segment has to be able to maintain an independent state, in simplest terms a colour indicating a score. So each segment has to be an independent object or group really.

You can see this in my previous post, where the yellow segment is more abnormal that the surrounding green segments. The group has a custom property array to store all scores and colours each segment accordingly.

The only issue i'm having now is speed - simply colouring the segments is very quick, but doing a per-segment database update (or even a data grid update) slows the process quite a bit. I'm sure i can get it faster.......

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Transparency to a button icon background

Post by bogs » Mon Feb 15, 2021 9:31 pm

FourthWorld wrote:
Mon Feb 15, 2021 9:05 pm
How does that handle hit testing for each region?
By itself, it doesn't, however, I doubt it would take much to make it do so at least as good as a transparent png, since you could export each quadrant as one then re-import the pieces of it pretty easily. I'm thinking set the png export as the corner (in turn) to the loc of the graphic (4 points), on re-import set the various corners to the loc of the graphic.

If the above isn't clear, or you think there is a hole in my theory somewhere, lemme know and I'll work up a stack.
it's not just handling clicks for each segment - each segment has to be able to maintain an independent state, in simplest terms a colour indicating a score. So each segment has to be an independent object or group really.
That may push back a demo a little hee hee, but again, I'm pretty sure it is doable.
Image

Post Reply