@lance1994 it is good that your problem got solved. Here are some notes about imagecontext and I hope it is useful.
ui.Path, ui.Image and ui.mageContext are general purpose routines (not like ui.View) and they are also heavily used in scene programs. ShapeNode has node only few types of shapes and if you need shapes like polygon (triangle, pentagon etc.) you may need to use ImageContext. Here is @ccc 's example, coded using ImageContext.
import scene
import ui
class MyScene (scene.Scene):
def setup(self):
img = ui.Image.named('plf:HudPlayer_yellow')
w, h = img.size
with ui.ImageContext(w, h) as ctx:
img.draw(0,0,w,h)
path = ui.Path.rect(0, 0, w,h)
ui.set_color('red')
path.stroke()
img1 = ctx.get_image()
self.sprite_node = scene.SpriteNode(scene.Texture(img1), position=self.size/2, parent=self)
# use img for regular game and img1 for debugging purpose
#self.sprite_node = scene.SpriteNode(scene.Texture(img), position=self.size/2, parent=self)
if __name__ == '__main__':
scene.run(MyScene(), show_fps=False)