Package com.lightcrafts.mediax.jai.remote

Examples of com.lightcrafts.mediax.jai.remote.SerializableRenderedImage


            RenderedImage img = (RenderedImage)sourceVector.get(i);
            if(!(img instanceof Serializable)) {
                if(!isCloned) {
                    sourceVector = (Vector)sourceVector.clone();
                }
                sourceVector.set(i, new SerializableRenderedImage(img, false));
            }
        }
        return sourceVector;
    }
View Full Code Here


                } catch (Exception e) {
                    throw new RuntimeException(e.getMessage());
                }

    RenderedImage ri = null;
    SerializableRenderedImage sri;
                // Switch according to object class; ignore unsupported types.
                if (obj instanceof String) {
        String str = (String)obj;

                    if (str.equals(CLOSE_MESSAGE)) {
      // Decrement the remote reference count.
      decrementRemoteReferenceCount(this);
     
        } else {
      if (str.equals("createDefaultRendering")) {
         
          ri = source.createDefaultRendering();
         
      } else if (str.equals("createRendering")) {
         
          // Read the Object from the object stream.
          obj = null;
          try {
        obj = objectIn.readObject();
          } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
          }
         
          SerializableState ss = (SerializableState)obj;
          RenderContext rc = (RenderContext)ss.getObject();
         
          ri = source.createRendering(rc);

      } else if (str.equals("createScaledRendering")) {
         
          // Read the Object from the object stream.
          obj = null;
          try {
        obj = objectIn.readObject();
          } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
          }
         
          int w = ((Integer)obj).intValue();
         
          try {
        obj = objectIn.readObject();
          } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
          }
         
          int h = ((Integer)obj).intValue();
         
          try {
        obj = objectIn.readObject();
          } catch (Exception e) {
        throw new RuntimeException(e.getMessage());
          }
         
          SerializableState ss = (SerializableState)obj;
          RenderingHints rh = (RenderingHints)ss.getObject();
         
          ri = source.createScaledRendering(w, h, rh);
      }

      if (useTileCodec) {
          try {
        sri = new SerializableRenderedImage(ri,
                    true,
                    registry,
                    formatName,
                    encodingParam,
                    decodingParam);
          } catch (java.io.NotSerializableException nse) {
        throw new RuntimeException(nse.getMessage());
          }
      } else {
          sri = new SerializableRenderedImage(ri, true);
      }
     
      try {
          objectOut.writeObject(sri);
      } catch (Exception e) {
View Full Code Here

        // to access it from a remote machine is to render it and
        // create a SerializableRenderedImage wrapping the
        // rendering, which is set as the source of the remote op.
        RenderedImage ri = ((RenderedOp)source).getRendering();
        try {
      SerializableRenderedImage sri =
          new SerializableRenderedImage(ri);
      remoteImage.setRenderedSource(opID, sri, i);
      newPB.setSource(sri, i);
        } catch (RemoteException e) {
                        String message = JaiI18N.getString("RMIServerProxy6");
                        listener.errorOccurred(message,
                                               new RemoteImagingException(message, e),
                                               this, false);
//      throw new RemoteImagingException(ImageUtil.getStackTraceString(e));
        }

    } else if (source instanceof RenderedImage) {

        // If the source is a local RenderedImage, then the only
        // way to access it from a remote machine is by wrapping
        // it in SerializableRenderedImage and then setting the
        // SRI as the source.
        RenderedImage ri = (RenderedImage)source;
        try {
      SerializableRenderedImage sri =
          new SerializableRenderedImage(ri);
      remoteImage.setRenderedSource(opID, sri, i);
      newPB.setSource(sri, i);
        } catch (RemoteException e) {
                        String message = JaiI18N.getString("RMIServerProxy6");
                        listener.errorOccurred(message,
View Full Code Here

  RenderingHints hints = (RenderingHints)hintsState.getObject();
  RenderedImage rendering = ri.createScaledRendering(w, h, hints);
  if (rendering instanceof Serializable) {
      return rendering;
  } else {
      return new SerializableRenderedImage(rendering);
  }
    }
View Full Code Here

  RenderableImage ri = (RenderableImage)nodes.get(id);
  RenderedImage rendering = ri.createDefaultRendering();
  if (rendering instanceof Serializable) {
      return rendering;
  } else {
      return new SerializableRenderedImage(rendering);
  }
    }
View Full Code Here

      (RenderContext)renderContextState.getObject();
  RenderedImage rendering = ri.createRendering(renderContext);
  if (rendering instanceof Serializable) {
      return rendering;
  } else {
      return new SerializableRenderedImage(rendering);
  }
    }
View Full Code Here

               "::"+rmisp.getRMIID());
      replacedSrcs.add(str);
        }
    } else {
        RenderedImage ri = (RenderedImage)ai;
        replacedSrcs.add(new SerializableRenderedImage(ri));
    }
      } else if (obj instanceof RenderedOp){
    RenderedOp rop = (RenderedOp)obj;
    replacedSrcs.add(new SerializableRenderedImage(
            (RenderedImage)rop.getRendering()));
      } else if (obj instanceof Serializable) {
    replacedSrcs.add(obj);
      } else if (obj instanceof RenderedImage) {
    RenderedImage ri = (RenderedImage)obj;
    replacedSrcs.add(new SerializableRenderedImage(ri));
      }
  }

  return replacedSrcs;               
    }
View Full Code Here

  } else if (obj instanceof RenderedImage) {

      if (obj instanceof Serializable)
    return obj;
      else
    return new SerializableRenderedImage(obj);
  }

  return obj;
    }
View Full Code Here

    // correctly with the situation if it should arise.

    RenderedOp rop = (RenderedOp)source;
    RenderedImage rendering = rop.getRendering();
    if (!(rendering instanceof Serializable))
        rendering = new SerializableRenderedImage(rendering);

    try {
        remoteImage.setRenderedSource(id, rendering, i);
    } catch(RemoteException e) {
                    String message = JaiI18N.getString("RMIServerProxy6");
                    listener.errorOccurred(message,
                                           new RemoteImagingException(message, e),
                                           this, false);

/*
        throw new RemoteImagingException(
              ImageUtil.getStackTraceString(e));
*/
    }
      } else if (source instanceof RenderedImage) {
    try {
        if (source instanceof Serializable) {
      remoteImage.setRenderedSource(id, source, i);
        } else {
      remoteImage.setRenderedSource(
               id,
               new SerializableRenderedImage(source),
               i);
        }

    } catch(RemoteException e) {
                    String message = JaiI18N.getString("RMIServerProxy6");
View Full Code Here

    }
    oldSrc = serverNodeDesc;
      } else if (oldSrcRendering instanceof Serializable) {
    oldSrc = oldSrcRendering;
      } else {
    oldSrc = new SerializableRenderedImage(oldSrcRendering);
      }

      Object srcInvalidRegion = rce.getInvalidRegion();
      SerializableState shapeState =
    SerializerFactory.getState((Shape)srcInvalidRegion, null);
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.remote.SerializableRenderedImage

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.