Hi all, I am creating a buffered image in the code given below. I am getting the exception shown. Could anyone suggest some possible correction or any other solution to it? I need to use the DirectColorModel since I want to access individual RGB components of each pixel.
cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); DirectColorModel dcm = new DirectColorModel(cs, 24, 0xff0000, 0x00ff00, 0x0000ff, 0x0, false, DataBuffer.TYPE_BYTE); byte[] readData = new byte[128 * 128 * 3]; /* reading the data into the byte array readData takes here */ //After reading..the data DataBuffer db = new DataBufferByte(readData, texturewidth * textureheight * 3); int[] band = new int[3]; raster = WritableRaster.createInterleavedRaster(db, texturewidth, textureheight, texturewidth * 3, 3, band, null); Exception in thread "main" java.lang.IllegalArgumentException: Raster ByteInterleavedRaster: width = 128 height = 128 #numDataElements 3 dataOff[0] = 0 is incompatible with ColorModel DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff amask=0 at java.awt.image.BufferedImage.<init>(BufferedImage.java:517) Thanks, Sagar. __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".