FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

Bitmapdescriptor with ffimageloading ?

Open gevky opened this issue 10 years ago • 2 comments

readonly Pin _pin = new Pin() { Type = PinType.Place, Label = AppResources.AppResources.DragMe, IsDraggable = true, Icon = BitmapDescriptorFactory.FromBundle("stop.png") };

If I load 50 pins it crashes with out of memory error on android (iphone works fine), the 1G trick doesnt work. So I was hoping I could use FFImageLoading ...but I dont know if it is possible..

gevky avatar Sep 04 '16 17:09 gevky

Yes, it's possible, FFImageLoading supports multiple targets as destinations. It'll require custom ITarget implementation. I'll try to prepare it and post it here.

Meanwhile you can review standard ImageViewTarget implementation here:

  • https://github.com/luberda-molinet/FFImageLoading/blob/617a9a6c04bdb5d9076e58921f42e9a9bd70af3e/source/FFImageLoading.Droid/Work/ImageViewTarget.cs
  • https://github.com/luberda-molinet/FFImageLoading/blob/617a9a6c04bdb5d9076e58921f42e9a9bd70af3e/source/FFImageLoading.Droid/TaskParameterExtensions.cs#L20-L34

daniel-luberda avatar Sep 05 '16 15:09 daniel-luberda

With https://github.com/luberda-molinet/FFImageLoading/commit/d706b2d60bc1ce3a72b98236fee3f59a641b78a1 you can retrieve native bitmaps as:

  • Android: var nativeBitmapDrawable = await ImageService.Instance.LoadUrl("http://myimage.png").AsBitmapDrawableAsync();
  • iOS: var nativeUIImage = await ImageService.Instance.LoadUrl("http://myimage.png").AsUIImageAsync();

Then you can use it like this on Android:

readonly Pin _pin = new Pin()
{
Type = PinType.Place,
Label = AppResources.AppResources.DragMe,
IsDraggable = true,
Icon = BitmapDescriptorFactory.FromBitmap(nativeBitmapDrawable?.Bitmap)
};

daniel-luberda avatar Sep 06 '16 00:09 daniel-luberda