@JonB I would prefer fill the ImageContext with a color, then draw the image in it... 😂
import ui
from scene import *
class MyScene (Scene):
def setup(self):
self.background_color = 'midnightblue'
ui_image = ui.Image.named('test:Mandrill')
wi,hi = ui_image.size
w = 100
h = w * hi/wi
bs = 10
with ui.ImageContext(w,h) as ctx:
pth= ui.Path.rect(0,0,w,h)
ui.set_color('red')
pth.fill()
ui_image.draw(bs,bs,w-2*bs,h-2*bs)
ui_image = ctx.get_image()
texture = Texture(ui_image)
self.ship = SpriteNode(texture)
self.ship.position = self.size / 2
self.add_child(self.ship)
run(MyScene())
