• Post Reply Bookmark Topic Watch Topic
  • New Topic

Hexadecimal values and bitwise operators.  RSS feed

 
Suman Sharma
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone explain me what is happening in each line of these two methods?



Thank you.
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This first method masks off the alpha channel.



If you count the number of f's in the mask, there are 6, each of which is 4 bits wide. This is a 24 bit mask. Each color in RGB is 8 bits times three which is also 24 bits. The 8 bits that is left over is the "alpha channel". The alpha channel contains non-color information such as transparency:

Alpha Channel



The above code converts the RGB color value to a hexadecimal String (base 16).

The following code calculates the complementary color:



In the above code, there is no need to mask out the alpha channel because the RGB codes are fetched individually and the alpha channel is never here.

Kaydell
 
Suman Sharma
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your help.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!