[SOLVED] Testing mouseColor function
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
[SOLVED] Testing mouseColor function
Hi All,
Could you verify if mouseColor function works correctly
in your own setup?
Download the attached stack, decompress it and
click the button to find the only two black pixels
in the very small image (12 pixels x 12 pixels)
The script find the first black pixel on two
different lines.
Now, click inside the small image and the image
script put the mousecolor in fld 2. Click the button
again and try to find the mousecolor among the
pixels of the clicked image. Most colors produced
by the mousecolor function are not found in the
image except a few like the color 255,255,255
Please test and post your results.
Thanks in advance!
Al
Could you verify if mouseColor function works correctly
in your own setup?
Download the attached stack, decompress it and
click the button to find the only two black pixels
in the very small image (12 pixels x 12 pixels)
The script find the first black pixel on two
different lines.
Now, click inside the small image and the image
script put the mousecolor in fld 2. Click the button
again and try to find the mousecolor among the
pixels of the clicked image. Most colors produced
by the mousecolor function are not found in the
image except a few like the color 255,255,255
Please test and post your results.
Thanks in advance!
Al
Last edited by capellan on Tue Jan 15, 2019 11:53 pm, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9385
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Testing mouseColor function
1. Found selected pixel color at coordinates 4,11
2. Found selected pixel color at coordinates 6,3
3. Posted those values to the messageBox.
Clicked on the small image: 253,63,63
Button click: no result.
2. Found selected pixel color at coordinates 6,3
3. Posted those values to the messageBox.
Clicked on the small image: 253,63,63
Button click: no result.
Re: Testing mouseColor function
Hi Richmond,
is found with the small image.
and selecting a pixel color using the mousecolor
function, the script shows that this color
does not exists within the image.
Keep clicking inside the image and you will
notice that many colors reported by the
mousecolor function does not exists
within the image.
Al
This is the correct result because the pixel color 0,0,0richmond62 wrote: ↑Sat Jan 12, 2019 7:54 am1. Found selected pixel color at coordinates 4,11
2. Found selected pixel color at coordinates 6,3
3. Posted those values to the messageBox.
is found with the small image.
You found the error. After clicking inside the imageClicked on the small image: 253,63,63
Button click: no result.
and selecting a pixel color using the mousecolor
function, the script shows that this color
does not exists within the image.
Keep clicking inside the image and you will
notice that many colors reported by the
mousecolor function does not exists
within the image.
Al
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Testing mouseColor function
Hi,
I found 2 black pixels here (topleft = 0,0) by hand
2,5 10.3
Results for black pixel using btn
0,0,0 4,11 6.3
Results for others colors using btn
253,111,111not found
253,189,189 not found
15,255,16 not found
255,0,0 1,2 2,2 3,2 4,2 6,12 8,3 9,3 10,3 11,3 12,3
Best
Jean-Marc
I found 2 black pixels here (topleft = 0,0) by hand
2,5 10.3
Results for black pixel using btn
0,0,0 4,11 6.3
Results for others colors using btn
253,111,111not found
253,189,189 not found
15,255,16 not found
255,0,0 1,2 2,2 3,2 4,2 6,12 8,3 9,3 10,3 11,3 12,3
Best
Jean-Marc
https://alternatic.ch
Re: Testing mouseColor function
I have updated the demo stack. Please download this new version
from the stack posted in the first message.
After testing many pixels, I suspect that the difference between
the actual pixel color and the mousecolor pixel color is the result
of a color conversion, maybe from hsl or hsv to rgb. Maybe that's
the explanation for these differences.
Al
from the stack posted in the first message.
After testing many pixels, I suspect that the difference between
the actual pixel color and the mousecolor pixel color is the result
of a color conversion, maybe from hsl or hsv to rgb. Maybe that's
the explanation for these differences.
Al
Last edited by capellan on Tue Jan 15, 2019 8:37 pm, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Testing mouseColor function
How do you define "the actual pixel color"?
Of course this is OS- and hardware-dependent!
If you mean the color of a pixel as you see it on your screen, then you could make a 1x1 snapshot.
The mouseColor does probably more: It takes the pixel color from the current "videobuffer".
This has also an alpha value. The mouseColor probably computes from that (a,r,g,b) quadrupel a possibly alpha-premultiplied (r,g,b) tripel.
Because LC doesn't set the screen display it cannot really know what the OS (and its hardware) makes with the color of a pixel that you set.
For the mousecolor LC tries to estimate a correct value, which may be, by the OS, moreover possibly bilinear (or by cubic splines) interpolated from surrouding pixels.
So it may be better to speak of "the visible pixel color" (from an 1x1 screenshot) and compare that to "the estimated pixel color" (from the mousecolor).
Of course this is OS- and hardware-dependent!
If you mean the color of a pixel as you see it on your screen, then you could make a 1x1 snapshot.
The mouseColor does probably more: It takes the pixel color from the current "videobuffer".
This has also an alpha value. The mouseColor probably computes from that (a,r,g,b) quadrupel a possibly alpha-premultiplied (r,g,b) tripel.
Because LC doesn't set the screen display it cannot really know what the OS (and its hardware) makes with the color of a pixel that you set.
For the mousecolor LC tries to estimate a correct value, which may be, by the OS, moreover possibly bilinear (or by cubic splines) interpolated from surrouding pixels.
So it may be better to speak of "the visible pixel color" (from an 1x1 screenshot) and compare that to "the estimated pixel color" (from the mousecolor).
shiftLock happens
Re: Testing mouseColor function
Probably I have to test in all desktop platforms
before reaching a definitive conclusion, but
at least in this Mac, only grays, black and white
are picked correctly by the mouseColor.
Red (255,0,0), Green (0,255,0) and Blue (0,0,255)
are converted into other similar colors.
Maybe changing screen colors it's normal in all
Mac Operating System or just a particular setting
of this OSX version.
After testing in Linux and Windows, I will report.
Al
before reaching a definitive conclusion, but
at least in this Mac, only grays, black and white
are picked correctly by the mouseColor.
Red (255,0,0), Green (0,255,0) and Blue (0,0,255)
are converted into other similar colors.
Maybe changing screen colors it's normal in all
Mac Operating System or just a particular setting
of this OSX version.
After testing in Linux and Windows, I will report.
Al
Re: Testing mouseColor function
After testing in Windows, using LC7, 8 and 9
the mouseColor function works correctly.
If you click a pixel with the color 255,0,0
then the mouseColor function returns
255,0,0 (not 245,44,11 for the same
color on Mac)
Could anyone test this stack in your
own setup and post your results?
Thanks in advance!
Al
the mouseColor function works correctly.
If you click a pixel with the color 255,0,0
then the mouseColor function returns
255,0,0 (not 245,44,11 for the same
color on Mac)
Could anyone test this stack in your
own setup and post your results?
Thanks in advance!
Al
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Testing mouseColor function
I'm confused: the sample stack posted above does not appear to use the mouseColor function, instead relying on a much more complicated method involving screen shots and approximating values across the pixels of the captured image.
FWIW I use mouseColor nearly weekly while developing, and have no recollection of it failing on Linux, Mac, or Windows.
Set the screenMouseLoc, get that color, set the screenMouseLoc back, done. Simple, efficient, fewer moving parts to break, no approximation needed.
FWIW I use mouseColor nearly weekly while developing, and have no recollection of it failing on Linux, Mac, or Windows.
Set the screenMouseLoc, get that color, set the screenMouseLoc back, done. Simple, efficient, fewer moving parts to break, no approximation needed.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Testing mouseColor function
And you believe that this is the percepted color of the pixel under the hotspot of your mouse?
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Testing mouseColor function
Given cognitive and retinal variance, I suppose that's an interesting question. All I know is that I use it all the time to pick up colors I later use for fills, and they seem to match, at least within the perceptual limits of my eyes.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Testing mouseColor function
... on your hardware. Also on (another) differently calibrated retina display?and they seem to match, at least within the perceptual limits of my eyes.
Besides visual differences (that certainly are, as you say, individually determined) there may be another less "subjective" comparison way. There are also other (even specialized) apps that have a pipette.
On Mac I get, for instance, different values from the famous GraphicConverter pipette and the LC mouseColor. Both are, when using fills, a bit away from what I see (I have from a standardized medical test 100% color perception).
Differences come, as far as I can judge this, from the inclusion of the alpha channel (transparency) and possibly also, as Al says, from conversion "errors" between color models.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Testing mouseColor function
I don't understand. An Alpha channel has no color, it merely determines the degree to which a color may be influenced by colors beneath it. If using the composite display buffer, how could the affects of translucence be excluded? If not using the display buffer, what is being used?[-hh] wrote: ↑Tue Jan 15, 2019 10:36 pm... on your hardware. Also on (another) differently calibrated retina display?and they seem to match, at least within the perceptual limits of my eyes.
Besides visual differences (that certainly are, as you say, individually determined) there may be another less "subjective" comparison way. There are also other (even specialized) apps that have a pipette.
On Mac I get, for instance, different values from the famous GraphicConverter pipette and the LC mouseColor. Both are, when using fills, a bit away from what I see (I have from a standardized medical test 100% color perception).
Differences come, as far as I can judge this, from the inclusion of the alpha channel (transparency) and possibly also, as Al says, from conversion "errors" between color models.
If LC's doing it wrong let's report it. After all, they already included the function, so rather than create complex alternatives in script we should just make the built-in one work.
All I know is I've been using screenMouseColor for many years on all three desktop platforms, and so far none of my clients or customers have complained about mis-matched colors.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Testing mouseColor function
Searching the bug DB I found the relevant report, and have requested status there.
https://quality.livecode.com/show_bug.cgi?id=11502
https://quality.livecode.com/show_bug.cgi?id=11502
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 9834
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Testing mouseColor function
This report seems related, and suggests a role of specific OS-provided color profiles as a contributing factor:
https://quality.livecode.com/show_bug.cgi?id=21517
https://quality.livecode.com/show_bug.cgi?id=21517
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn