java - Game Programming - & Logical Operator and .getRGB() Method -


I have two questions related to the code given below:

  pixels = image.getRGB (0, 0, width, height, zero, 0, width); For (int i = 0; i & lt; pixel height; i ++) {pixels [i] = (pixels [i] and 0xff) / 64; }  

My first question is, what is the last argument, which is set as a width, in the .getRGB method. The second is (pixels [i] & amp; 0xff) / 64 , because me & amp; Operator did not face nor did I know that 0xff means, I think, however, that it has to do something with changing RGB value. This is for a 2D game, I am trying to make a book according to what I am currently reading.

Here's the full code:

Thanks!

<

For the final scansize parameter, see:

Start-Y) * Scanis + (X-StartX)];

This is intended to allow your destination array for the width that is different from the removable part.

& amp; The 0xff operator is removing only the blue component of the ARGb pixel value, because the bits in pixels are arranged in such a way:

  AAAAAAAA RRRRRRGGGGGGG BBBBBBBB  

Therefore, "Code"> 0xff creates "Orting":

  00000000 00000000 00000000 BBBBBBBB  

Then, 64 divided by all But throwing two most important bits of blue, i.e. 0 - 63 0, is 64 - 127 1, 128 - 1 is 1 1, and becomes 192 - 255 3.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -