Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Add support for scale and rotation of images on GTK #9649

Merged
merged 1 commit into from
Jul 14, 2020

Conversation

Bobface
Copy link
Contributor

@Bobface Bobface commented Feb 20, 2020

Description of Change

This PR adds support for rotation and scaling of the Image Control on the GTK Platform.

Issues Resolved

fixes #8732

Platforms Affected

  • GTK

Before/After Screenshots

Below is a GIF of a rotating and scaling image as per the issue above.

The GIF is a bit wonky because of low capture framerate. In reality the animation is smooth.

Gif

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)

@dnfclas
Copy link

dnfclas commented Feb 20, 2020

CLA assistant check
All CLA requirements met.

@@ -64,6 +67,14 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
SetOpacity();
else if (e.PropertyName == Image.AspectProperty.PropertyName)
SetAspect();
else if (e.PropertyName == Image.ScaleProperty.PropertyName)
SetScale();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. Mnn, could we move this implementation to VisualElementTracker https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.GTK/VisualElementTracker.cs#L279?. In this way, the transformation can be applied to any visual element.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is specifically designed for rotation and scaling of images and uses Cairo etc. to do so. I don't think it's easily portable to support any visual element.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsuarezruiz ping? I think Bobface raises a good point here. BTW, issue #5322 has been fixed in master branch (4.7.x?), which was related to this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this should be managed by VisualElementTracker for all the Views. I understand that the implementation is not easy for everything, if we allow this it would be an exception (manage transformations of a specific view like an Image in the view renderer). Otherwise, it works correctly.

@samhouts samhouts requested a review from hartez May 28, 2020 17:21
@samhouts samhouts changed the base branch from master to 4.8.0 June 26, 2020 00:08
@knocte
Copy link
Contributor

knocte commented Jul 6, 2020

@hartez can you advise on what's the next step here?

@hartez hartez merged commit bfcd910 into xamarin:4.8.0 Jul 14, 2020
@samhouts samhouts added the approved Has two approvals, no pending reviews, and no changes requested label Jul 15, 2020
@samhouts samhouts added this to the 4.8.0 milestone Jul 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/image approved Has two approvals, no pending reviews, and no changes requested ControlGallery p/gtk t/bug 🐛
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Image animation not working in GTK
6 participants