Coder Social home page Coder Social logo

Implement a Fit method about ffimageloading HOT 10 CLOSED

molinch avatar molinch commented on August 20, 2024
Implement a Fit method

from ffimageloading.

Comments (10)

daniel-luberda avatar daniel-luberda commented on August 20, 2024

It is working in Xamarin.Forms (CachedImage) and Windows (FFImage) - DownsampleToViewSize property.

from ffimageloading.

molinch avatar molinch commented on August 20, 2024

Very cool !
It'll be very useful & powerful for users 😉

2015-12-06 19:05 GMT+01:00 Daniel Luberda [email protected]:

It is working in Xamarin.Forms (DownsampleToViewSize property)


Reply to this email directly or view it on GitHub
#14 (comment)
.

from ffimageloading.

xleon avatar xleon commented on August 20, 2024

What about Android? is it implemented somehow? I tried ScaleToFit = true, but this is adjusting the height creating an square image. The width does not get adjusted

from ffimageloading.

daniel-luberda avatar daniel-luberda commented on August 20, 2024

It isn't implemented on iOS and Android. @molinch suggested possible implementations but it isn't done yet.

from ffimageloading.

molinch avatar molinch commented on August 20, 2024

Even though it's easy to provide the DownSample width or height.
So it's not a "blocker" not having Fit()

from ffimageloading.

daniel-luberda avatar daniel-luberda commented on August 20, 2024

To summarize:

Platform Xamarin Forms Windows Xamarin iOS Xamarin Android
Manual Downsampling (fixed width/height values) supported supported supported supported
Auto Downsampling (image view size) supported supported not supported not supported

from ffimageloading.

xleon avatar xleon commented on August 20, 2024

Well, yesterday I was trying to adjust in Android to the view container, using a fixed DownSample and it didn´t work. Maybe because I was also using rounded corners. I got always a square

from ffimageloading.

daniel-luberda avatar daniel-luberda commented on August 20, 2024

Yes it's because of that. RoundedTransformations has additional constructor overrides to set width/height proportions: public RoundedTransformation(double radius, double cropWidthRatio, double cropHeightRatio). Just use them and you can control that.

Actually it did work but default RoundedTransformation constructor forces image to be a square:

public RoundedTransformation(double radius) : this(radius, 1d, 1d)
.Transform(new List<ITransformation> {
        new RoundedTransformation(7, 200, 120))
    }
.DownSample(200, 0)

or

.Transform(new List<ITransformation> {
        new RoundedTransformation(7, 200, 120))
    }
.DownSample(0, 120)

DownSample always maintain original image aspect ratio. If you do .DownSample(200, 120) one of parameters is ignored.

from ffimageloading.

xleon avatar xleon commented on August 20, 2024

I got it working with

.Transform(new CornersTransformation(5, CornerTransformType.AllRounded, 200, 120))
.DownSample(200, 120)

But your example also works. Thanks!
BTW. This library is really cool. I´m using it in Mvvmcross and it´s working like a champ

from ffimageloading.

antferr avatar antferr commented on August 20, 2024

How do it in XAML? Thanks

from ffimageloading.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.