Search in sources :

Example 1 with ImageCursor

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);
}
Also used : WritableImage(javafx.scene.image.WritableImage) ImageCursor(javafx.scene.ImageCursor)

Example 2 with ImageCursor

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);
    }
}
Also used : ImageCursor(javafx.scene.ImageCursor) Image(javafx.scene.image.Image)

Aggregations

ImageCursor (javafx.scene.ImageCursor)2 Image (javafx.scene.image.Image)1 WritableImage (javafx.scene.image.WritableImage)1