Raised This Month: $ Target: $400
 0% 

messagemode - getting more than 1 argument


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
vitorrd
Senior Member
Join Date: Jul 2009
Old 10-11-2009 , 20:18   Re: messagemode - getting more than 1 argument
Reply With Quote #8

Quote:
Originally Posted by Jon View Post
Don't tell me you walk around knowing hex codes for all colours?

What is hex for cyan?
rofl @ that, haha. White is always the maximum value in any of the representations, 0xFFFFFF is just another way to write 255 255 255 (0xFF = 255).

Quote:
Originally Posted by Bugsy View Post
I'm not sure exactly what you're trying to do or if this will apply to messagemode but here's a more efficient way of storing RGB values.
PHP Code:
//Sample color values
new 125;
new 
220;
new 
53;
 
//Variable to store our RGB values
new RGB = ( << 16 ) | ( << ) | B;
 
//Retrieve individual R, G, & B values from RGB variable
RGB >> 16;
= ( RGB >> ) & ~0xFF00;
RGB & ~0xFFFF00
There is a small mistake in your RGB retrieving.

R = (RGB & 0xFF0000) >> 16;
G= (RGB & 0xFF00) >> 8;
B = RGB & 0xFF;

The mistake lies in the use of the bitwise not, as ~0xFF00 is not 0x00FF but 0xFFFF00FF, therefore any error in the encoding would screw things over.

Last edited by vitorrd; 10-11-2009 at 20:21.
vitorrd is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode