From bec1d64f85ad0a5948738be35fcec354ceb7718d Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Thu, 10 Oct 2024 09:23:13 +0200 Subject: [PATCH] feat(gui): improve rotation support in UIImage (#2401) --- arcade/gui/widgets/image.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arcade/gui/widgets/image.py b/arcade/gui/widgets/image.py index 44f7a0219..c5e981f82 100644 --- a/arcade/gui/widgets/image.py +++ b/arcade/gui/widgets/image.py @@ -17,10 +17,16 @@ class UIImage(UIWidget): If no size given, the texture size is used. + The UIImage supports rotation and alpha values, which only apply to the texture. + Border, and background color are not affected by this. + The size of the image is reduced when rotated to stay within bounce of the widget. + Args: texture: Texture to show width: width of widget height: height of widget + angle: angle of the texture in degrees + alpha: alpha value of the texture, value between 0 and 255 **kwargs: passed to UIWidget """ @@ -39,9 +45,13 @@ def __init__( texture: Union[Texture, NinePatchTexture], width: float | None = None, height: float | None = None, + angle: int = 0, + alpha: int = 255, **kwargs, ): self.texture = texture + self.angle = angle + self.alpha = alpha super().__init__( width=width if width else texture.width,