• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with BufferedImage

 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Now i am working on the BufferedImage part of java and i got struck with one issue.I have to check for RGB pattern in the buffer which i am going to reading from network.

Now my doubt is
In case of
BufferedImage.TYPE_INT_RGB
i am not sure about the order of RGB bits in the buffer.

1) Can anyone explain me the bit pattern (i.e.,) Whether Red bits will come in LSB or MSB.
2) And which bit represents Alpha value.

Thanks in advance.
 
Rob Spoor
Sheriff
Posts: 20821
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AFAIK, TYPE_INT_RGB doesn't have an alpha value. You should use TYPE_INT_ARGB for that.

As for separating them, can't you use the Color(int, boolean) constructor? That has separate methods for getting the alpha, red, green and blue values.

That constructor does explain how the values are set though:
the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.

[ March 07, 2008: Message edited by: Rob Prime ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!