Link to home
Start Free TrialLog in
Avatar of Daniel Wilson
Daniel WilsonFlag for United States of America

asked on

Java - Efficient way to copy bit array to 32-bit int array

I'm working with some imaging stuff.  I have an array of bytes, but each bit represents a pixel as this is a monochrome image.

The buffer into which I need to copy is for a CMYK image.  It expects 32 bits/pixel.

I think I need to turn each 0 bit into 0x00000000 and each 1 bit into 0x FFFFFFFF.

I could run a loop that did bitwise math.  But is there an EFFICIENT way of doing this?

thanks.

SOLUTION
Avatar of Thomas4019
Thomas4019
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Daniel Wilson

ASKER

>>So you're saying that each element of your array contains info for 8 pixels?

Yes.  This is a stencil mask in a PDF.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I thought it sounded a little strange ;-)