Java Code Examples for org.eclipse.swt.graphics.Transform#dispose()
The following examples show how to use
org.eclipse.swt.graphics.Transform#dispose() .
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: SWTGraphics2D.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Applies a translation. * * @param x the translation along the x-axis. * @param y the translation along the y-axis. */ public void translate(int x, int y) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.translate(x, y); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 2
Source File: StatechartDefinitionSection.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void drawIconBorder(Label icon, GC gc) { Rectangle rect = new Rectangle(0, 0, icon.getBounds().width - 1, icon.getBounds().height - 1); Transform t = new Transform(getDisplay()); gc.setTransform(t); t.dispose(); gc.setForeground(ColorConstants.lightGray); gc.drawRectangle(0, 0, rect.width, rect.height); }
Example 3
Source File: SWTGraphics2D.java From astor with GNU General Public License v2.0 | 5 votes |
public AffineTransform getTransform() { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); AffineTransform awtTransform = toAwtTransform(swtTransform); swtTransform.dispose(); return awtTransform; }
Example 4
Source File: SWTGraphics2D.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Applies a scale transform. * * @param scaleX the scale factor along the x-axis. * @param scaleY the scale factor along the y-axis. */ public void scale(double scaleX, double scaleY) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.scale((float) scaleX, (float) scaleY); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 5
Source File: SWTGraphics2D.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Concatenates the specified transform to the existing transform. * * @param t the transform. */ public void transform(AffineTransform t) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.multiply(getSwtTransformFromPool(t)); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 6
Source File: SWTGraphics2D.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Returns the current transform. * * @return The current transform. */ public AffineTransform getTransform() { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); AffineTransform awtTransform = toAwtTransform(swtTransform); swtTransform.dispose(); return awtTransform; }
Example 7
Source File: SWTGraphics2D.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Concatenates the specified transform to the existing transform. * * @param t the transform. */ public void transform(AffineTransform t) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.multiply(getSwtTransformFromPool(t)); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 8
Source File: SWTGraphics2D.java From astor with GNU General Public License v2.0 | 5 votes |
public void transform(AffineTransform Tx) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.multiply(getSwtTransformFromPool(Tx)); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 9
Source File: SWTGraphics2D.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Applies a scale transform. * * @param scaleX the scale factor along the x-axis. * @param scaleY the scale factor along the y-axis. */ public void scale(double scaleX, double scaleY) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.scale((float) scaleX, (float) scaleY); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 10
Source File: SWTGraphics2D.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Returns the current transform. * * @return The current transform. */ public AffineTransform getTransform() { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); AffineTransform awtTransform = toAwtTransform(swtTransform); swtTransform.dispose(); return awtTransform; }
Example 11
Source File: SvgShape.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Returns whether or not the given point is contained by this shape. * @param x * @param y * @param gc * @param outline * @return true if the given point is contained, false otherwise * @see Path#contains(float, float, GC, boolean) */ public boolean contains(float x, float y, GC gc, boolean outline) { Transform t = new Transform(gc.getDevice()); gc.getTransform(t); t.invert(); float[] pts = new float[] { x, y }; t.transform(pts); t.dispose(); return path.contains(pts[0], pts[1], gc, outline); }
Example 12
Source File: SWTGraphics2D.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Applies a scale transform. * * @param scaleX the scale factor along the x-axis. * @param scaleY the scale factor along the y-axis. */ public void scale(double scaleX, double scaleY) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.scale((float) scaleX, (float) scaleY); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 13
Source File: SWTGraphics2D.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
/** * Returns the current transform. * * @return The current transform. */ public AffineTransform getTransform() { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); AffineTransform awtTransform = toAwtTransform(swtTransform); swtTransform.dispose(); return awtTransform; }
Example 14
Source File: ChevronsToggleRenderer.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * @see org.eclipse.nebula.widgets.pgroup.AbstractRenderer#paint(org.eclipse.swt.graphics.GC, java.lang.Object) */ public void paint(GC gc, Object value) { Transform transform = new Transform(gc.getDevice()); transform.translate(getBounds().x, getBounds().y); gc.setTransform(transform); Color back = gc.getBackground(); Color fore = gc.getForeground(); if (isHover()) { Color old = gc.getForeground(); gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); gc.drawRoundRectangle(0, 0, 16, 15, 5, 5); gc.setForeground(old); } if (isExpanded()) { gc.drawPolygon(new int[] {5, 6, 8, 3, 11, 6, 10, 6, 8, 4, 6, 6 }); gc.drawPolygon(new int[] {5, 10, 8, 7, 11, 10, 10, 10, 8, 8, 6, 10 }); } else { gc.drawPolygon(new int[] {5, 4, 8, 7, 11, 4, 10, 4, 8, 6, 6, 4 }); gc.drawPolygon(new int[] {5, 8, 8, 11, 11, 8, 10, 8, 8, 10, 6, 8 }); } if (isFocus()) { gc.setBackground(back); gc.setForeground(fore); gc.drawFocus(2, 2, 13, 12); } gc.setTransform(null); transform.dispose(); }
Example 15
Source File: TwisteToggleRenderer.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void paint(GC gc, Object value) { Transform transform = new Transform(gc.getDevice()); transform.translate(getBounds().x, getBounds().y); gc.setTransform(transform); Color back = gc.getBackground(); Color fore = gc.getForeground(); if (!isHover()) { gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); } else { gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_SELECTION)); } gc.setBackground(gc.getForeground()); if (isExpanded()) { gc.drawPolygon(new int[] {1, 3, 4, 6, 5, 6, 8, 3 }); gc.fillPolygon(new int[] {1, 3, 4, 6, 5, 6, 8, 3 }); } else { gc.drawPolygon(new int[] {3, 1, 6, 4, 6, 5, 3, 8 }); gc.fillPolygon(new int[] {3, 1, 6, 4, 6, 5, 3, 8 }); } if (isFocus()) { gc.setBackground(back); gc.setForeground(fore); gc.drawFocus(-1, -1, 12, 12); } gc.setTransform(null); transform.dispose(); }
Example 16
Source File: MinMaxToggleRenderer.java From nebula with Eclipse Public License 2.0 | 5 votes |
public void paint(GC gc, Object value) { Transform transform = new Transform(gc.getDevice()); transform.translate(getBounds().x, getBounds().y); gc.setTransform(transform); gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); if (isHover()) { gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); gc.drawRoundRectangle(0, 0, 17, 17, 5, 5); } gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); if (isExpanded()) { gc.fillRectangle(4, 3, 9, 3); gc.drawRectangle(4, 3, 9, 3); } else { gc.fillRectangle(4, 3, 9, 9); gc.drawRectangle(4, 3, 9, 9); gc.drawLine(4, 5, 13, 5); } gc.setTransform(null); transform.dispose(); }
Example 17
Source File: SWTGraphics2D.java From ECG-Viewer with GNU General Public License v2.0 | 5 votes |
/** * Returns the current transform. * * @return The current transform. */ public AffineTransform getTransform() { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); AffineTransform awtTransform = toAwtTransform(swtTransform); swtTransform.dispose(); return awtTransform; }
Example 18
Source File: SWTGraphics2D.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Returns the current transform. * * @return The current transform. */ public AffineTransform getTransform() { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); AffineTransform awtTransform = toAwtTransform(swtTransform); swtTransform.dispose(); return awtTransform; }
Example 19
Source File: SWTGraphics2D.java From openstock with GNU General Public License v3.0 | 5 votes |
/** * Concatenates the specified transform to the existing transform. * * @param t the transform. */ public void transform(AffineTransform t) { Transform swtTransform = new Transform(this.gc.getDevice()); this.gc.getTransform(swtTransform); swtTransform.multiply(getSwtTransformFromPool(t)); this.gc.setTransform(swtTransform); swtTransform.dispose(); }
Example 20
Source File: GanttChartPrintJob.java From nebula with Eclipse Public License 2.0 | 4 votes |
public void run() { if (printer.startJob(jobName)) { GC gc = new GC(printer); int currentPage = 1; for (GanttChart ganttChart : this.ganttCharts) { Image printerImage = null; if (printer.getPrinterData().scope == PrinterData.SELECTION) { //the user selected to only print the selected area //as this is quite difficult in GanttChart, we specify that //this means to print the visible area //but it is possible to configure via settings what "visible" //area means: // - really only the visible area horizontally and vertically // - only the horizontal visible area, but vertically everything printerImage = ganttChart.getSettings().printSelectedVerticallyComplete() ? ganttChart.getGanttComposite().getVerticallyFullImage() : ganttChart.getGanttComposite().getImage(); } else { printerImage = ganttChart.getGanttComposite().getFullImage(); } final Rectangle printerClientArea = PrintUtils.computePrintArea(printer); final Point scaleFactor = PrintUtils.computeScaleFactor(printer); final Point pageCount = PrintUtils.getPageCount(printer, printerImage); // Print pages Left to Right and then Top to Down for (int verticalPageNumber = 0; verticalPageNumber < pageCount.y; verticalPageNumber++) { for (int horizontalPageNumber = 0; horizontalPageNumber < pageCount.x; horizontalPageNumber++) { // Calculate bounds for the next page int printerClientAreaHeight = ganttChart.getSettings().printFooter() ? (printerClientArea.height - PrintUtils.FOOTER_HEIGHT_IN_PRINTER_DPI) : printerClientArea.height; Rectangle printBounds = new Rectangle((printerClientArea.width / scaleFactor.x) * horizontalPageNumber, (printerClientAreaHeight / scaleFactor.y) * verticalPageNumber, printerClientArea.width / scaleFactor.x, printerClientAreaHeight / scaleFactor.y); if (shouldPrint(printer.getPrinterData(), currentPage)) { printer.startPage(); Transform printerTransform = new Transform(printer); // Adjust for DPI difference between display and printer printerTransform.scale(scaleFactor.x, scaleFactor.y); // Adjust for margins printerTransform.translate(printerClientArea.x / scaleFactor.x, printerClientArea.y / scaleFactor.y); // GanttChart will not automatically print the pages at the left margin. // Example: page 1 will print at x = 0, page 2 at x = 100, page 3 at x = 300 // Adjust to print from the left page margin. i.e x = 0 printerTransform.translate(-1 * printBounds.x, -1 * printBounds.y); gc.setTransform(printerTransform); int imgWidthClipping = printBounds.width; if (((horizontalPageNumber * printBounds.width)+printBounds.width) > printerImage.getImageData().width) { imgWidthClipping = printerImage.getImageData().width - (horizontalPageNumber * printBounds.width); } int imgHeightClipping = printBounds.height; if (((verticalPageNumber * printBounds.height)+printBounds.height) > printerImage.getImageData().height) { imgHeightClipping = printerImage.getImageData().height - (verticalPageNumber * printBounds.height); } gc.drawImage(printerImage, horizontalPageNumber * printBounds.width, verticalPageNumber * printBounds.height, imgWidthClipping, imgHeightClipping, printBounds.x, printBounds.y, imgWidthClipping, imgHeightClipping); if (ganttChart.getSettings().printFooter()) printFooter(gc, ganttChart, currentPage, printBounds); printer.endPage(); printerTransform.dispose(); } currentPage++; } } printerImage.dispose(); } printer.endJob(); gc.dispose(); //only dispose the printer after the print job is done if it is configured to do so //this configuration enables the possibility to reuse a printer for several jobs if (disposePrinter) printer.dispose(); } }