package envoy.client.ui.control;
import javafx.scene.image.*;
import javafx.scene.shape.Rectangle;
/**
* Provides a set of convenience constructors for images that are displayed as profile pictures.
*
* @author Leon Hofmeister
* @since Envoy Client v0.2-beta
*/
public final class ProfilePicImageView extends ImageView {
* Creates a new {@code ProfilePicImageView} without a default image.
public ProfilePicImageView() {
this(null);
}
* Creates a new {@code ProfilePicImageView}.
* @param image the image to display
public ProfilePicImageView(Image image) {
this(image, 40);
* @param sizeAndRounding the size and rounding for a circular {@code ProfilePicImageView}
public ProfilePicImageView(Image image, double sizeAndRounding) {
this(image, sizeAndRounding, sizeAndRounding);
* @param size the size of this {@code ProfilePicImageView}
* @param rounding how rounded this {@code ProfilePicImageView} should be
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);