"opaque pixels"
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
"opaque pixels"
Hi, is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Thanks!
Samule.
Thanks!
Samule.
Samuele.
-
- Livecode Opensource Backer
- Posts: 10098
- Joined: Fri Feb 19, 2010 10:17 am
Re: "opaque pixels"
There is no "way" as it happens automatically:
-
-
- Attachments
-
- Pixels.livecode.zip
- Here's the stack.
- (207.58 KiB) Downloaded 149 times
Re: "opaque pixels"
I believe there is a property, “the mouseColor”, or something like that. I am not near my computer.
Anyway I think it it empty if the cursor is over an “empty” pixel.
Craig
Anyway I think it it empty if the cursor is over an “empty” pixel.
Craig
Re: "opaque pixels"
No, "the mousecolor" will not be empty but return the color of the object behind the object with the opaque pixels, usually the card.
Re: "opaque pixels"
Not near my computer.
But then there is a property that returns the “pixelColor”. What is it?
Craig
But then there is a property that returns the “pixelColor”. What is it?
Craig
Re: "opaque pixels"
Hm, did not find "pixelcolor" in the dictionary?!
And not in the old Metacard index (dictionay) either.
And not in the old Metacard index (dictionay) either.
-
- Livecode Opensource Backer
- Posts: 10098
- Joined: Fri Feb 19, 2010 10:17 am
Re: "opaque pixels"
There is no need to fuss about this as a PNG image containing transparent areas
will only 'catch' mouse messages when the end-user interacts with the opaque
part of the image, as my example stack above demonstrates.
will only 'catch' mouse messages when the end-user interacts with the opaque
part of the image, as my example stack above demonstrates.
Re: "opaque pixels"
Who are you and what have you done to richmind62?

Yes, we already understood this, I was only anwering Craigs questions.richmond62 wrote: ↑Fri Jan 21, 2022 5:21 pm... as a PNG image containing transparent areas will only 'catch' mouse messages when the end-user interacts with the opaque part of the image, as my example stack above demonstrates.
-
- Livecode Opensource Backer
- Posts: 10098
- Joined: Fri Feb 19, 2010 10:17 am
Re: "opaque pixels"
richmind62
and who are you, and what are you 'on' with those mistakes . . .only anwering Craigs

If you want to be "clever" you could have a one pixel image that was always at the mouseLoc and
then use intersect . . .

Re: "opaque pixels"
You should see "richmind62" as an accolade, Sir!
And I don't want to be clever, I AM clever!

And I don't want to be clever, I AM clever!

Re: "opaque pixels"
Samuele, this is the answer. If the image has an alpha channel, like PNG does, then it will do what you want.richmond62 wrote: ↑Fri Jan 21, 2022 5:21 pma PNG image containing transparent areas will only 'catch' mouse messages when the end-user interacts with the opaque part of the image
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: "opaque pixels"
But Samuele actually wants the opposite!jacque wrote: ↑Fri Jan 21, 2022 6:52 pmSamuele, this is the answer. If the image has an alpha channel, like PNG does, then it will do what you want.richmond62 wrote: ↑Fri Jan 21, 2022 5:21 pma PNG image containing transparent areas will only 'catch' mouse messages when the end-user interacts with the opaque part of the image
He wrote:
...
is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
...
-
- Livecode Opensource Backer
- Posts: 10098
- Joined: Fri Feb 19, 2010 10:17 am
Re: "opaque pixels"
No: he does not want the opposite.
In my example stack the opaque pixels constitute the image,
while the transparent ones inwith the image's bounding rectangle are
transparent.
In my example stack the opaque pixels constitute the image,
while the transparent ones inwith the image's bounding rectangle are
transparent.
Re: "opaque pixels"
If we click on a tranparent pixel in an image, LC does not see this pixel, but the one below it.
So we cannot have "mousedown" here! if we add a mousedown handler to the image, this will
only get executed when clicking a non transparent pixel.
You demonstrated this nicely with your example stack, only "mousedown" in the card script
will get fired when clicking a tranparent pixel.
So we cannot have "mousedown" here! if we add a mousedown handler to the image, this will
only get executed when clicking a non transparent pixel.
You demonstrated this nicely with your example stack, only "mousedown" in the card script
will get fired when clicking a tranparent pixel.
Re: "opaque pixels"
@Samuele,
this stack will do what you want, check the card script and the script of the image.
Best
Klaus
this stack will do what you want, check the card script and the script of the image.
Best
Klaus
- Attachments
-
- Pixels2.livecode.zip
- (207.53 KiB) Downloaded 142 times