Thanks Jerry ---

I ended up using...

        float[][] matrix = { {1.0f }, {1.0f}, {1.0f}, {1.0f}};
        RasterOp combineOp = new BandCombineOp(matrix,null);
        combineOp.filter(original.getAlphaRaster(), newImage.getRaster());

I haven't figured out the whole ColorModel/SampleModel/Raster scheme yet but I've got 
my solution for now.

--- Ted




-----Original Message-----
From:   Jerry Evans [SMTP:[EMAIL PROTECTED]]
Sent:   Thursday, April 06, 2000 7:51 PM
To:     [EMAIL PROTECTED]
Subject:        Re: [JAVA2D] Thanks on Embossing, etc..now I'm diving into ColorModels 
'cause...

> ...I need to take an RGB w/alpha image and create a Black and White mask
> corresponding to the alpha and non-alpha pixels.
>
> For this case, lets say any pixel with alpha == 0.0f is black and
> 0.0f < alpha <= 1.0f.

Do you mean that 0.0f < alpha <= 1.0f is white?

If so, one way to do it would be to get a subraster from the RGBA image
which is just the alpha channel.  Then create a BufferedImage using this
raster and an IndexedColorModel that maps 0 to black and everything else
to white.  Then draw this BufferedImage to a new BufferedImage of
TYPE_BYTE_BINARY or TYPE_BYTE_GRAY to create a 1-bit or 8-bit mask image.

Jerry

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to