Java Code Examples for javafx.scene.canvas.GraphicsContext#setEffect()
The following examples show how to use
javafx.scene.canvas.GraphicsContext#setEffect() .
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: CustomPlainAmpSkin.java From medusademo with Apache License 2.0 | 6 votes |
private void drawLed(final GraphicsContext CTX) { CTX.clearRect(0, 0, ledSize, ledSize); CTX.setFill(frameGradient); CTX.fillOval(0, 0, ledSize, ledSize); CTX.save(); if (gauge.isLedOn()) { CTX.setEffect(ledOnShadow); CTX.setFill(ledOnGradient); } else { CTX.setEffect(ledOffShadow); CTX.setFill(ledOffGradient); } CTX.fillOval(0.14 * ledSize, 0.14 * ledSize, 0.72 * ledSize, 0.72 * ledSize); CTX.restore(); CTX.setFill(highlightGradient); CTX.fillOval(0.21 * ledSize, 0.21 * ledSize, 0.58 * ledSize, 0.58 * ledSize); }
Example 2
Source File: PlainAmpSkin.java From Medusa with Apache License 2.0 | 6 votes |
private void drawLed(final GraphicsContext CTX) { CTX.clearRect(0, 0, ledSize, ledSize); CTX.setFill(frameGradient); CTX.fillOval(0, 0, ledSize, ledSize); CTX.save(); if (gauge.isLedOn()) { CTX.setEffect(ledOnShadow); CTX.setFill(ledOnGradient); } else { CTX.setEffect(ledOffShadow); CTX.setFill(ledOffGradient); } CTX.fillOval(0.14 * ledSize, 0.14 * ledSize, 0.72 * ledSize, 0.72 * ledSize); CTX.restore(); CTX.setFill(highlightGradient); CTX.fillOval(0.21 * ledSize, 0.21 * ledSize, 0.58 * ledSize, 0.58 * ledSize); }
Example 3
Source File: AmpSkin.java From Medusa with Apache License 2.0 | 6 votes |
private void drawLed(final GraphicsContext CTX) { CTX.clearRect(0, 0, ledSize, ledSize); CTX.setFill(frameGradient); CTX.fillOval(0, 0, ledSize, ledSize); CTX.save(); if (gauge.isLedOn()) { CTX.setEffect(ledOnShadow); CTX.setFill(ledOnGradient); } else { CTX.setEffect(ledOffShadow); CTX.setFill(ledOffGradient); } CTX.fillOval(0.14 * ledSize, 0.14 * ledSize, 0.72 * ledSize, 0.72 * ledSize); CTX.restore(); CTX.setFill(highlightGradient); CTX.fillOval(0.21 * ledSize, 0.21 * ledSize, 0.58 * ledSize, 0.58 * ledSize); }
Example 4
Source File: ToolGraphics.java From JetUML with GNU General Public License v3.0 | 6 votes |
/** * Strokes and fills a path, by converting the elements to integer coordinates and then * aligning them to the center of the pixels, so that it aligns precisely * with the JavaFX coordinate system. See the documentation for * javafx.scene.shape.Shape for details. * * @param pGraphics The graphics context. * @param pPath The path to stroke * @param pFill The fill color for the path. * @param pShadow True to include a drop shadow. */ public static void strokeAndFillSharpPath(GraphicsContext pGraphics, Path pPath, Paint pFill, boolean pShadow) { double width = pGraphics.getLineWidth(); Paint fill = pGraphics.getFill(); pGraphics.setLineWidth(LINE_WIDTH); pGraphics.setFill(pFill); applyPath(pGraphics, pPath); if( pShadow ) { pGraphics.setEffect(DROP_SHADOW); } pGraphics.fill(); pGraphics.stroke(); pGraphics.setLineWidth(width); pGraphics.setFill(fill); pGraphics.setEffect(null); }
Example 5
Source File: TintedImageHelperRenderer.java From arma-dialog-creator with MIT License | 5 votes |
/** This method applies to {@link #setToPreviewMode(boolean)} */ public void paintTintedImage(@NotNull GraphicsContext gc) { gc.save(); if (rotated) { gc.translate(x + w / 2, y + h / 2); //move to center gc.rotate(rotateDeg); } if (flipped) { gc.scale(-1, 1); } gc.setFill(Color.TRANSPARENT); gc.setEffect(previewMode ? effect2 : effect1); gc.fillRect(0, 0, 1, 1); //this is just to trigger drawing the effect. Won't draw anything itself gc.restore(); }
Example 6
Source File: GanttTaskCell.java From Open-Lowcode with Eclipse Public License 2.0 | 4 votes |
/** * draw all separators in the gantt task cell * * @param gc graphics context * @param startdatedisplaywindow start date (first day) of the display window * @param enddatedisplaywindow end date (last day) of the display window * @param ystarthour start hour of the planning * @param ystartday start day of the planning * @param yend end of the cell in pixel * @param totalwidth total width in pixel * @param businesscalendar business calendar to use for displaying of * opening hours * @param extraxoffset extra offset in the display */ public static void drawSeparators( GraphicsContext gc, Date startdatedisplaywindow, Date enddatedisplaywindow, double ystarthour, double ystartday, double yend, double totalwidth, BusinessCalendar businesscalendar, float extraxoffset) { Date[] separatorstoconsider = DateUtils.getAllStartOfDays(startdatedisplaywindow, enddatedisplaywindow, businesscalendar); boolean isreduceddisplay = isReducedDisplay(separatorstoconsider); for (int i = 0; i < separatorstoconsider.length; i++) { if (isreduceddisplay) { gc.setLineWidth(0.5); gc.setStroke(GanttTaskCell.SCALE_LIGHT_GRAY); } if (!isreduceddisplay) { gc.setLineWidth(1); gc.setStroke(GanttTaskCell.SCALE_GRAY); } gc.setEffect(null); Date separatortoprint = separatorstoconsider[i]; if (isMonday(separatortoprint)) { gc.setStroke(GanttTaskCell.SCALE_GRAY); if (!isreduceddisplay) gc.setLineWidth(2); if (isreduceddisplay) gc.setLineWidth(1); } double separatorratio = DateUtils.genericDateToCoordinates(separatortoprint, startdatedisplaywindow, enddatedisplaywindow, businesscalendar).getValue(); gc.strokeLine((long) (separatorratio * totalwidth + extraxoffset), (long) ystartday, (long) (separatorratio * totalwidth + extraxoffset), (long) (yend)); if (!isreduceddisplay) if (separatorstoconsider.length < 30) { for (int j = businesscalendar.getDaywindowhourstart() + 1; j < businesscalendar .getDaywindowhourend(); j++) { Date hour = new Date(separatortoprint.getTime() + (j - businesscalendar.getDaywindowhourstart()) * 3600 * 1000); double hourratio = DateUtils.genericDateToCoordinates(hour, startdatedisplaywindow, enddatedisplaywindow, businesscalendar).getValue(); gc.setStroke(GanttTaskCell.SCALE_LIGHT_GRAY); gc.setLineWidth(0.5); gc.setEffect(null); gc.strokeLine((long) (hourratio * totalwidth + extraxoffset), (long) (ystarthour), (long) (hourratio * totalwidth + extraxoffset), (long) (yend)); } } } }