Java Code Examples for org.eclipse.swt.graphics.Device#getDPI()

The following examples show how to use org.eclipse.swt.graphics.Device#getDPI() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PagePrint.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
PageIterator(PagePrint print, Device device, GC gc) {
	this.device = device;
	this.gc = gc;

	Point dpi = device.getDPI();

	body = print.body.iterator(device, gc);
	header = print.header;
	headerGap = header == null ? 0 : print.headerGap * dpi.y / 72;
	footer = print.footer;
	footerGap = footer == null ? 0 : print.footerGap * dpi.y / 72;

	this.numberer = new PageNumberer();

	this.minimumSize = computeSize(PrintSizeStrategy.MINIMUM);
	this.preferredSize = computeSize(PrintSizeStrategy.PREFERRED);
}
 
Example 2
Source File: ImagePrint.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
ImageIterator(ImagePrint print, Device device) {
	Util.notNull(print, device);
	this.device = device;
	this.imageData = print.imageData;
	Point dpi = device.getDPI();
	this.size = new Point(print.size.x * dpi.x / 72, print.size.y * dpi.y
			/ 72);
	this.hasNext = true;
}
 
Example 3
Source File: GridIterator.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @param grid
 * @param device
 * @param gc
 */
public GridIterator(GridPrint grid, Device device, GC gc) {
	this.device = device;
	this.dpi = device.getDPI();
	this.columns = new GridColumn[grid.getColumns().length];
	System.arraycopy(grid.getColumns(), 0, this.columns, 0,
			grid.getColumns().length);
	this.columnGroups = grid.getColumnGroups();

	this.header = createGridCellIterators(grid.getHeaderCells(), device,
			gc);
	this.body = createGridCellIterators(grid.getBodyCells(), device, gc);
	this.footer = createGridCellIterators(grid.getFooterCells(), device,
			gc);

	this.cellClippingEnabled = grid.isCellClippingEnabled();

	this.look = grid.getLook().getPainter(device, gc);

	this.minimumColSizes = computeColumnSizes(PrintSizeStrategy.MINIMUM);
	this.preferredColSizes = computeColumnSizes(
			PrintSizeStrategy.PREFERRED);

	this.minimumSize = computeSize(PrintSizeStrategy.MINIMUM,
			minimumColSizes);
	this.preferredSize = computeSize(PrintSizeStrategy.PREFERRED,
			preferredColSizes);

	row = 0;
	rowStarted = false;
}
 
Example 4
Source File: DefaultGridLookPainter.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public DefaultGridLookPainter(DefaultGridLook look, Device device, GC gc) {
	super(device);

	Point dpi = device.getDPI();

	this.border = look.getCellBorder().createPainter(device, gc);
	this.cellPadding = calculateCellPadding(look, dpi);
	this.margins = calculateGridMargins(look, dpi);

	this.bodyBackground = look.getBodyBackgroundProvider();
	this.headerBackground = look.getHeaderBackgroundProvider();
	this.footerBackground = look.getFooterBackgroundProvider();

	this.resources = ResourcePool.forDevice(device);
}
 
Example 5
Source File: LineBorder.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
LineBorderPainter(LineBorder border, Device device, GC gc) {
	Util.notNull(border, device, gc);
	this.rgb = border.rgb;
	this.device = device;

	int lineWidthPoints = border.getLineWidth();
	int borderWidthPoints = border.getGapSize();

	Point dpi = device.getDPI();
	lineWidth = new Point(Math.round(lineWidthPoints * dpi.x / 72f), Math
			.round(lineWidthPoints * dpi.y / 72f));
	borderWidth = new Point(Math.round(borderWidthPoints * dpi.x / 72f),
			Math.round(borderWidthPoints * dpi.y / 72f));
}
 
Example 6
Source File: GapBorder.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
GapBorderPainter(GapBorder target, Device device) {
	Point dpi = device.getDPI();

	this.top = toPixels(target.top, dpi.y);
	this.bottom = toPixels(target.bottom, dpi.y);
	this.openTop = toPixels(target.openTop, dpi.y);
	this.openBottom = toPixels(target.openBottom, dpi.y);

	this.left = toPixels(target.left, dpi.x);
	this.right = toPixels(target.right, dpi.x);
}
 
Example 7
Source File: LinePrint.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
LineIterator(LinePrint print, Device device, GC gc) {
	this.device = device;
	this.gc = gc;

	this.orientation = print.orientation;
	this.rgb = print.rgb;
	Point dpi = device.getDPI();

	// (convert from points to pixels on device)
	this.thickness = new Point(Math.max(1, (int) Math.round(print.thickness
			* dpi.x / 72)), Math.max(1, (int) Math.round(print.thickness
			* dpi.y / 72)));
}
 
Example 8
Source File: EmptyPrint.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
EmptyIterator(Device device, EmptyPrint target) {
	Point dpi = device.getDPI();
	this.size = new Point(Math.round(target.width * dpi.x / 72f), Math
			.round(target.height * dpi.y / 72f));
}