Results 1 to 5 of 5

Thread: getRGB

  1. #1
    mortoneff is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Question getRGB

    Hello everyone.

    I have been trying to find what
    Java Code:
    (clr & 0x00ff0000) >> 16
    does when
    Java Code:
     int clr = image.getRGB(x,y)
    I know from Java Tutorials that getRGB "Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) and default sRGB colorspace", that "The bitwise & operator performs a bitwise AND operation" and that ">>" shifts a bit pattern to the right, but what exactly does this whole thing do in simple words? How does it return 255 which is the value of "R" ?

    Any help would be valuable and appreciated...
    I am strugling to find an answer on this...
    Thank you.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Do you know what 0x00ff0000 is?

  3. #3
    mortoneff is offline Member
    Join Date
    Aug 2009
    Posts
    4
    Rep Power
    0

    Default

    is it a hexadecimal address or something?

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Okay, so you say "The bitwise & operator performs a bitwise AND operation". Do you know what that means? Likewise with the shift?

    If not, google out a few tutorials about "bitwise operators", regardless of the language, and read up on them.

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Quote Originally Posted by mortoneff View Post
    is it a hexadecimal address or something?
    Read the primitive datatypes section of Sun's tutorial.

Similar Threads

  1. Image class (getRGB)
    By shaungoater in forum New To Java
    Replies: 1
    Last Post: 03-07-2008, 09:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •