Re: [PHP] Making an interactive RGB color picker

2008-03-04 Thread Casey
On 3/3/08, Keikonium <[EMAIL PROTECTED]> wrote:
> This may not be exactly what you think, but I didn't know how else to word
> the title. I basically need to make a script that will go through every
> possible color combination and print them to look just like (or similar) to
> the windows color picker. I need it in the format X-Y-Z. For example:
>
> 255-255-255
> 255-254-254
> 255-253-253
>
> What I have so far is this:
>
> ***
>  $break = print"";
> $n1 = "255";
> $n2 = "12";
> $n3 = "186";
>
> $output = print"
> \$drawrect(\$get(color_x),\$get(color_y),\$get(color_w),\$get(color_h),brushColor-$n1-$n2-$n3
> penColor-$n1-$n2-$n3)
> \$button2(\$get(color_x),\$get(color_y),0,0,\$get(color_w),\$get(color_h),,,PVAR:SET:colorize_global:brushcolor-$n1-$n2-$n3
> pencolor-$n1-$n2-$n3,TOOLTIP:\"$n1-$n2-$n3\")
> ";
>
> $output
> ?>
> ***
>
> The $drawrect, $button2, and $get are NOT php functions, but to be printed
> as actual text (which is why I have escaped them with the backslash).
> Anyways, I thought it would be easiest to separate each R-G-B value into its
> own variable ($n1, $n2, and $n3). That way I could just use some code
> (regex?) to cycle through the numbers 0 to 255.
>
> The HARD part (that I can't seem to even think of a way to make it possible)
> is to change JUST the G and B values while keeping the R value at 255. Then
> when the G and B values both hit 0, the R value is set to 254 and repeated
> until it also hits 0 with the other two. I think (?) that will do every
> possible color? I also need to print each string with the individual color
> output, and I don't know how to do that either.
>
> In short, I would like something that looks just like the windows color
> picker, and when each pixel of it is clicked, it will show me the R-G-B
> value in the format I would like.
>
> If anyone understands what I am after,and could help, that would be awesome!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
HTML

PHP color.php
list($coords) = array_keys($_GET);
$coords = explode(',', $coords); // Easier way...?
$im = imagecreatefrompng('colormap.png');
$color = imagepixelat($im, $coords[0], $coords[1]);
I wouldn't do it like this, though. I'd use Javascript.
--
-Casey

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Making an interactive RGB color picker

2008-03-04 Thread Richard Lynch
for ($red = 0; $red < 256; $red++){
  for ($green = 0; $green < 256; $green++){
for ($blue = 0; $blue < 256; $blue++){
  $output = << This may not be exactly what you think, but I didn't know how else to
> word
> the title. I basically need to make a script that will go through
> every
> possible color combination and print them to look just like (or
> similar) to
> the windows color picker. I need it in the format X-Y-Z. For example:
>
> 255-255-255
> 255-254-254
> 255-253-253
>
> What I have so far is this:
>
> ***
>  $break = print"";
> $n1 = "255";
> $n2 = "12";
> $n3 = "186";
>
> $output = print"
> \$drawrect(\$get(color_x),\$get(color_y),\$get(color_w),\$get(color_h),brushColor-$n1-$n2-$n3
> penColor-$n1-$n2-$n3)
> \$button2(\$get(color_x),\$get(color_y),0,0,\$get(color_w),\$get(color_h),,,PVAR:SET:colorize_global:brushcolor-$n1-$n2-$n3
> pencolor-$n1-$n2-$n3,TOOLTIP:\"$n1-$n2-$n3\")
> ";
>
> $output
> ?>
> ***
>
> The $drawrect, $button2, and $get are NOT php functions, but to be
> printed
> as actual text (which is why I have escaped them with the backslash).
> Anyways, I thought it would be easiest to separate each R-G-B value
> into its
> own variable ($n1, $n2, and $n3). That way I could just use some code
> (regex?) to cycle through the numbers 0 to 255.
>
> The HARD part (that I can't seem to even think of a way to make it
> possible)
> is to change JUST the G and B values while keeping the R value at 255.
> Then
> when the G and B values both hit 0, the R value is set to 254 and
> repeated
> until it also hits 0 with the other two. I think (?) that will do
> every
> possible color? I also need to print each string with the individual
> color
> output, and I don't know how to do that either.
>
> In short, I would like something that looks just like the windows
> color
> picker, and when each pixel of it is clicked, it will show me the
> R-G-B
> value in the format I would like.
>
> If anyone understands what I am after,and could help, that would be
> awesome!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Making an interactive RGB color picker

2008-03-04 Thread Jim Lucas

Along the lines of tedd, I will share this one.

http://www.colourlovers.com/blog/2008/01/16/free-advanced-dhtml-color-picker/

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Making an interactive RGB color picker

2008-03-04 Thread Daniel Brown
On Tue, Mar 4, 2008 at 10:44 AM, tedd <[EMAIL PROTECTED]> wrote:
>  While people are giving demo's, check this out:
>
>  http://webbytedd.com/c/access-color/
>
>  The code is there, it's javascript.

Ooh, it's purdy and shiny and I like it.

-- 


Daniel P. Brown
Senior Unix Geek


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Making an interactive RGB color picker

2008-03-04 Thread tedd

At 4:42 PM -0500 3/3/08, Daniel Brown wrote:

On Mon, Mar 3, 2008 at 3:13 PM, Keikonium <[EMAIL PROTECTED]> wrote:

 This may not be exactly what you think, but I didn't know how else to word
  the title. I basically need to make a script that will go through every
  possible color combination and print them to look just like (or similar) to

 >  the windows color picker. I need it in the format X-Y-Z. For example:


It's also available to view here (but the demo is limited to save
my server from Yahoo! Slurps, Google grabs, etc.):
[Demo] http://www.pilotpig.net/code-library/colorpicker.php
[Source]
http://www.pilotpig.net/code-library/source.php?f=colorpicker.php



While people are giving demo's, check this out:

http://webbytedd.com/c/access-color/

The code is there, it's javascript.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Making an interactive RGB color picker

2008-03-03 Thread Daniel Brown
On Mon, Mar 3, 2008 at 3:13 PM, Keikonium <[EMAIL PROTECTED]> wrote:
> This may not be exactly what you think, but I didn't know how else to word
>  the title. I basically need to make a script that will go through every
>  possible color combination and print them to look just like (or similar) to
>  the windows color picker. I need it in the format X-Y-Z. For example:
>
>  255-255-255
>  255-254-254
>  255-253-253
[snip!]

This is a very Bad Idea[tm], because it's going to generate
16,777,216 lines that the browser needs to receive, parse, and
display.  This is going to be over 2,516,582,400 bytes (yes, 2.5GB!)
of data to be served.  There are several better ways of doing it,
including using an HTML image map that has all of the colors laid-out
by pixel coordinates, reducing the number of colors you want to
display, using Flash, or any number of alternatives.

In any case, here's the code:
R: ".$_GET['r']."\n";
echo "G: ".$_GET['g']."\n";
echo "B: ".$_GET['b']."\n";
echo "\n";
}
}

$newline = 63;

for($i=255;$i>0;$i--) {
for($j=255;$j>0;$j--) {
for($k=255;$k>0;$k--) {
echo "";
echo "X";
if($newline === 0) {
echo "\n";
$newline = 63;
} else {
echo "\n";
$newline--;
}
}
}
}
?>

It's also available to view here (but the demo is limited to save
my server from Yahoo! Slurps, Google grabs, etc.):
[Demo] http://www.pilotpig.net/code-library/colorpicker.php
[Source]
http://www.pilotpig.net/code-library/source.php?f=colorpicker.php
-- 


Daniel P. Brown
Senior Unix Geek


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php