Package org.jpedal.images

Examples of org.jpedal.images.ImageTransformerDouble


            /**
             * scale the raw image to correct page size (at 72dpi)
             */

            //object to scale and clip. Creating instance does the scaling
            ImageTransformerDouble image_transformation =new ImageTransformerDouble(PdfDecoder.dpi,gs,image,createScaledVersion,true);

            //extract images either scaled/clipped or scaled then clipped

            image_transformation.doubleScaleTransformShear(false);

            //get intermediate image and save
            image = image_transformation.getImage();

            //save the scaled/clipped version of image if allowed
            {//if(currentPdfFile.isExtractionAllowed()){

                /**make sure the right way*/
                /*
               int dx=1,dy=1,iw=0,ih=0;
               if(currentGraphicsState.CTM[0][0]<0){
                   dx=-dx;
                   iw=image.getWidth();
               }

               if(currentGraphicsState.CTM[1][1]<0){
                   dy=-dy;
                   ih=image.getHeight();
               }
               if((dy<0)|(dx<0)){

                   AffineTransform image_at =new AffineTransform();
                   image_at.scale(dx,dy);
                   image_at.translate(-iw,-ih);
                   AffineTransformOp invert= new AffineTransformOp(image_at,  ColorSpaces.hints);
                   image = invert.filter(image,null);

               }

                */

                String image_type = objectStoreStreamRef.getImageType(currentImage);
                if(image_type==null)
                    image_type="tif";

                if(objectStoreStreamRef.saveStoredImage(
                        "CLIP_"+currentImage,
                        ImageCommands.addBackgroundToMask(image, isMask),
                        false,
                        false,
                        image_type))
                    errorTracker.addPageFailureMessage("Problem saving " + image);

            }

            /**
             * HTML5/JavaFX code is piggybacking on existing functionality to extract hires clipped image.
             * We do not need other functionality so we ignore that
             */
            if(current.isScalingControlledByUser()){

                if (image != null) {
                    gs.x=x;
                    gs.y=y;
                    current.drawImage(pageNum,image,gs,false,image_name,optionsApplied, -1);
                }

            }else{

                if(finalImagesExtracted || renderImages)
                    image_transformation.doubleScaleTransformScale();

                //complete the image and workout co-ordinates
                image_transformation.completeImage();

                //get initial values
                x = image_transformation.getImageX();
                y = image_transformation.getImageY();
                w = image_transformation.getImageW();
                h = image_transformation.getImageH();

                //get final image to allow for way we draw 'upside down'
                image = image_transformation.getImage();

                //allow for null image returned (ie if too small)
                if (image != null) {

                    //store  final image on disk & in memory
View Full Code Here

TOP

Related Classes of org.jpedal.images.ImageTransformerDouble

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.