fresco icon indicating copy to clipboard operation
fresco copied to clipboard

Support for custom ScaleTypes

Open murugaprabum opened this issue 11 years ago • 5 comments

Android by default comes with the following scaleTypes

  • FIT_CENTER
  • FIT_XY
  • FIT_START
  • FIT_END
  • CENTER
  • CENTER_CROP
  • CENTER_INSIDE

It would be great if the following scaleType are also supported or the ability to define a custom scale type in fresco.

  • CENTER_TOP (Scales the image such that it fits inside the view and the image starts from the top edge of the view and is horizontally centred. This doesn't change the aspect ratio)

murugaprabum avatar Apr 29 '15 11:04 murugaprabum

I doubt we will have time to do this properly anytime soon. However, if you wish to make a pull request and add it yourself, then I don't think it would be too difficult. You would just need to add CENTER_TOP to the ScaleType enum in ScalingUtils, and then add an extra case in getTransform - the new case will be very similar to CENTER_INSIDE, except that dy will be 0 (at least, I think that's what you want from the description you've given).

IanChilds avatar May 11 '15 14:05 IanChilds

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

ghost avatar Aug 05 '15 18:08 ghost

Great news! We're going to release this very soon.

balazsbalazs avatar Feb 02 '16 06:02 balazsbalazs

@balazsbalazs Awesome. Looking forward to try this feature

murugaprabum avatar Feb 02 '16 06:02 murugaprabum

This has been added a while ago, see http://frescolib.org/docs/scaling.html for more details!

oprisnik avatar Sep 15 '16 09:09 oprisnik