Replies: 1 comment 2 replies
-
I think the best approach is to move However, as I mentioned in #674 (comment), the current implementations of |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Following #1221, I've just started adding support for background images in Iced. After literally 3 lines of code (in
iced_graphics
), I had a working example !But now I need your advice to turn this to a viable feature that I would then push into a merge request.
I'd like to add a
Image
variant into theBackground
enum. This variant could either be:Image(PathBuf)
, but that would mean the image has to be re-loaded from its Path and re-parsed from disk every time the window is drawn, so that's not a good ideaImage(image::Handle)
(or maybeImage(Arc<Handle>)
if that's necessary), butimage::Handle
is defined iniced_native
, whereasBackground
comes fromiced_core
.So, I have two options:
iced_native
is obviously not suitable to become a dependency foriced_core
image::Handle
toiced_core
(possibly gated by a Cargo feature). The Handle code is rather simple, but still, it looks it requires some other dependencies fromiced_native
(e.g. the hasher), and I'm not sure this move will be very easy.Background
toiced_native
, so that it can useHandle
s. Buticed_style
currently uses manyBackground::Color(...)
variants, and we probably don't want it to depend oniced_native
.So I guess I should rename the current
core::Background
ascore::SolidBackground
, and build a more complexiced_native::Background
(that could be eitherSolid(SolidBackground)
orImage(Handle)
, and maybe laterGardient(...)
)? Do you agree? Or is there a more sensible approach?In case you have any idea, I'd be happy to hear it, so that I can implement backgound images quickly. Otherwise, I'll have to go by trial and error, and end up with a merge request that may not suit you...
Thanks for your advice!
Beta Was this translation helpful? Give feedback.
All reactions