iced icon indicating copy to clipboard operation
iced copied to clipboard

Images always drawing on top of shapes in canvas

Open maybeLucas6y6 opened this issue 5 months ago • 5 comments

Is your issue REALLY a bug?

  • [x] My issue is indeed a bug!
  • [x] I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • [x] I have searched the existing issues.

Is this issue related to iced?

  • [x] My hardware is compatible and my graphics drivers are up-to-date.

What happened?

So i m trying to build an app where you can draw on top of images using primitive shapes. For some reason, the image is always drawn at the top and the primities are never visible. Yes, i tried a bunch of methods. Most important are

  • two Geometry frames where the last one is the image one
  • two Caches where the last one is the image one

What is the expected behavior?

I'd say the correct way to render in this instance is everything in the first layer then everything in the next layers, regardless of their types

Version

crates.io release

Operating System

Linux

Do you have any log output?


maybeLucas6y6 avatar Jul 13 '25 10:07 maybeLucas6y6

You can use the Stack widget or Renderer::with_layer to do z-ordering between different drawing primitives.

edwloef avatar Jul 13 '25 20:07 edwloef

Aren't images always drawn on a separate top layer? Which is why you can't clip them?

pml68 avatar Jul 13 '25 20:07 pml68

No, stuff is drawn in the order quads -> triangles -> primitives -> images -> text within each layer.

edwloef avatar Jul 13 '25 20:07 edwloef

No, stuff is drawn in the order quads -> triangles -> primitives -> images -> text within each layer.

Doesn't that exactly mean that images are always draw after (therefor on top of) primitives? Or is my English failing me?

maybeLucas6y6 avatar Jul 14 '25 21:07 maybeLucas6y6

No, stuff is drawn in the order quads -> triangles -> primitives -> images -> text within each layer.

Doesn't that exactly mean that images are always draw after (therefor on top of) primitives? Or is my English failing me?

Within one layer, yes. You can add more layers (or just use the stack widget) to change that :)

edwloef avatar Jul 14 '25 22:07 edwloef