use of javafx.scene.ImageCursor in project processing by processing.
the class PSurfaceFX method setCursor.
public void setCursor(PImage image, int hotspotX, int hotspotY) {
int w = image.pixelWidth;
int h = image.pixelHeight;
WritableImage im = new WritableImage(w, h);
im.getPixelWriter().setPixels(0, 0, w, h, PixelFormat.getIntArgbInstance(), image.pixels, 0, w);
ImageCursor c = new ImageCursor(im, hotspotX, hotspotY);
lastCursor = c;
canvas.getScene().setCursor(c);
}
use of javafx.scene.ImageCursor in project org.csstudio.display.builder by kasemir.
the class PointsEditor method init.
/**
* Static initialization of custom cursors
*/
private static synchronized void init() {
// Already initialized?
if (cursor_remove != null)
return;
try {
Image image = new Image(ResourceUtil.openPlatformResource("platform:/plugin/org.csstudio.display.builder.editor/icons/add_cursor.png"));
cursor_add = new ImageCursor(image, image.getWidth() / 2, image.getHeight() / 2);
image = new Image(ResourceUtil.openPlatformResource("platform:/plugin/org.csstudio.display.builder.editor/icons/remove_cursor.png"));
cursor_remove = new ImageCursor(image, image.getWidth() / 2, image.getHeight() / 2);
} catch (Exception ex) {
logger.log(Level.WARNING, "Cannot load cursor images", ex);
}
}
Aggregations