-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add support for scale and rotation of images on GTK #9649
Conversation
@@ -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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@hartez can you advise on what's the next step here? |
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
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.
PR Checklist