Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.OperationDescriptor


  RenderingHints oldHints = (RenderingHints)oldRHints.getObject();
  RenderingHints newHints = (RenderingHints)newRHints.getObject();

  RenderedOp op = (RenderedOp)nodes.get(id);

  OperationDescriptor od = (OperationDescriptor)
      JAI.getDefaultInstance().getOperationRegistry().
      getDescriptor("rendered", op.getOperationName());

  boolean samePBs = false;
  if (oldParamBlock == newParamBlock)
      samePBs = true;

  Vector oldSources = oldParamBlock.getSources();
  oldParamBlock.removeSources();
  Vector oldReplacedSources =
      JAIRMIUtil.replaceIdWithSources(oldSources,
              nodes,
              op.getOperationName(),
              op.getRenderingHints());
  oldParamBlock.setSources(oldReplacedSources);

  if (samePBs) {
      newParamBlock = oldParamBlock;
  } else {
      Vector newSources = newParamBlock.getSources();
      newParamBlock.removeSources();
      Vector newReplacedSources =
    JAIRMIUtil.replaceIdWithSources(newSources,
            nodes,
            op.getOperationName(),
            op.getRenderingHints());

      newParamBlock.setSources(newReplacedSources);
  }

  Object invalidRegion = od.getInvalidRegion("rendered",
               oldParamBlock,
               oldHints,
               newParamBlock,
               newHints,
               op);
View Full Code Here


  // Initialize the odHash hashtable
  getServerSupportedOperationList();

  // Get the OperationDescriptor associated with this name.
  OperationDescriptor odesc =
      (OperationDescriptor)odHash.get(new CaselessStringKey(opName));

  if (odesc == null) {
      throw new IllegalArgumentException(
              JaiI18N.getString("RemoteJAI11"));
  }

        // Does this operation support rendered mode?
        if (!odesc.isModeSupported("rendered")) {
            throw new IllegalArgumentException(
              JaiI18N.getString("RemoteJAI12"));
        }

  // Does the operation produce a RenderedImage?
  if (!RenderedImage.class.isAssignableFrom(
        odesc.getDestClass("rendered"))) {
      throw new IllegalArgumentException(
              JaiI18N.getString("RemoteJAI13"));
        }

  // Validate input arguments. The ParameterBlock is cloned here
  // because OperationDescriptor.validateArguments() may change
  // its content.
        StringBuffer msg = new StringBuffer();
        args = (ParameterBlock)args.clone();
        if (!odesc.validateArguments("rendered", args, msg)) {
            throw new IllegalArgumentException(msg.toString());
        }

  // Merge rendering hints.  Hints passed in take precedence.
        RenderingHints mergedHints;
        if (hints == null) {
            mergedHints = renderingHints;
        } else if (renderingHints.isEmpty()) {
            mergedHints = hints;
        } else {
            mergedHints = new RenderingHints((Map)renderingHints);
            mergedHints.add(hints);
        }

  RemoteRenderedOp op = new RemoteRenderedOp(operationRegistry,
               protocolName,
               serverName,
               opName,
               args,
               mergedHints);

  // If the operation requests immediate rendering, do so.
        if (odesc.isImmediate()) {
            PlanarImage im = null;
            im = op.getRendering();

            if (im == null) {
    // Op could not be rendered, return null.
View Full Code Here

  // Initialize the odHash hashtable
  getServerSupportedOperationList();

  // Get the OperationDescriptor associated with this name.
  OperationDescriptor odesc =
      (OperationDescriptor)odHash.get(new CaselessStringKey(opName));

  if (odesc == null) {
      throw new IllegalArgumentException(
              JaiI18N.getString("RemoteJAI11"));
  }

        // Does this operation support rendered mode?
        if (!odesc.isModeSupported("renderable")) {
            throw new IllegalArgumentException(
              JaiI18N.getString("RemoteJAI14"));
        }

  // Does the operation produce a RenderedImage?
  if (!RenderableImage.class.isAssignableFrom(
            odesc.getDestClass("renderable"))) {
      throw new IllegalArgumentException(
              JaiI18N.getString("RemoteJAI15"));
        }

  // Validate input arguments. The ParameterBlock is cloned here
  // because OperationDescriptor.validateRenderableArguments()
  // may change its content.
        StringBuffer msg = new StringBuffer();
        args = (ParameterBlock)args.clone();
        if (!odesc.validateArguments("renderable", args, msg)) {
            throw new IllegalArgumentException(msg.toString());
        }

   RemoteRenderableOp op = new RemoteRenderableOp(operationRegistry,
                   protocolName,
View Full Code Here

  if (registryModeName == null)
      throw new IllegalArgumentException(
             JaiI18N.getString("JAIRMIDescriptor11"));

  String operationName = node.getOperationName();
  OperationDescriptor oldDescs[] =
      getServerSupportedOperationList(oldServerName);
  OperationDescriptor oldOD =
      getOperationDescriptor(oldDescs, operationName);

  if (oldOD == null)
      throw new IllegalArgumentException(
               JaiI18N.getString("JAIRMIDescriptor1"));

  int numSources = oldOD.getNumSources();

  // If the supplied registryModeName is "remoteRendered" or
  // "remoteRenderable", in order to get the OperationDescriptor's
  // ParameterListDescriptor, we need to actually use the "rendered"
  // or "renderable" mode respectively.
  ParameterListDescriptor oldPLD = null;
  if (registryModeName.equalsIgnoreCase("remoteRendered")) {
      oldPLD = oldOD.getParameterListDescriptor("rendered");
  } else if (registryModeName.equalsIgnoreCase("remoteRenderable")) {
      oldPLD = oldOD.getParameterListDescriptor("renderable");
  } else {
      oldPLD = oldOD.getParameterListDescriptor(registryModeName);
  }

  int numParams = oldPLD.getNumParameters();

  // If the serverNames are same, nothing to be done for that
  if (oldServerName != newServerName) {

      // Check whether they both support the supplied operation name

      OperationDescriptor newDescs[] =
    getServerSupportedOperationList(newServerName);
      OperationDescriptor newOD;

      if ((newOD = getOperationDescriptor(newDescs,
            operationName)) == null)
    throw new IllegalArgumentException(
               JaiI18N.getString("JAIRMIDescriptor2"));

      // Check the OperationDescriptor equivalence

      // Sources
      if (numSources != newOD.getNumSources())
    throw new IllegalArgumentException(
               JaiI18N.getString("JAIRMIDescriptor3"));

      // Parameters
      ParameterListDescriptor newPLD =
    newOD.getParameterListDescriptor(registryModeName);

      if (numParams != newPLD.getNumParameters())
    throw new IllegalArgumentException(
              JaiI18N.getString("JAIRMIDescriptor4"));
View Full Code Here

    private OperationDescriptor getOperationDescriptor(OperationDescriptor
                   descriptors[],
                   String operationName) {

  OperationDescriptor od;
  for (int i = 0; i < descriptors.length; i++) {
      od = descriptors[i];
      if (od.getName().equalsIgnoreCase(operationName))
    return od;
  }

  return null;
    }
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.OperationDescriptor

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.