delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/12/10/11:02:56

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: wolf <wolfzinke AT gmx DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: bitwise operators
Date: Mon, 10 Dec 2001 16:27:05 +0100
Organization: Rechenzentrum der Universitaet Freiburg, Germany
Lines: 26
Message-ID: <3C14D449.4040703@gmx.net>
NNTP-Posting-Host: pc2.spike.uni-freiburg.de
Mime-Version: 1.0
User-Agent: Mozilla/5.0 (Windows; U; Win98; de-DE; rv:0.9.4) Gecko/20011019 Netscape6/6.2
X-Accept-Language: de-DE
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

For calculating the value of a pixel i am using shift operators this way:


#define CALCOLOR(r,g,b)  (b + (g<<8) + (r <<16))

int main (void)
{
     unsigned int color;
     int r,g,b;

     color = CALCOLOR(r,g,b,);
}


Now i need the values of r,g,b back again. What do i have to do to 
racalculate the values?

rrecalc = ???
grecalc = ???
brecalc = ???

I would be a lucky guy if someone is able to help.
Thanks

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019