CVS: jfor/src/org/jfor/jfor/rtflib/rtfdoc RtfExternalGraphic.java,1.10,1.11

Bertrand Delacretaz <[email protected]> Thu, 17 Jul 2003 07:07:33 -0700
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc
In directory sc8-pr-cvs1:/tmp/cvs-serv11391/src/org/jfor/jfor/rtflib/rtfdoc

Modified Files:
	RtfExternalGraphic.java 
Log Message:
V0.7.2.dev-h - jpeg encoder package refactoring

Index: RtfExternalGraphic.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfExternalGraphic.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** RtfExternalGraphic.java	18 Feb 2003 16:10:57 -0000	1.10
--- RtfExternalGraphic.java	17 Jul 2003 14:07:31 -0000	1.11
***************
*** 7,12 ****
  import org.jfor.jfor.tools.ImageConstants;
  import org.jfor.jfor.tools.ImageUtil;
! import org.jfor.jfor.tools.jpeg.Encoder;
  import org.jfor.jfor.tools.jpeg.JPEGException;
  
  import java.io.BufferedInputStream;
--- 7,13 ----
  import org.jfor.jfor.tools.ImageConstants;
  import org.jfor.jfor.tools.ImageUtil;
! import org.jfor.jfor.tools.jpeg.JpegEncoderFactory;
  import org.jfor.jfor.tools.jpeg.JPEGException;
+ import org.jfor.jfor.tools.jpeg.IJpegEncoder;
  
  import java.io.BufferedInputStream;
***************
*** 270,287 ****
  
  			if (to == ImageConstants.I_JPG) {
- 				ByteArrayOutputStream out = null;
  				try {
  					//convert to jpeg
! 					out = new ByteArrayOutputStream();
! 					Encoder jpgEncoder = new Encoder(graphicCompressionRate, out);
! 					jpgEncoder.encodeJPEG(data);
! 					data = out.toByteArray();
  					type = to;
  				}
  				catch (JPEGException e) {
! 					e.setMessage("Image from tag <fo:external-graphic> could not be created (src = '" + url + "'");
! 				}
! 				finally {
! 					out.close();
  				}
  			}
--- 271,282 ----
  
  			if (to == ImageConstants.I_JPG) {
  				try {
  					//convert to jpeg
! 					final IJpegEncoder jpgEncoder = new JpegEncoderFactory().getEncoder();
!                     data = jpgEncoder.encodeJPEG(graphicCompressionRate,data);
  					type = to;
  				}
  				catch (JPEGException e) {
!                     throw new IOException("JPEG conversion error, src = '" + url + "' (" + e + ")");
  				}
  			}



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0