KEMBAR78
[Windows] Fixed Image clipping not working by SubhikshaSf4851 · Pull Request #30684 · dotnet/maui · GitHub
Skip to content

Conversation

@SubhikshaSf4851
Copy link
Contributor

@SubhikshaSf4851 SubhikshaSf4851 commented Jul 17, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

RootCause :

The clipping appears misaligned, causing the shape not accurately masks the image as expected.

Description of Change :

Updated the UpdateClip method to adjust the clip's offset using the Child.ActualOffset properties. This ensures that the clipping geometry aligns correctly with the child element's position.

Referrence :

geometricClip.Offset = new Vector2(strokeThickness - Content.ActualOffset.X, strokeThickness - Content.ActualOffset.Y);

Issues Fixed :

Fixes #30440

Tested the behaviour in the following platforms :

  • Windows
  • Android
  • iOS
  • Mac

Screenshot :

Before Issue Fix After Issue Fix
Screenshot 2025-07-18 132913 Screenshot 2025-07-18 122226

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jul 17, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@SubhikshaSf4851! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 17, 2025
@jsuarezruiz jsuarezruiz added platform/windows area-image Image loading, sources, caching labels Jul 18, 2025
VerticalOptions = LayoutOptions.Center
};

var image = new Image
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you extend the sample using a Grid with different columns and clip with different geometries?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz I have made the changes

var pathGeometry = compositor.CreatePathGeometry(path);
var geometricClip = compositor.CreateGeometricClip(pathGeometry);

geometricClip.Offset = new Vector2(-Child.ActualOffset.X, -Child.ActualOffset.Y);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could include a comment explaining why apply these values here?

// Align clip geometry with the child's visual offset to prevent masking misalignment blablabla

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuarezruiz I have added a comment.

@SubhikshaSf4851 SubhikshaSf4851 marked this pull request as ready for review July 18, 2025 10:10
@SubhikshaSf4851 SubhikshaSf4851 requested a review from a team as a code owner July 18, 2025 10:10
@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Jul 21, 2025

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis jfversluis changed the base branch from main to inflight/current August 25, 2025 12:17
@jfversluis jfversluis added this to the .NET 9 SR12 milestone Aug 25, 2025
@jfversluis jfversluis merged commit 0561d12 into dotnet:inflight/current Aug 25, 2025
76 of 78 checks passed
PureWeen pushed a commit that referenced this pull request Sep 5, 2025
Updated Test Sample with different geometries

Updated SnapShots
@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-image Image loading, sources, caching community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Image Clipping not working correctly

3 participants