if (main.getViewer() == null) return;
rootFigure = (Figure) ((ChsScalableRootEditPart) main.getViewer().
getRootEditPart()).getFigure().getChildren().get(0);
ScalableLayeredPane layer =
(ScalableLayeredPane) rootFigure.getChildren().get(0);
double scale = layer.getScale();
layer.setScale(1.0);
bounds = getBounds(main.getViewer(), rootFigure);
final Image image = new Image(shell.getDisplay(), bounds);
GC gc = new GC(image);
if (ChisioMain.runningOnWindows)
{
gc.setAntialias(SWT.ON);
gc.setTextAntialias(SWT.ON);
}
else
{
gc.setAntialias(SWT.OFF);
gc.setTextAntialias(SWT.OFF);
}
Graphics graphics = new SWTGraphics(gc);
rootFigure.paint(graphics);
graphics.dispose();
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[]{image.getImageData()};
ByteArrayOutputStream os = new ByteArrayOutputStream();
loader.save(os, SWT.IMAGE_BMP);
layer.setScale(scale);
try
{
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new Copies(1));