Package java.awt.image

Examples of java.awt.image.ColorModel$SRGBColorModel


        //byte[] array = new byte[stream.getFilteredStream().];
        byte[] array = getPDStream().getByteArray();

//      Get the ColorModel right
        PDColorSpace colorspace = getColorSpace();
        ColorModel cm = colorspace.createColorModel( bpc );
        WritableRaster raster = cm.createCompatibleWritableRaster( width, height );
        //DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();
        DataBufferByte buffer = (DataBufferByte)raster.getDataBuffer();
        byte[] bufferData = buffer.getData();
        //System.arraycopy( array, 0, bufferData, 0, array.length );
        int predictor = getPredictor();
View Full Code Here


         */
       
       
        //verify again pci32.pdf before changing below
        PDColorSpace pcs = params.getColorSpace();
        ColorModel colorModel = null;
        if(pcs != null)
        {
            colorModel =
                params.getColorSpace().createColorModel(
                        params.getBitsPerComponent() );
        }
        else
        {
            byte[] transparentColors = new
            byte[]{(byte)0xFF,(byte)0xFF};
            byte[] colors=new byte[]{0, (byte)0xFF};
            colorModel = new IndexColorModel( 1, 2,
                    colors, colors, colors, transparentColors );
        }
        List filters = params.getFilters();
        byte[] finalData = null;
        if( filters == null )
        {
            finalData = getImageData();
        }
        else
        {
            ByteArrayInputStream in = new ByteArrayInputStream( getImageData() );
            ByteArrayOutputStream out = new ByteArrayOutputStream(getImageData().length);
            FilterManager filterManager = new FilterManager();
            for( int i=0; i<filters.size(); i++ )
            {
                out.reset();
                Filter filter = filterManager.getFilter( (String)filters.get( i ) );
                filter.decode( in, out, params.getDictionary() );
                in = new ByteArrayInputStream( out.toByteArray() );
            }
            finalData = out.toByteArray();
        }

        WritableRaster raster = colorModel.createCompatibleWritableRaster( params.getWidth(), params.getHeight() );
        /*    Raster.createPackedRaster(
                buffer,
                params.getWidth(),
                params.getHeight(),
                params.getBitsPerComponent(),
View Full Code Here

                    }
                    // raster in "BGRA" order like OpenCV.. alpha needs to be last
                    offsets = new int[] {2, 1, 0, 3};
                }

                ColorModel cm = null;
                WritableRaster wr = null;
                if (depth() == IPL_DEPTH_8U || depth() == IPL_DEPTH_8S) {
                    cm = new ComponentColorModel(cs, alpha,
                            false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
                    wr = Raster.createWritableRaster(new ComponentSampleModel(
View Full Code Here

        }

        this.numBands = sampleModel.getNumBands();
        this.bpp = numBands*((bitDepth == 16) ? 2 : 1);
       
        ColorModel colorModel = image.getColorModel();
        if (colorModel instanceof IndexColorModel) {
            if (bitDepth < 1 || bitDepth > 8) {
                throw new RuntimeException();
            }
            if (sampleModel.getNumBands() != 1) {
View Full Code Here

        int minY = im.getMinY();
        int width = im.getWidth();
        int height = im.getHeight();
        int tileHeight = im.getTileHeight();
        SampleModel sampleModel = im.getSampleModel();
        ColorModel colorModel = im.getColorModel();

        String ls = (String)java.security.AccessController.doPrivileged(
               new sun.security.action.GetPropertyAction("line.separator"));
        lineSeparator = ls.getBytes();
View Full Code Here

      * Serialize the <code>ColorModelState</code>.
      *
      * @param out The <code>ObjectOutputStream</code>.
      */
    private void writeObject(ObjectOutputStream out) throws IOException {
        ColorModel colorModel = (ColorModel)theObject;

        // Write serialized form to the stream.
        if(colorModel == null) {
            out.writeInt(COLORMODEL_NULL);
        } else if(colorModel instanceof ComponentColorModel) {
View Full Code Here

      *
      * @param out The <code>ObjectInputStream</code>.
      */
    private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
        ColorModel colorModel = null;

        // Read serialized form from the stream.
        ColorSpace cs = null;

        // Switch on first int which is a flag indicating the class.
View Full Code Here

                                                 layout.getTileHeight(source),
                                                 1);
            layout.setSampleModel(sm);
        }
          
        ColorModel cm = layout.getColorModel(null);
        if(cm == null ||
           !JDKWorkarounds.areCompatibleDataModels(sm, cm)) {
            layout.setColorModel(ImageUtil.getCompatibleColorModel(sm,
                                                                   config));
        }
View Full Code Here

        //
        // Check data type and band count compatibility.
        // This implementation handles only 1 and 3 band source images.
        //
        SampleModel sampleModel = im.getSampleModel();
        ColorModel  colorModel  = im.getColorModel();

        // Must be a 1 or 3 band BYTE image
        int numBands  = colorModel.getNumColorComponents();
        int transType = sampleModel.getTransferType();
        if (((transType != DataBuffer.TYPE_BYTE) &&
             !CodecUtils.isPackedByteImage(im)) ||
            ((numBands != 1) && (numBands != 3) )) {
            throw new RuntimeException(JaiI18N.getString("JPEGImageEncoder0"));
        }

        // Must be GRAY or RGB
        int cspaceType = colorModel.getColorSpace().getType();
        if (cspaceType != ColorSpace.TYPE_GRAY &&
            cspaceType != ColorSpace.TYPE_RGB) {
            throw new RuntimeException(JaiI18N.getString("JPEGImageEncoder1"));
        }
View Full Code Here

     * which is abstract and therefore requires that the implementing class be
     * constructed before it may be invoked.
     */
    protected final void initializeColormapOperation() {
        // Retrieve the ColorModels
        ColorModel srcCM = getSource(0).getColorModel();
        ColorModel dstCM = super.getColorModel();

        // Set the acceleration flag.
        isColormapAccelerated &=
            srcCM != null && dstCM != null &&
            srcCM instanceof IndexColorModel &&
View Full Code Here

TOP

Related Classes of java.awt.image.ColorModel$SRGBColorModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.