コード例 #1
0
 /**
  * @param hints
  * @return
  */
 private RenderingHints prepareHints(RenderingHints hints) {
   if (hints == null) {
     hints = new Hints();
   } else {
     hints = (RenderingHints) hints.clone();
   }
   hints.remove(JAI.KEY_IMAGE_LAYOUT); // remove an eventual layout passed down to us
   return hints;
 }
コード例 #2
0
 /**
  * Sets table of rendering hints.
  *
  * @param hints table to be set
  */
 @SuppressWarnings("rawtypes")
 public void setRenderingHints(Map hints) {
   this.hints.clear();
   if (hints instanceof RenderingHints) {
     RenderingHints renderingHints = (RenderingHints) hints;
     this.hints.putAll((Map) renderingHints.clone());
   } else {
     this.hints.putAll(hints);
   }
 }
コード例 #3
0
  // Since this operation deals with packed bits in a binary image, we
  // do not need to expand the IndexColorModel
  private static Map configHelper(Map configuration) {

    Map config;

    if (configuration == null) {
      config = new RenderingHints(JAI.KEY_REPLACE_INDEX_COLOR_MODEL, Boolean.FALSE);
    } else {

      config = configuration;

      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;
  }
コード例 #4
0
  /**
   * Constructs a RenderableOp given the name of the operation to be performed and a ParameterBlock
   * containing RenderableImage sources and other parameters. Any RenderedImage sources referenced
   * by the ParameterBlock will be ignored.
   *
   * <p>The <code>ParameterBlock</code> may include <code>DeferredData</code> parameters. These will
   * not be evaluated until their values are actually required, i.e., when a rendering of the node
   * is requested or the renderable dimensions are queried.
   *
   * @param registry The <code>OperationRegistry</code> to be used for instantiation. if <code>null
   *     </code>, the default registry is used. Saved by reference.
   * @param opName The operation name. Saved by reference.
   * @param pb The sources and other parameters. If <code>null</code>, it is assumed that this node
   *     has no sources and parameters. This parameter is cloned.
   * @param hints The common node <code>RenderingHints</code> to be set; it may be <code>null</code>
   *     . This parameter is cloned.
   * @throws IllegalArgumentException if <code>opName</code> is <code>null</code>.
   * @since JAI 1.1
   */
  public RenderableOp(
      OperationRegistry registry, String opName, ParameterBlock pb, RenderingHints hints) {

    if (pb == null) {
      // Ensure that the PB is non-null.
      pb = new ParameterBlock();
    } else {
      // Clone the PB.
      pb = (ParameterBlock) pb.clone();
    }

    // Clone the hints if non-null.
    if (hints != null) {
      hints = (RenderingHints) hints.clone();
    }

    // Initialize the various helper objects.
    eventManager = new PropertyChangeSupportJAI(this);

    properties = new WritablePropertySourceImpl(null, null, eventManager);

    nodeSupport =
        new OperationNodeSupport(getRegistryModeName(), opName, registry, pb, hints, eventManager);
  }
コード例 #5
0
 /**
  * Gets a copy of the rendering hints.
  *
  * @return clone of table of rendering hints.
  */
 public RenderingHints getRenderingHints() {
   return (RenderingHints) hints.clone();
 }
コード例 #6
0
 /**
  * Sets the common <code>RenderingHints</code> of this node. The supplied parameter is cloned if
  * non-<code>null</code>.
  *
  * <p>If the supplied <code>RenderingHints</code> does not equal the current <code>RenderingHints
  * </code>, a <code>PropertyChangeEventJAI</code> named "RenderingHints" will be fired.
  *
  * @param hints The new <code>RenderingHints</code> to be set; it may be <code>null</code>.
  * @since JAI 1.1
  */
 public synchronized void setRenderingHints(RenderingHints hints) {
   if (hints != null) {
     hints = (RenderingHints) hints.clone();
   }
   nodeSupport.setRenderingHints(hints);
 }
コード例 #7
0
 /**
  * Returns a clone of the common <code>RenderingHints</code> of this node or <code>null</code>.
  *
  * @since JAI 1.1
  */
 public RenderingHints getRenderingHints() {
   RenderingHints hints = nodeSupport.getRenderingHints();
   return hints == null ? null : (RenderingHints) hints.clone();
 }