Strange return values for $widget->rgb 
Author Message
 Strange return values for $widget->rgb

Hi all,

Because Photoshop forces me to save square canvases when I want circular
images, I figured the best way to give the illusion of a circular image was
to change the colors of the white corners of the image to match the 'fill'
color of the canvas.  For that I needed the rgb values of 'tan' so I could
make a custom color in Photoshop. So I did this:

my($r, $g, $b) = $canvas->rgb('tan');

I should be getting a value from 0 to 255, but instead I'm getting 53760,
46080, and 35840.

Any ideas?  If not, anyone happen to know the rgb value of 'tan'?  Thanks in
advance for any help.

Regards,

Dan



Thu, 16 Oct 2003 20:39:41 GMT  
 Strange return values for $widget->rgb

Quote:

> Hi all,

> Because Photoshop forces me to save square canvases when I want circular
> images, I figured the best way to give the illusion of a circular image was
> to change the colors of the white corners of the image to match the 'fill'
> color of the canvas.  For that I needed the rgb values of 'tan' so I could
> make a custom color in Photoshop. So I did this:

> my($r, $g, $b) = $canvas->rgb('tan');

> I should be getting a value from 0 to 255, but instead I'm getting 53760,
> 46080, and 35840.

> Any ideas?  If not, anyone happen to know the rgb value of 'tan'?  Thanks in
> advance for any help.

Color values range from 0 to 65535 in Tk. Just divide the result by
255.

Regards,
        Slaven

--
use Tk;$c=tkinit->Canvas(-he,20)->grid;$x=5;map{s!\n!!g;map{create$c 'line'=>
map{$a=-43+ord;($x+($a>>3)*2=>5+($a&7)*2)}split''}split"!";$x+=12}split/_/=>'K
PI1_+09IPK_K;-OA1_+K!;A__1;Q!7G_1+QK_3CLPI90,_+K!;A_+1!KQ!.N_K+1Q!.F_1+KN.Q__1+
KN._K+1Q!.F_1+KN.Q_+1Q__+1!KQ!.N_1;Q!7G_K3,09Q_+1!K.Q_K+1Q!.F_1+KN.Q_';MainLoop



Thu, 16 Oct 2003 23:37:20 GMT  
 Strange return values for $widget->rgb

Quote:

> Hi all,
> Because Photoshop forces me to save square canvases when I want circular
> images, I figured the best way to give the illusion of a circular image was
> to change the colors of the white corners of the image to match the 'fill'
> color of the canvas.  For that I needed the rgb values of 'tan' so I could
> make a custom color in Photoshop. So I did this:
> my($r, $g, $b) = $canvas->rgb('tan');
> I should be getting a value from 0 to 255, but instead I'm getting 53760,
> 46080, and 35840.
> Any ideas?  If not, anyone happen to know the rgb value of 'tan'?  Thanks in
> advance for any help.

Print the rgb() result in hexadecimal, break into thirds, and there are
your R G and B values.

Steve

'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;



Thu, 16 Oct 2003 23:33:38 GMT  
 Strange return values for $widget->rgb

Quote:

> Print the rgb() result in hexadecimal, break into thirds, and there are
> your R G and B values.

Hmmm...the docs and the Walsh book lie (they both say the rgb method returns
a decimal val).  Well, I tried the rgb values for tan (210,180,140), but
they don't quite match up between Photoshop and Tk.  The jpeg's look just a
bit darker.

Back to the drawing board.

Thanks for the help.

Dan



Fri, 17 Oct 2003 08:44:12 GMT  
 Strange return values for $widget->rgb

Quote:

>> Print the rgb() result in hexadecimal, break into thirds, and there are
>> your R G and B values.
> Hmmm...the docs and the Walsh book lie (they both say the rgb method returns
> a decimal val).  Well, I tried the rgb values for tan (210,180,140), but
> they don't quite match up between Photoshop and Tk.  The jpeg's look just a
> bit darker.
> Back to the drawing board.
> Thanks for the help.

But I didn't give you any - in fact, I was wrong.  rgb() does indeed return
RGB values.  I was mistakingly thinking of $photo->get(), which also returns
RGB numbers for a pixel in a Photo.  Early versions of Tk returned a string
which had to be split into RGB components - Tk800.022 return a list ....

Steve

'other perl hacker';$z='createText';$c=$m->Canvas(-wi,$_[1],-he,25)->grid;$c->$
En'.
'ter>',sub{$y=int(rand($m->screenheight));$m->geometry("+$y+$y")});MainLoop;



Fri, 17 Oct 2003 09:08:04 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Help: system() returns odd values after normal >>= 8

2. strange error from <Return> event

3. $widget->bind returns one binding only

4. Return values from $ftp->put

5. <SELECT multiple...> only returns 1st value

6. $arrayref->[0..2] returns first value in array only

7. HList->yview() return value

8. PERLFUNC: values - return a list of the values in a hash

9. PERLFUNC: values - return a list of the values in a hash

10. HTML::Parser value => value

11. Newbie -> $widget->send $widget->Receive ; eventGenerate

 

 
Powered by phpBB® Forum Software