"opaque pixels"

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: Klaus, FourthWorld, heatherlaine, kevinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: "opaque pixels"

Post by jacque »

Klaus wrote: Fri Jan 21, 2022 8:01 pm only "mousedown" in the card script will get fired when clicking a tranparent pixel.
Putting the mouseDown handler in the image should fix that. If there are several images add a behavior that catches the mouseDown message.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: "opaque pixels"

Post by richmond62 »

If folk had downloaded my stack with the octopus the rest of this discussion would not have taken place.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: "opaque pixels"

Post by Klaus »

Come on, guys, Samuele wants to fire a "mousedown" when he clicks the transparent pixels of an image!

That is hard to misunderstand, and my stack shows the workaround, since this is not possible with a "mousedown"
handler in the image.
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: "opaque pixels"

Post by richmond62 »

No, he doesn't, I am afraid you have things the
wrong way round.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: "opaque pixels"

Post by Klaus »

Well, that is how I understood his question.
is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Seems unambiguous to me.
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: "opaque pixels"

Post by jacque »

Klaus wrote: Fri Jan 21, 2022 9:02 pm Well, that is how I understood his question.
is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Seems unambiguous to me.
Opaque in this case means visible. He wants a mousedown to fire only if the pixels are visible.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: "opaque pixels"

Post by Klaus »

Aaaaaaaahhhhhhh, "opaque", yes, how embarrassing, sorry for the fuzz. :oops:
stam
Posts: 3214
Joined: Sun Jun 04, 2006 9:39 pm

Re: "opaque pixels"

Post by stam »

Thanks guys that was a funny read ;)


@samuele -- yes long and short of it is that PNG images will allow you to do this.

There is a lengthy discussion of this here: viewtopic.php?f=7&t=35388&hilit=bullseye, i had jumped in halfway down the thread with a similar issue and came eventually to the conclusion that PNG is the only way to go, as Richmond advised then and now...

Stam
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: "opaque pixels"

Post by jacque »

Klaus wrote: Sat Jan 22, 2022 11:07 am Aaaaaaaahhhhhhh, "opaque", yes, how embarrassing, sorry for the fuzz. :oops:
Someone might think that English wasn't your first language. :) But we still think you're clever.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: "opaque pixels"

Post by richmond62 »

Nobody should ever say that Klaus is anything but clever, but as we all get older he should
also be allowed the odd 'senior moment'.

It was Klaus, in 2001, who pointed out to me why one should generally use mouseUp instead of mouseDown,
and I will forgive him everything for that piece of invaluable advice.

And if he makes half the mistakes I do . . . 8)
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: "opaque pixels"

Post by Samuele »

allright, thanks, but my probllem is actually this
pixelsInButton.livecode.zip
(207.34 KiB) Downloaded 210 times
sorry, my bad I didn't specify that I meant an id of an image in a button.
Thanks!
Samuele.
Samuele.
stam
Posts: 3214
Joined: Sun Jun 04, 2006 9:39 pm

Re: "opaque pixels"

Post by stam »

You can't do this as an image in a button; if you click a button, you click a button regardless if the image is there or not.

Instead you need to import the PNG image as control (FILE menu -> import as control -> image)

Then add a mouseUp handler to the image's script.

download an example stack here: https://www.mediafire.com/file/nq7f5sdn ... e.zip/file
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: "opaque pixels"

Post by Samuele »

yes, but that will increase the size of the stack a lot (and then the app, and my stack is already large uselessly), because the images i import i use them more then once, that's why i made buttons with icons.
or is there a way to reduce the stack size?
thanks.
Samuele.
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: "opaque pixels"

Post by Klaus »

No need to import all of your images!
This will also work with referenced images and will not add much to the filesize of the stack!
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10430
Joined: Fri Feb 19, 2010 10:17 am

Re: "opaque pixels"

Post by richmond62 »

Here's a stack which has an image on the first card (it has 4 cards)
and a graphic object "rr" on cards 2, 3 & 4 with its backGroundPattern set
to the image on card 1.
-
SShot 2022-01-23 at 16.02.06.png
-
SShot 2022-01-23 at 15.58.48.png
-
graphic objects WILL behave like the images they have as backGroundPatterns insofar as whether
mouseDown/Up clicks get a reaction out of transparent areas.
Attachments
Multiple usage.livecode.zip
Here's the stack.
(71.4 KiB) Downloaded 217 times
Post Reply