Examples of RenderingHints


Examples of java.awt.RenderingHints

                       TileCache cache,
                       int computeType,
                       ImageLayout layout) {
        this(source, layout,
             cache != null ?
             new RenderingHints(JAI.KEY_TILE_CACHE, cache) : null,
             computeType);
    }
View Full Code Here

Examples of java.awt.RenderingHints

        Map config;

        if (configuration == null) {

            config = new RenderingHints(JAI.KEY_REPLACE_INDEX_COLOR_MODEL,
                                        Boolean.FALSE);

        } else {

            config = configuration;

      // If the user has specified a hint for this, then we don't
      // want to change it, so change only if this hint is not
      // already specified
            if (!(config.containsKey(JAI.KEY_REPLACE_INDEX_COLOR_MODEL))) {
                RenderingHints hints = (RenderingHints)configuration;
                config = (RenderingHints)hints.clone();
                config.put(JAI.KEY_REPLACE_INDEX_COLOR_MODEL, Boolean.FALSE);
            }
        }

        return config;
View Full Code Here

Examples of java.awt.RenderingHints

        // Retrieve layout information from the hints. The tile size hints
        // are ignored if a SampleModel hint is supplied. Set the hints
        // observed if any hints are used.
        SampleModel sm = null;
        ColorModel cm = null;
        RenderingHints hintsObserved = null;
        if(hints != null) {
            // Get the ImageLayout.
            ImageLayout layout = (ImageLayout)hints.get(JAI.KEY_IMAGE_LAYOUT);

            if(layout != null) {
                // Initialize the observed hint variables.
                hintsObserved = new RenderingHints(null);
                ImageLayout layoutObserved = new ImageLayout();

                // Get the SampleModel.
                if(layout.isValid(ImageLayout.SAMPLE_MODEL_MASK)) {
                    sm = layout.getSampleModel(null);
                    if(sm.getWidth() != tileWidth ||
                       sm.getHeight() != tileHeight) {
                        sm = sm.createCompatibleSampleModel(tileWidth,
                                                            tileHeight);
                    }
                    if(layoutObserved != null) {
                        layoutObserved.setSampleModel(sm);
                    }
                }

                // Get the ColorModel.
                if(layout.isValid(ImageLayout.COLOR_MODEL_MASK)) {
                    cm = layout.getColorModel(null);
                    if(layoutObserved != null) {
                        layoutObserved.setColorModel(cm);
                    }
                }

                // Get the tile dimensions.
                if(layout.isValid(ImageLayout.TILE_WIDTH_MASK)) {
                    tileWidth = layout.getTileWidth(null);
                    if(layoutObserved != null) {
                        layoutObserved.setTileWidth(tileWidth);
                    }
                } else if(sm != null) {
                    tileWidth = sm.getWidth();
                }
                if(layout.isValid(ImageLayout.TILE_HEIGHT_MASK)) {
                    tileHeight = layout.getTileHeight(null);
                    if(layoutObserved != null) {
                        layoutObserved.setTileHeight(tileHeight);
                    }
                } else if(sm != null) {
                    tileHeight = sm.getHeight();
                }

                // Set the observed hints layout.
                hintsObserved.put(JAI.KEY_IMAGE_LAYOUT, layoutObserved);
            } // layout != null
        } // hints != null

        // Ensure that the SampleModel is compatible with the tile size.
        if(sm != null &&
View Full Code Here

Examples of java.awt.RenderingHints

        // Unpack the RenderContext and set local variables based thereon
        AffineTransform usr2dev = renderContext.getTransform();
        if(usr2dev == null) {
            usr2dev = new AffineTransform();
        }
        RenderingHints hints = renderContext.getRenderingHints();
        Shape aoi = renderContext.getAreaOfInterest();
        if(aoi == null) {
            aoi = dimensions.getBounds();
        }
View Full Code Here

Examples of java.awt.RenderingHints

    /**
     * Serialize the RenderingHintsState.
     */
    private void writeObject(ObjectOutputStream out) throws IOException {
        // -- Create a serializable form of the RenderingHints object. --
  RenderingHints hints = (RenderingHints)theObject;

        // Create an empty Hashtable.
        Hashtable table = new Hashtable();

        // If there are hints, add them to the table.
        if (hints != null && !hints.isEmpty()) {
            // Get a view of the hints' keys.
            Set keySet = hints.keySet();

            // Proceed if the key set is non-empty.
            if (!keySet.isEmpty()) {
                // Get an iterator for the key set.
                Iterator keyIterator = keySet.iterator();

                // Get the cached hint table.
                Hashtable hintTable = getHintTable();

                // Get the suppressed key Vector.
                Vector suppressedKeys = getSuppressedKeys();

                // Loop over the keys.
                while (keyIterator.hasNext()) {
                    // Get the next key.
                    Object key = keyIterator.next();

                    // Skip this element if the key is suppressed.
                    if (suppressedKeys != null &&
                        suppressedKeys.indexOf(key) != -1) {
                        continue;
                    }

                    // Get the field of the key.
                    Object keyElement = SerializerFactory.getState(key, null);

                    // If the key was not in the table it is not a public
                    // static field in one of the KEY_CLASSES so skip it.
                    if (keyElement == null) {
                        continue;
                    }

                    // Get the next value.
                    Object value = hints.get(key);

                    // Pack the key/value pair in a Hashtable entry.
                    HintElement valueElement = null;
                    try {
                        // Try to create a HintElement from the value directly.
View Full Code Here

Examples of java.awt.RenderingHints

        throws IOException, ClassNotFoundException {
        // Read serialized form from the stream.
        Hashtable table = (Hashtable)in.readObject();

        // Create an empty RenderingHints object.
        RenderingHints hints = new RenderingHints(null);

  theObject = hints;

        // If the table is empty just return.
        if (table.isEmpty()) {
            return;
        }

        // -- Restore the transient RenderingHints object. --

        // Get an enumeration of the table keys.
        Enumeration keys = table.keys();

        // Loop over the table keys.
        while (keys.hasMoreElements()) {
            // Get the next key element.
            SerializableState keyElement = (SerializableState)keys.nextElement();

            // Get the key object corresponding to this key element.
            Object key = keyElement.getObject();

            // Get the value element.
            HintElement valueElement = (HintElement)table.get(keyElement);

            // Get the value object corresponding to this value element.
            Object value = valueElement.getObject();

            // Add an entry to the hints.
            hints.put(key, value);
        }
    }
View Full Code Here

Examples of java.awt.RenderingHints

        throws IOException, ClassNotFoundException {
        // Read serialized form from the stream.
        Hashtable table = (Hashtable)in.readObject();

        // Create an empty RenderingHints object.
        hints = new RenderingHints(null);

        // If the table is empty just return.
        if(table.isEmpty()) {
            return;
        }
View Full Code Here

Examples of java.awt.RenderingHints

    /**
     * Returns a clone of the <code>RenderingHints</code> of this node or
     * <code>null</code>.
     */
    public RenderingHints getRenderingHints() {
        RenderingHints hints = nodeSupport.getRenderingHints();
        return hints == null ? null : (RenderingHints)hints.clone();
    }
View Full Code Here

Examples of java.awt.RenderingHints

        if ( key == null || value == null ) {
            throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
        }

        RenderingHints rh = nodeSupport.getRenderingHints();
        if(rh == null) {
            nodeSupport.setRenderingHints(new RenderingHints(key, value));
        } else {
            rh.put(key, value);
            nodeSupport.setRenderingHints(rh);
        }
    }
View Full Code Here

Examples of java.awt.RenderingHints

     *         <code>null</code> if the key is not mapped to any value.
     *
     * @since JAI 1.1
     */
    public synchronized Object getRenderingHint(RenderingHints.Key key) {
        RenderingHints rh = nodeSupport.getRenderingHints();
        return rh == null ? null : rh.get(key);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.