Examples of PhotovaultImage


Examples of org.photovault.image.PhotovaultImage

        RenderedImage previewImage = null;
       
        try {
            File imageFile = original.getImageFile();
            PhotovaultImageFactory imgFactory = new PhotovaultImageFactory();
            PhotovaultImage img = imgFactory.create( imageFile, false, false );
            if ( channelMap != null ) {
                img.setColorAdjustment( channelMap );
            }
            if ( img instanceof RawImage ) {
                RawImage ri = (RawImage) img;
                ri.setRawSettings( rawSettings );
            }
            if ( createPreview ) {
                // Calculate preview image size
                int previewWidth = img.getWidth();
                int previewHeight = img.getHeight();
                while ( previewWidth > 2048 || previewHeight > 2048 ) {
                    previewWidth >>= 1;
                    previewHeight >>=1;
                }
                previewImage = img.getRenderedImage( previewWidth, previewHeight, false );
            }
            img.setCropBounds( this.getCropBounds() );
            img.setRotation( prefRotation - original.getRotated() );
            thumbImage = img.getRenderedImage( maxThumbWidth, maxThumbHeight, true );
        } catch ( Exception e ) {
            log.warn( "Error reading image: " + e.getMessage() );
            // TODO: If we aborted here due to image writing problem we would have
            // problems later with non-existing transaction. We should really
            // rethink the error handling logic in the whole function. Anyway, we
View Full Code Here

Examples of org.photovault.image.PhotovaultImage

            int lastDotPos = fname.lastIndexOf( "." );
            if ( lastDotPos <= 0 || lastDotPos >= fname.length()-1 ) {
                throw new IOException( "Cannot determine file type extension of " + imageFile.getAbsolutePath() );
            }
            PhotovaultImageFactory imageFactory = new PhotovaultImageFactory();
            PhotovaultImage img = null;
            try {
                /*
                 Do not read the image yet since setting raw conversion
                 parameters later may force a re-read.
                 */
                img = imageFactory.create(imageFile, false, false);
            } catch (PhotovaultException ex) {
                log.error( ex.getMessage() );
            }
            img.setCropBounds( this.getCropBounds() );
            img.setRotation( prefRotation - original.getRotated() );
            if ( channelMap != null ) {
                img.setColorAdjustment( channelMap );
            }
            if ( img instanceof RawImage ) {
                RawImage ri = (RawImage) img;
                if ( rawSettings != null ) {
                    ri.setRawSettings( rawSettings );
                } else if ( rawSettings == null ) {
                    // No raw settings for this photo yet, let's use
                    // the thumbnail settings
                    rawSettings = ri.getRawSettings();
                    txw.lock( rawSettings, Transaction.WRITE );
                }
            }
            if ( width > 0 ) {
                exportImage =img.getRenderedImage( width, height, false );
            } else {
                exportImage =img.getRenderedImage( 1.0, false );
            }
        } catch ( Exception e ) {
            log.warn( "Error reading image: " + e.getMessage() );
            txw.abort();
            throw new PhotovaultException( "Error reading image: " + e.getMessage(), e );
View Full Code Here

Examples of org.photovault.image.PhotovaultImage

                    // throw new IOException( "Cannot determine file type extension of " + imageFile.getAbsolutePath() );
                    fireViewChangeEvent();
                    return;
                }
                PhotovaultImageFactory imageFactory = new PhotovaultImageFactory();
                PhotovaultImage img = null;
                try {
                        /*
                         Do not read the image yet since setting raw conversion
                         parameters later may force a re-read.
                         */
                    img = imageFactory.create(imageFile, false, false);
                } catch (PhotovaultException ex) {
                    final JAIPhotoViewer component = this;
                    final String msg = ex.getMessage();
                    SwingUtilities.invokeLater( new Runnable() {
                        public void run() {
                            JOptionPane.showMessageDialog( component,
                                    msg, "Error loading file",
                                    JOptionPane.ERROR_MESSAGE );
                        }
                    });
                }
                if ( img != null ) {
                    if ( rawImage != null ) {
                        rawImage.removeChangeListener( this );
                    }
                    if ( img instanceof RawImage ) {
                        rawImage = (RawImage) img;
                        rawImage.setRawSettings(
                                localRawSettings != null ?
                                    localRawSettings : photo.getRawSettings() );
                        rawImage.addChangeListener( this );
                        // Check the correct resolution for this image
                        if ( isFit ) {
                            fit();
                        } else {
                            setScale( getScale() );
                        }
                    } else {
                        rawImage = null;
                        rawConvScaling = 1.0f;
                    }
                }
                appliedOps = instance.getAppliedOperations();
                if ( !appliedOps.contains( ImageOperations.COLOR_MAP ) ) {
                    img.setColorAdjustment(
                            localChanMap != null ?
                                localChanMap : photo.getColorChannelMapping() );
                }
                setImage( img );
                if ( !appliedOps.contains( ImageOperations.CROP ) ) {
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.