Ignore:
Timestamp:
01/30/14 15:55:59 (10 years ago)
Author:
jts21
Message:

Fix positioning of rotated images in exported PDFs. Also in the process made image rendering in general faster (no longer has to recalculate the image every time it redraws), at the cost of additional memory usage (not sure if that's an acceptable trade-off)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/io/PDF2Writer.java

    r789 r792  
    100100        @Override
    101101        protected void writePicture(Picture pic) throws IOException {
    102                 Image image = pic.getCroppedImage();
     102                Image image = pic.getImageToDraw();
    103103                try {
    104104                        PdfContentByte cb = _pdfWriter.getDirectContent();
    105105                        com.lowagie.text.Image iTextImage = com.lowagie.text.Image.getInstance(image, null);
    106                         iTextImage.setAbsolutePosition(pic.getX(), _pdfWriter.getPageSize().getHeight() - pic.getY() - pic.getHeight());
    107                         iTextImage.setRotationDegrees((float) - pic.getRotate());
     106                        // System.out.println(pic.getScale());
     107                        // iTextImage.scalePercent(pic.getScale() * 100);
     108                        iTextImage.setAbsolutePosition(pic.getPolygon().getBounds().x, _pdfWriter.getPageSize().getHeight() - pic.getPolygon().getBounds().y - image.getHeight(null));
     109                        // iTextImage.setRotationDegrees((float) - pic.getRotate());
    108110                        cb.addImage(iTextImage);
    109111                } catch (DocumentException e) {
     
    113115       
    114116        private List<Line> seenLines = new LinkedList<Line>();
    115         private List<Item> seenArrowHeads = new LinkedList<Item>();
    116117        @Override
    117118        protected void writeLine(Line line) throws IOException {
Note: See TracChangeset for help on using the changeset viewer.