fe4f9bf219
Co-authored-by: CyB3RC0nN0R <kske@outlook.de>
62 lines
1.8 KiB
Java
62 lines
1.8 KiB
Java
package envoy.client.ui.custom;
|
|
|
|
import javafx.scene.image.Image;
|
|
import javafx.scene.image.ImageView;
|
|
import javafx.scene.shape.Rectangle;
|
|
|
|
/**
|
|
* Provides a set of convenience constructors for images that are displayed as profile pictures.
|
|
* <p>
|
|
* Project: <strong>envoy-client</strong><br>
|
|
* File: <strong>ProfilePicImageView.java</strong><br>
|
|
* Created: <strong>30.07.2020</strong><br>
|
|
*
|
|
* @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);
|
|
}
|
|
}
|