2020-09-25 14:29:23 +02:00
|
|
|
package envoy.client.ui.control;
|
2020-07-30 20:46:28 +02:00
|
|
|
|
2020-09-25 14:29:23 +02:00
|
|
|
import javafx.scene.image.*;
|
2020-07-30 20:46:28 +02:00
|
|
|
import javafx.scene.shape.Rectangle;
|
|
|
|
|
|
|
|
/**
|
2020-08-01 11:09:24 +02:00
|
|
|
* Provides a set of convenience constructors for images that are displayed as profile pictures.
|
2020-07-30 20:46:28 +02:00
|
|
|
*
|
|
|
|
* @author Leon Hofmeister
|
|
|
|
* @since Envoy Client v0.2-beta
|
|
|
|
*/
|
|
|
|
public final class ProfilePicImageView extends ImageView {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new {@code ProfilePicImageView} without a default image.
|
|
|
|
*
|
|
|
|
* @since Envoy Client v0.2-beta
|
|
|
|
*/
|
|
|
|
public ProfilePicImageView() { this(null); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new {@code ProfilePicImageView}.
|
|
|
|
*
|
|
|
|
* @param image the image to display
|
|
|
|
* @since Envoy Client v0.2-beta
|
|
|
|
*/
|
|
|
|
public ProfilePicImageView(Image image) { this(image, 40); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new {@code ProfilePicImageView}.
|
|
|
|
*
|
|
|
|
* @param image the image to display
|
|
|
|
* @param sizeAndRounding the size and rounding for a circular
|
|
|
|
* {@code ProfilePicImageView}
|
|
|
|
* @since Envoy Client v0.2-beta
|
|
|
|
*/
|
|
|
|
public ProfilePicImageView(Image image, double sizeAndRounding) { this(image, sizeAndRounding, sizeAndRounding); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a new {@code ProfilePicImageView}.
|
|
|
|
*
|
|
|
|
* @param image the image to display
|
|
|
|
* @param size the size of this {@code ProfilePicImageView}
|
|
|
|
* @param rounding how rounded this {@code ProfilePicImageView} should be
|
|
|
|
* @since Envoy Client v0.2-beta
|
|
|
|
*/
|
|
|
|
public ProfilePicImageView(Image image, double size, double rounding) {
|
|
|
|
super(image);
|
|
|
|
final var clip = new Rectangle();
|
|
|
|
clip.setWidth(size);
|
|
|
|
clip.setHeight(size);
|
|
|
|
clip.setArcHeight(rounding);
|
|
|
|
clip.setArcWidth(rounding);
|
|
|
|
setClip(clip);
|
|
|
|
}
|
|
|
|
}
|