private WritableRaster CreateDCMraster() { WritableRaster wr; DirectColorModel dcm = (DirectColorModel)Model; bool hasAlpha = Model.HasAlpha(); int[] bandMasks = new int[3 + (hasAlpha ? 1 : 0)]; bandMasks[0] = dcm.RedMask; bandMasks[1] = dcm.GreenMask; bandMasks[2] = dcm.BlueMask; if (hasAlpha) { bandMasks[3] = dcm.AlphaMask; } DataBufferInt db = new DataBufferInt(IntPixels, Width * Height); wr = Raster.CreatePackedRaster(db, Width, Height, Width, bandMasks, null); return(wr); }