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. * * @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); } }