Lisp HUG Maillist Archive

color:make-rgb

Hello,

I found something strange in the computation of rgba colors on Mac OS 10.6
(and maybe 10.5 ?)

This color :

(color:make-rgb 0.21052632 0.21052632 0.21052632 0.95)

should result in a 8bits value of 64 (for r, g and b) if it is on the front
of a white background :

(let* ((foreground (* 256 0.21052632))
       (background 256))
  (+ (* foreground 0.95) (* background 0.05)))  => 64.0

On Tiger it¹s the case (checked with the colorimeter utility of the mac).
But on Snow Leopard the gray is darker : 79.

My problem is that I have a window with rounded corners built with png
images, just for the border. The background of the main pane is set with the
:background argument. So, on Snow Leopard, the rounded corners and the
background don¹t have the same color.

I¹m looking for a workaround.

Thanks for any suggestion

Denis

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: color:make-rgb


Am 02.04.2010 um 12:06 schrieb Denis Pousseur:
> 
> Hello,
> 
> I found something strange in the computation of rgba colors on Mac OS 10.6
> (and maybe 10.5 ?)
> 
> This color :
> 
> (color:make-rgb 0.21052632 0.21052632 0.21052632 0.95)
> 
> should result in a 8bits value of 64 (for r, g and b) if it is on the front
> of a white background :
> 
> (let* ((foreground (* 256 0.21052632))
>       (background 256))
>  (+ (* foreground 0.95) (* background 0.05)))  => 64.0
> 
> On Tiger it’s the case (checked with the colorimeter utility of the mac).
> But on Snow Leopard the gray is darker : 79.

Just a quick guess: Is it possible that this is caused by the change of the default gamma in snow leopard?

http://support.apple.com/kb/HT3712

ciao,
Jochen

--
Jochen Schmidt
CRISPYLOGICS
Uhlandstr. 9, 90408 Nürnberg

Telefon +49 (0)911 517 999 82
Telefax +49 (0)911 517 999 83

mailto:info@crispylogics.com
http://www.crispylogics.com




Re: color:make-rgb

Yes, it is very probable that there is a relation with this question.

But, after reading the link you sent to me, I tried different ways to save
my png images, with or without profile : the color varies, but it stays
always consistent across Tiger and SL while the capi color doesn't. No
problem for me if the two (png and capi color) are darker, I just need a way
to keep it the same in any situation.

I found also that the capi color seems only correct on SL if the profile of
the screen is set to "RGB generic profile". But, well, I can't ask users to
change their screen profiles to work with my application...

Thanks for your help

Denis


Le 2/04/10 12:22, « [NOM] » <[ADRESSE]> a écrit :

> Just a quick guess: Is it possible that this is caused by the change of the
> default gamma in snow leopard?
> 
> http://support.apple.com/kb/HT3712

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Re: color:make-rgb

I have also found that when you use an alpha less than unity, then overdrawing will gradually saturate the region color. So if the border is drawn by repeatedly overdrawing the border frame then it will become a different color than originally requested.

On Apr 2, 2010, at 03:06 AM, Denis Pousseur wrote:

> 
> Hello,
> 
> I found something strange in the computation of rgba colors on Mac OS 10.6
> (and maybe 10.5 ?)
> 
> This color :
> 
> (color:make-rgb 0.21052632 0.21052632 0.21052632 0.95)
> 
> should result in a 8bits value of 64 (for r, g and b) if it is on the front
> of a white background :
> 
> (let* ((foreground (* 256 0.21052632))
>       (background 256))
>  (+ (* foreground 0.95) (* background 0.05)))  => 64.0
> 
> On Tiger it’s the case (checked with the colorimeter utility of the mac).
> But on Snow Leopard the gray is darker : 79.
> 
> My problem is that I have a window with rounded corners built with png
> images, just for the border. The background of the main pane is set with the
> :background argument. So, on Snow Leopard, the rounded corners and the
> background don’t have the same color.
> 
> I’m looking for a workaround.
> 
> Thanks for any suggestion
> 
> Denis
> 
> -------------------------------------------------------
> Denis Pousseur
> 70 rue de Wansijn
> 1180 Bruxelles, Belgique
> 
> Tel : 32 (0)2 219 31 09
> Mail :  denis.pousseur@gmail.com
> -------------------------------------------------------
> 
> 
> 

Dr. David McClain
dbm@refined-audiometrics.com




Re: color:make-rgb

I'm not sure to understand : You mean even if there is no overlap between
the regions ? (I draw the border with a loop, but there is no overlap
between the different calls to draw-image)

Thanks

Denis

Le 2/04/10 14:28, « [NOM] » <[ADRESSE]> a écrit :

> I have also found that when you use an alpha less than unity, then overdrawing
> will gradually saturate the region color. So if the border is drawn by
> repeatedly overdrawing the border frame then it will become a different color
> than originally requested.
> 
> On Apr 2, 2010, at 03:06 AM, Denis Pousseur wrote:
> 
>> 
>> Hello,
>> 
>> I found something strange in the computation of rgba colors on Mac OS 10..6
>> (and maybe 10.5 ?)
>> 
>> This color :
>> 
>> (color:make-rgb 0.21052632 0.21052632 0.21052632 0.95)
>> 
>> should result in a 8bits value of 64 (for r, g and b) if it is on the front
>> of a white background :
>> 
>> (let* ((foreground (* 256 0.21052632))
>>       (background 256))
>>  (+ (* foreground 0.95) (* background 0.05)))  => 64.0
>> 
>> On Tiger it¹s the case (checked with the colorimeter utility of the mac)..
>> But on Snow Leopard the gray is darker : 79.
>> 
>> My problem is that I have a window with rounded corners built with png
>> images, just for the border. The background of the main pane is set with the
>> :background argument. So, on Snow Leopard, the rounded corners and the
>> background don¹t have the same color.
>> 
>> I¹m looking for a workaround.
>> 
>> Thanks for any suggestion
>> 
>> Denis
>> 
>> -------------------------------------------------------
>> Denis Pousseur
>> 70 rue de Wansijn
>> 1180 Bruxelles, Belgique
>> 
>> Tel : 32 (0)2 219 31 09
>> Mail :  denis.pousseur@gmail.com
>> -------------------------------------------------------
>> 
>> 
>> 
> 
> Dr. David McClain
> dbm@refined-audiometrics.com
> 
> 
> 

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------



Updated at: 2020-12-10 08:39 UTC