Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image rotation using Fabulous.XamarinForms.FFImageLoading? #17

Open
gaelian opened this issue Apr 30, 2021 · 4 comments
Open

Image rotation using Fabulous.XamarinForms.FFImageLoading? #17

gaelian opened this issue Apr 30, 2021 · 4 comments

Comments

@gaelian
Copy link

gaelian commented Apr 30, 2021

Question / Discussion

I'm trying to translate this C# code for use with Fabulous.XamarinForms.FFImageLoading:

var t = ImageService.Instance.LoadStream(async c => await image.OpenReadAsync()); // image is a Xamarin.Essentials.FileResult.
t.Transform(new RotateTransformation(90));
using var imageStream = await t.AsPNGStreamAsync();

I've gotten this far in F#:

let t = FFImageLoading.ImageService.Instance.LoadStream(fun _ -> image.OpenReadAsync())
t.Transform(FFImageLoading.Transformations.RotateTransformation(90.)) |> ignore
use! imageStream = t.AsPNGStreamAsync() |> Async.AwaitTask

But in my F# code the AsPNGStreamAsync extension method cannot be found.

I also don't understand why open Fabulous.XamarinForms.FFImageLoading or open FFImageLoading both don't seem to work and I need to use use FFImageLoading.ImageService ... and FFImageLoading.Transformations ... instead. But I suspect this may have something to do with my problem.

Can anyone tell me what I'm doing wrong?

@Happypig375
Copy link

AsPNGStreamAsync is only defined in platform-specific versions. https://github.com/luberda-molinet/FFImageLoading/search?q=aspngstreamasync

Are you targeting .NET Standard?

@gaelian
Copy link
Author

gaelian commented Apr 30, 2021

Yes. I’ve been trying to do this in the shared project of a Xamarin Forms app.

@Happypig375
Copy link

Then you should try this in platform-specific projects.

@vshapenko
Copy link

Glide and Nuke would be better for such cases.

@TimLariviere TimLariviere transferred this issue from fabulous-dev/Fabulous Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants