Package com.lightcrafts.mediax.jai.util

Examples of com.lightcrafts.mediax.jai.util.ImagingException


                    sendExceptionToListener(JaiI18N.getString("SunTileScheduler6"), e);
//                    throw (RuntimeException)e;
                } else {
                    String message = JaiI18N.getString("SunTileScheduler6");
                    sendExceptionToListener(message,
                                            new ImagingException(message, e));
/*
                    throw new RuntimeException(e.getMessage()+"\n"+
                                               getStackTraceString(e));
*/
                }
View Full Code Here


                    if (e != null) {
                        // Throw a RuntimeException with the Exception's
                        // message concatenated with the stack trace.
                        String message = JaiI18N.getString("SunTileScheduler7");
                        sendExceptionToListener(message,
                                                new ImagingException(message, e));
/*
                        throw new RuntimeException(e.getMessage()+"\n"+
                                                   getStackTraceString(e));
*/
                    }
                }
            }
        } else { // numThreads == 0
            Request request = null;
            if(!isBlocking && !isPrefetch) {
                request = new Request(this, owner, tileIndices, listeners);
                returnValue = request;
            }

            // no workers; sequentially compute tiles in main thread
            Exception e = compute(owner, tileIndices, tiles, 0, numTiles,
                                  request);

            // Throw a RuntimeException with the Exception's
            // message concatenated with the stack trace.
            if(e != null) {
                String message = JaiI18N.getString("SunTileScheduler7");
                sendExceptionToListener(message,
                                        new ImagingException(message, e));
/*
                throw new RuntimeException(e.getMessage()+"\n"+
                                           getStackTraceString(e));
*/
            }
View Full Code Here

                    cm = (ColorModel)cmMethod.invoke(null, args);
                } catch(Exception e) {
                    String message =
                        JaiI18N.getString("ImageUtil4") + cmMethod.getName();
                    sendExceptionToListener(message ,
                                            new ImagingException(message, e));
/*
                    // XXX Is this a reasonable Exception to throw?
                    throw new RuntimeException(cmMethod.getName()+" "+
                                               e.getMessage());
*/
 
View Full Code Here

                    sendExceptionToListener("RuntimeException", e);
//                    throw (RuntimeException)e;
                } else {
                    String message = "Tile Scheduler Exception";
                    sendExceptionToListener(message,
                                            new ImagingException(message, e));
/*
                    throw new RuntimeException(e.getMessage()+"\n"+
                                               getStackTraceString(e));
*/
                }
View Full Code Here

                    if (e != null) {
                        // Throw a RuntimeException with the Exception's
                        // message concatenated with the stack trace.
                        String message = "Exception while scheduling tiles: ";
                        sendExceptionToListener(message,
                                                new ImagingException(message, e));
/*
                        throw new RuntimeException(e.getMessage()+"\n"+
                                                   getStackTraceString(e));
*/
                    }
                }
            }
        } else { // numThreads == 0
            Request request = null;
            if(!isBlocking && !isPrefetch) {
                request = new Request(this, owner, tileIndices, listeners);
                returnValue = request;
            }

            // no workers; sequentially compute tiles in main thread
            Exception e = compute(owner, tileIndices, tiles, 0, numTiles,
                                  request);

            // Throw a RuntimeException with the Exception's
            // message concatenated with the stack trace.
            if(e != null) {
                String message = "Exception while scheduling tiles: ";
                sendExceptionToListener(message,
                                        new ImagingException(message, e));
/*
                throw new RuntimeException(e.getMessage()+"\n"+
                                           getStackTraceString(e));
*/
            }
View Full Code Here

        try {
            this.i_transform = transform.createInverse();
        } catch (java.awt.geom.NoninvertibleTransformException e) {
            String message = JaiI18N.getString("MlibAffineOpImage0");
            listener.errorOccurred(message,
                                   new ImagingException(message, e),
                                   this,
                                   false);
//            throw new RuntimeException(JaiI18N.getString("MlibAffineOpImage0"));
        }
        this.transform = (AffineTransform)transform.clone();
View Full Code Here

                                                      bound);
                } else {
                    // Re-throw the error.
                    String message = JaiI18N.getString("CodecRIFUtil0");
                    listener.errorOccurred(message,
                                           new ImagingException(message,
                                                                memoryError),
                                           CodecRIFUtil.class, false);
//                    throw memoryError;
                }
            }
View Full Code Here

        Method method = null;
        try {
            method = GRAPHICS2D_CLASS.getMethod(name, argTypes);
        } catch(Exception e) {
            String message = JaiI18N.getString("TiledImageGraphics2") + name;
            sendExceptionToListener(message, new ImagingException(e));
//            throw new RuntimeException(e.getMessage());
        }

        // Transform requested area to obtain actual bounds.
        Rectangle bounds = new Rectangle(x, y, width, height);
        bounds = getTransform().createTransformedShape(bounds).getBounds();

        // Determine the range of tile indexes
        int minTileX = tiledImage.XToTileX(bounds.x);
        if(minTileX < tileXMinimum)
            minTileX = tileXMinimum;
        int minTileY = tiledImage.YToTileY(bounds.y);
        if(minTileY < tileYMinimum)
            minTileY = tileYMinimum;
        int maxTileX = tiledImage.XToTileX(bounds.x + bounds.width - 1);
        if(maxTileX > tileXMaximum)
            maxTileX = tileXMaximum;
        int maxTileY = tiledImage.YToTileY(bounds.y + bounds.height - 1);
        if(maxTileY > tileYMaximum)
            maxTileY = tileYMaximum;

        // Loop over the tiles
        for(int tileY = minTileY; tileY <= maxTileY; tileY++) {
            int tileMinY = tiledImage.tileYToY(tileY);
            for(int tileX = minTileX; tileX <= maxTileX; tileX++) {
                int tileMinX = tiledImage.tileXToX(tileX);

                // Get the WritableRaster of the current tile
                WritableRaster wr = tiledImage.getWritableTile(tileX, tileY);
                wr = wr.createWritableTranslatedChild(0, 0);

                // Create an equivalent BufferedImage
                BufferedImage bi =
                    new BufferedImage(colorModel, wr,
                                      colorModel.isAlphaPremultiplied(),
                                      properties);

                // Create the associated Graphics2D
                Graphics2D g2d = bi.createGraphics();

                // Initialize the Graphics2D state
                copyState(g2d);

                // Bias the tile origin so that the global coordinates
                // map correctly onto the tile.
                try {
                    Point2D origin2D =
                        g2d.getTransform().transform(new Point2D.Double(),
                                                    null);
                    Point pt = new Point((int)origin2D.getX() - tileMinX,
                                         (int)origin2D.getY() - tileMinY);
                    Point2D pt2D =
                        g2d.getTransform().inverseTransform(pt, null);
                    g2d.translate(pt2D.getX(), pt2D.getY());
                } catch(Exception e) {
                    String message = JaiI18N.getString("TiledImageGraphics3");
                    sendExceptionToListener(message, new ImagingException(e));
//                    throw new RuntimeException(e.getMessage());
                }

                // Perform the graphics operation
                try {
                    Object retVal = method.invoke(g2d, args);
                    if(retVal != null && retVal.getClass() == boolean.class) {
                        returnValue = ((Boolean)retVal).booleanValue();
                    }
                } catch(Exception e) {
                    String message =
                        JaiI18N.getString("TiledImageGraphics3") + " " + name;
                    sendExceptionToListener(message, new ImagingException(e));
//                    throw new RuntimeException(e.getMessage());
                }

                // Dispose of the Graphics2D
                g2d.dispose();
View Full Code Here

    private void sendExceptionToListener(String message, Exception e) {
        ImagingListener listener =
            ImageUtil.getImagingListener((RenderingHints)null);
        listener.errorOccurred(message,
                               new ImagingException(message, e),
                               this, false);
    }
View Full Code Here

                objectOut = new ObjectOutputStream(out);
                in = socket.getInputStream();
                objectIn = new ObjectInputStream(in);
            } catch (IOException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage7"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage7"), e));
//                throw new RuntimeException(e.getMessage());
            }

            // Write the Rectangle to the object output stream.
            try {
                objectOut.writeObject(rect);
            } catch (IOException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage10"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage10"), e));
//                throw new RuntimeException(e.getMessage());
            }

            // Read serialized form of the Raster from object output stream.
            Object object = null;
            try {
                object = objectIn.readObject();
            } catch (IOException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage8"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage8"), e));
//                throw new RuntimeException(e.getMessage());
            } catch (ClassNotFoundException e) {
                sendExceptionToListener(JaiI18N.getString("SerializableRenderedImage9"),
                                        new ImagingException(JaiI18N.getString("SerializableRenderedImage9"), e));
      }

            if (useTileCodec) {
                byte[] buf = (byte[])object;
                raster = decodeRasterFromByteArray(buf);
            }
            else {
                if (!(object instanceof SerializableState))
                    raster = null;
                // Reconstruct the Raster from the serialized form.
                SerializableState ss = (SerializableState)object;
                Class c = ss.getObjectClass();
                if (Raster.class.isAssignableFrom(c)) {
                    raster = (Raster)ss.getObject();
                }
                else raster = null;
            }

      // Close the various streams and the socket.
            try {
    objectOut.flush();
    socket.shutdownOutput();
    socket.shutdownInput();
                objectOut.close();
                out.close();
                objectIn.close();
                in.close();
                socket.close();
            } catch (IOException e) {
                String message =
                    JaiI18N.getString("SerializableRenderedImage11");
                sendExceptionToListener(message,
                                        new ImagingException(message, e));
//                throw new RuntimeException(e.getMessage());
            }

            // If the rectangle equals the image bounds, cache the Raster,
            // switch to "deep copy" mode, and notify the data server.
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.util.ImagingException

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.