You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ImageProvider wrappers should override createStream-method #107000
I wrote my own CustomImageProvider class which does override createStream to return its own subclass of ImageStream. But if I use the build-in Image-widget, it wraps my CustomImageProvider with a ScrollAwareImageProvider. ScrollAwareImageProvider does not override createStream to return the ImageStream of CustomImageProvider. The createStream-method of CustomImageProvider will never be called!
The background is that I wanted to build a NetworkImageProvider that is able to cancel requests when the corresponding Image-widget gets disposed.
Proposal
Image provider wrappers ScrollAwareImageProvider and ResizeImage should override createStream like this:
Alternatively, maybe we should have a VirtualImageProvider abstract class that helps with this, and then ResizeImage and ScrollAwareImageProvider could both extend that...
@Klabauterman, what was your workaround? My use case is implementing my own ImageProvider to update to new images as they arrive over the network (like a video sent frame by frame), but createStream is never being called.
EDIT I found that Image uses RawImage under the hood, so I switched to that, and now I can achieve my goal of flipping images in under 0.25 seconds, consistently.
Activity
goderbauer commentedon Jul 6, 2022
cc @dnfield
dnfield commentedon Jul 6, 2022
I think this is just an oversight in the implementation and should be an easy fix.
both
ResizeImageandScrollAwareImageProvidershould be updated to override missing virtual overrides to delegate to the wrapped provider.dnfield commentedon Jul 6, 2022
If you want to put up a patch that does this (with a test) I'd be happy to review.
dnfield commentedon Jul 6, 2022
Alternatively, maybe we should have a
VirtualImageProviderabstract class that helps with this, and thenResizeImageandScrollAwareImageProvidercould both extend that...Levi-Lesches commentedon Nov 16, 2022
@Klabauterman, what was your workaround? My use case is implementing my own
ImageProviderto update to new images as they arrive over the network (like a video sent frame by frame), butcreateStreamis never being called.EDIT I found that
ImageusesRawImageunder the hood, so I switched to that, and now I can achieve my goal of flipping images in under 0.25 seconds, consistently.Delegate createStream in ResizeImage and ScrollAwareImageProvider (fl…