Changeset 1102 for trunk/src/org/expeditee/io/PdfFramesetWriter.java
- Timestamp:
- 05/10/18 16:04:51 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/io/PdfFramesetWriter.java
r919 r1102 19 19 package org.expeditee.io; 20 20 21 import java.awt.Dimension;22 21 import java.awt.Graphics2D; 23 import java.awt.Image;24 22 import java.io.FileOutputStream; 25 23 import java.io.IOException; … … 28 26 import java.util.List; 29 27 28 import org.expeditee.core.Dimension; 29 import org.expeditee.core.Image; 30 import org.expeditee.gio.EcosystemManager; 31 import org.expeditee.gio.GraphicsManager; 32 import org.expeditee.gio.swing.SwingConversions; 33 import org.expeditee.gio.swing.SwingMiscManager; 34 import org.expeditee.gui.DisplayController; 30 35 import org.expeditee.gui.Frame; 31 36 import org.expeditee.gui.FrameGraphics; … … 35 40 import org.expeditee.items.Picture; 36 41 import org.expeditee.items.Text; 37 import org.expeditee.items.widgets. InteractiveWidget;42 import org.expeditee.items.widgets.Widget; 38 43 import org.expeditee.settings.UserSettings; 39 44 … … 59 64 private boolean _showFrameNames; 60 65 61 public PdfFramesetWriter(long firstFrame, long maxFrame, 62 boolean showFrameNames){66 public PdfFramesetWriter(long firstFrame, long maxFrame, boolean showFrameNames) 67 { 63 68 super(firstFrame, maxFrame); 64 Dimension d = FrameGraphics.getMaxSize();69 Dimension d = DisplayController.getFramePaintArea().getSize(); 65 70 _pdfDocument = new Document(new Rectangle(d.width, d.height)); 66 71 _showFrameNames = showFrameNames; … … 130 135 // we tell the ContentByte we're ready to draw text 131 136 cb.beginText(); 132 Font font = FontFactory.getFont( 133 Conversion.getPdfFont(text.getFamily()), text.getSize(), text 134 .getPaintFont().getStyle(), text.getPaintColor()); 137 Font font = FontFactory.getFont(Conversion.getPdfFont(text.getFamily()), 138 text.getSize(), 139 SwingConversions.toSwingFontStyle(text.getPaintFont().getStyle()), 140 SwingConversions.toSwingColor(text.getPaintColor())); 135 141 cb.setFontAndSize(font.getBaseFont(), text.getSize()); 136 142 // cb.setColorStroke(text.getPaintColor()); 137 cb.setColorFill( text.getPaintColor());143 cb.setColorFill(SwingConversions.toSwingColor(text.getPaintColor())); 138 144 139 145 // we draw some text on a certain position … … 158 164 PdfContentByte cb = _pdfWriter.getDirectContent(); 159 165 com.lowagie.text.Image iTextImage = com.lowagie.text.Image 160 .getInstance( image, null);166 .getInstance(SwingMiscManager.getIfUsingSwingImageManager().getInternalImage(image), null); 161 167 iTextImage.setAbsolutePosition(pic.getX(), _pdfWriter.getPageSize() 162 168 .getHeight() … … 175 181 // cb.setColorFill(fill); 176 182 // } 177 Graphics2D g = cb.createGraphicsShapes(183 /* Graphics2D g = cb.createGraphicsShapes( 178 184 FrameGraphics.getMaxSize().width, 179 FrameGraphics.getMaxSize().height); 180 lineEnd.paint(g); 185 FrameGraphics.getMaxSize().height);*/ 186 GraphicsManager g = EcosystemManager.getGraphicsManager(); 187 Image temp = EcosystemManager.getImageManager().createImage(DisplayController.getFramePaintArea().getSize()); 188 lineEnd.paint(); 181 189 // if (fill != null) { 182 190 // g.setPaint(fill); … … 191 199 192 200 @Override 193 protected void writeCircle(Circle toWrite) throws IOException { 194 PdfContentByte cb = _pdfWriter.getDirectContent(); 195 Graphics2D g = cb.createGraphicsShapes( 196 FrameGraphics.getMaxSize().width, 197 FrameGraphics.getMaxSize().height); 198 toWrite.paint(g); 201 protected void writeCircle(Circle toWrite) throws IOException 202 { 203 PdfContentByte cb = _pdfWriter.getDirectContent(); 204 Graphics2D g = cb.createGraphicsShapes(DisplayController.getFramePaintArea().getWidth(), DisplayController.getFramePaintArea().getHeight()); 205 Image temp = EcosystemManager.getImageManager().createImage(DisplayController.getFramePaintArea().getSize()); 206 EcosystemManager.getGraphicsManager().pushDrawingSurface(temp); 207 toWrite.paint(); 208 EcosystemManager.getGraphicsManager().popDrawingSurface(); 209 g.drawImage(SwingMiscManager.getIfUsingSwingImageManager().getInternalImage(temp), 0, 0, null); 199 210 } 200 211 201 202 @Override 203 protected void writeWidget(InteractiveWidget toWrite) throws IOException { 204 PdfContentByte cb = _pdfWriter.getDirectContent(); 205 Graphics2D g = cb.createGraphicsShapes( 206 FrameGraphics.getMaxSize().width, 207 FrameGraphics.getMaxSize().height); 208 toWrite.paint(g); 212 @Override 213 protected void writeWidget(Widget toWrite) throws IOException 214 { 215 PdfContentByte cb = _pdfWriter.getDirectContent(); 216 Graphics2D g = cb.createGraphicsShapes(DisplayController.getFramePaintArea().getWidth(), DisplayController.getFramePaintArea().getHeight()); 217 Image temp = EcosystemManager.getImageManager().createImage(DisplayController.getFramePaintArea().getSize()); 218 EcosystemManager.getGraphicsManager().pushDrawingSurface(temp); 219 toWrite.paint(); 220 EcosystemManager.getGraphicsManager().popDrawingSurface(); 221 g.drawImage(SwingMiscManager.getIfUsingSwingImageManager().getInternalImage(temp), 0, 0, null); 209 222 } 210 223 }
Note:
See TracChangeset
for help on using the changeset viewer.