Using custom Image source in native views


#1

I am trying to use modified CachedHttpImageSource from https://github.com/bolav/fuse-cachingimagesource, however running exported view in native context results with

---> (Inner Exception #0) Uno.Exception: CachedHttpImageSource not supported in native context<---

Quick investigation leads to this particular bit in fuselibs-public: https://github.com/fusetools/fuselibs-public/blob/master/Source/Fuse.Controls.Native/iOS/ImageView.uno#L40

I can imagine that there’s some good reason why it’s being limited, but since caching is quite crucial for our app, I wonder what would be the best course of action here?

Does modifying fuselibs makes sense here, or maybe we should be looking to implement something on top of ImageTools?


#2

So, this code is really all about being able to get an UIImage from an ImageSource. Sadly, CachedHttpImageSource doesn’t have this capability, as it caches an OpenGL texture…

In theory, one could write a fallback-path that blits the texture to an FBO, reads the result back to the CPU, and puts that into an UIImage. But that’s a really awkward and long (slow) path to the goal, so I’m not sure I think it’s a good idea.

What exactly are you trying to do here? Perhaps there’s a different route to the solution that makes more sense?


#3

We are trying to cache images downloaded via HTTP, so they would be always instantly available when network conditions are sub optimal.

Since our images are fairly small, for now we opted for encoding them using base64 and leveraging ImageTools to display them - but we’ll be looking in better ways of doing that in the near future