Glidex

0 views
Skip to first unread message

Bowie Maur

unread,
Aug 4, 2024, 8:24:35 PM8/4/24
to singreebihit
Frommy experience making image-heavy Xamarin.Forms apps in the past, Android was a huge pain-point. Android.Graphics.Bitmap is somewhat of a troublemaker, and to make matters worse, Xamarin.Forms API design makes it tough to handle them properly. The Xamarin.Forms team will improve this as time goes on, I'm sure, but it would require breaking public API changes--so it's not easy.

Google has some complex documentation on handling Android.Graphics.Bitmap here. At the top, they are recommending to use a Java library named Glide to simplify working with images in your Android apps.


First I wrote a quick binding project for Glide, where I only bound the important Glide APIs. There were quite a bit of fixups needed to bind every possible public API of Glide, but I didn't care to do that. I decided to make glidex its own self-contained NuGet, because it seemed like it would also be useful for "classic" Xamarin.Android apps.


For the Xamarin.Forms implementation, I knew I would have to just throw IImageSourceHandler out the window and not use it. I also knew I would have to make two of my own custom renderers for Image and ImageCell. I started with the source for the "fast" image renderer from Xamarin.Forms as a starting point. It didn't take too much code to get things working, and it seemed to work rather well!

3a8082e126
Reply all
Reply to author
Forward
0 new messages