From 69860b2d6fba89eb290ca36b7bbc40bb8f35b169 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Wed, 9 Oct 2024 21:19:59 +0200 Subject: [PATCH 1/2] feat(gui): improve rotation support in UIImage --- 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 44f7a02195..40d5b628a3 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: float = 0, + alpha: int = 255, **kwargs, ): self.texture = texture + self.angle = angle + self.alpha = alpha super().__init__( width=width if width else texture.width, From 747059661f15ae95c86523c375042f73bfb6c9cc Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Wed, 9 Oct 2024 22:58:36 +0200 Subject: [PATCH 2/2] feat(gui): improve rotation support in UIImage --- arcade/gui/widgets/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arcade/gui/widgets/image.py b/arcade/gui/widgets/image.py index 40d5b628a3..c5e981f825 100644 --- a/arcade/gui/widgets/image.py +++ b/arcade/gui/widgets/image.py @@ -45,7 +45,7 @@ def __init__( texture: Union[Texture, NinePatchTexture], width: float | None = None, height: float | None = None, - angle: float = 0, + angle: int = 0, alpha: int = 255, **kwargs, ):