Class PrintExporter
java.lang.Object
de.cau.cs.kieler.klighd.piccolo.export.AbstractDiagramExporter
de.cau.cs.kieler.klighd.ui.printing.PrintExporter
Diagram printing exporter providing methods for creating previews and the final printout.
- Author:
- csp, chsch
-
Field Summary
Fields inherited from class de.cau.cs.kieler.klighd.piccolo.export.AbstractDiagramExporter
IDENTITY -
Constructor Summary
ConstructorsConstructorDescriptionPrintExporter(PiccoloViewer viewer) Create new exporter using the given viewer. -
Method Summary
Modifier and TypeMethodDescriptioncreateExportConfig(PrintOptions options) Convenience helper method creating theDiagramExportConfigsthat are required for printing diagrams.protected KlighdPaintContextcreatePaintContext(KlighdSWTGraphics graphics, DiagramExportConfig exportConfig)
Specialization contributes aKlighdPaintContextbeing configured for printouts rather than image exports.org.eclipse.swt.graphics.ImageexportPreview(DiagramExportConfig exportConfig, org.eclipse.swt.printing.Printer printer, Dimension imageBounds, Rectangle imageClip, double previewScale, Point2D centeringOffset) Export preview.getBasicPageClip(Dimension drawablesBounds, IExportBranding.Trim tileTrimScaled) edu.umd.cs.piccolo.util.PDimensionProvides the printed diagram's size supplemented with the diagram trim.getDiagramTileTrim(Dimension tileBounds, IExportBranding.Trim printerTrim, Point dotsPerInch) Provides the cumulated diagram tileIExportBranding.Trimrequired by the employedIExportBrandings.Provides the cumulated diagramIExportBranding.Trimrequired by the employedIExportBrandings.getTrimmedTileBounds(PrintOptions options) Provides the size of the area being available for a diagram excerpt, which is theoptions.getPrinterBounds()subtracted by the size of the required tile trim.voidprint(DiagramExportConfig exportConfig, org.eclipse.swt.printing.Printer printer, Dimension pageBounds, Rectangle pageClip, Point2D centeringOffset) Export print.Methods inherited from class de.cau.cs.kieler.klighd.piccolo.export.AbstractDiagramExporter
drawDiagram, drawDiagramTile, drawDiagramTile, getBasicTileClip, getExportedBounds, getMaximumDiagramTileTrim, getMaximumDiagramTileTrim, getMaximumDiagramTrim
-
Constructor Details
-
PrintExporter
Create new exporter using the given viewer.- Parameters:
viewer- the viewer to print
-
-
Method Details
-
getDiagramTrim
Provides the cumulated diagramIExportBranding.Trimrequired by the employedIExportBrandings.- Returns:
- the required (overall) diagram
IExportBranding.Trim
-
getDiagramTileTrim
public IExportBranding.Trim getDiagramTileTrim(Dimension tileBounds, IExportBranding.Trim printerTrim, Point dotsPerInch) Provides the cumulated diagram tileIExportBranding.Trimrequired by the employedIExportBrandings.- Parameters:
tileBounds- the non-scaled bounds of each tileprinterTrim- the printers technically required trim, i.e., the reduction of its printable areadotsPerInch- the image resolution applied by the employed drawingDevice, maybenullif not valid- Returns:
- the required diagram tile
IExportBranding.Trim
-
getTrimmedTileBounds
Provides the size of the area being available for a diagram excerpt, which is theoptions.getPrinterBounds()subtracted by the size of the required tile trim.- Parameters:
options- the currentPrintOptionsconfiguration- Returns:
- a
Dimension2Ddescribing the reduced tile size.
-
getDiagramBoundsIncludingTrim
public edu.umd.cs.piccolo.util.PDimension getDiagramBoundsIncludingTrim()Provides the printed diagram's size supplemented with the diagram trim.- Returns:
- the diagram's size supplemented with the diagram trim
-
createPaintContext
protected KlighdPaintContext createPaintContext(KlighdSWTGraphics graphics, DiagramExportConfig exportConfig)
Specialization contributes aKlighdPaintContextbeing configured for printouts rather than image exports.- Overrides:
createPaintContextin classAbstractDiagramExporter
-
createExportConfig
Convenience helper method creating theDiagramExportConfigsthat are required for printing diagrams.- Parameters:
options- the currentPrintOptionsconfiguration- Returns:
- the required
DiagramExportConfig
-
getBasicPageClip
- Parameters:
drawablesBounds- the actual bounds of the employedDrawabletileTrimScaled- the cumulated requiredIExportBranding.Trimscaled todrawablesBoundsif necessary- Returns:
- a
Rectangledescribing the unadjusted clip rectangle that is to be applied to the employedKlighdSWTGraphicswithout having configured anytransformon that graphics - See Also:
-
exportPreview
public org.eclipse.swt.graphics.Image exportPreview(DiagramExportConfig exportConfig, org.eclipse.swt.printing.Printer printer, Dimension imageBounds, Rectangle imageClip, double previewScale, Point2D centeringOffset) Export preview. Can export the diagram in tiles to print on multiple pages.- Parameters:
exportConfig- the employedDiagramExportConfigprinter- the printer to print to, required for creatingSWT Fontswhile drawing exportBrandingsimageBounds- the absolute (unadjusted) bounds of the diagram previewImageto be returnedimageClip- the basic clip of the diagram printout page being previewed as provided byAbstractDiagramExporter.getBasicTileClip(Dimension, Trim), can be provided here in order to avoid re-computations (of the same values) for each diagram tile, maybenullpreviewScale- the scale factor to be applied to the whole tile while drawing the preview imagecenteringOffset- the offset to be applied to centrally align the diagram as requested- Returns:
- the image
-
print
public void print(DiagramExportConfig exportConfig, org.eclipse.swt.printing.Printer printer, Dimension pageBounds, Rectangle pageClip, Point2D centeringOffset) Export print. Can export the diagram in tiles to print on multiple pages.- Parameters:
exportConfig- the employedDiagramExportConfigprinter- the printer to print topageBounds- the bounds of the diagram previewImageto be returnedpageClip- the bounds of the diagram print page being previewedcenteringOffset- the offset to be applied to centrally align the diagram as requested
-