Skip to content

[iOS]Fix Page BackgroundImageSource scaling#27829

Open
bhavanesh2001 wants to merge 5 commits intodotnet:mainfrom
bhavanesh2001:fix_27438_BackgroundImageSource_iOS
Open

[iOS]Fix Page BackgroundImageSource scaling#27829
bhavanesh2001 wants to merge 5 commits intodotnet:mainfrom
bhavanesh2001:fix_27438_BackgroundImageSource_iOS

Conversation

@bhavanesh2001
Copy link
Copy Markdown
Contributor

Issues Fixed

Fixes #27438

@bhavanesh2001 bhavanesh2001 requested a review from a team as a code owner February 16, 2025 15:19
@bhavanesh2001 bhavanesh2001 marked this pull request as draft February 16, 2025 15:19
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Feb 16, 2025
@bhavanesh2001 bhavanesh2001 marked this pull request as ready for review February 16, 2025 15:46
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz jsuarezruiz added platform/ios area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing labels Feb 17, 2025
Copy link
Copy Markdown
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

This code changes the BackgroundImageSource behavior a little; and affects tests like ContentPageBackgroundImageSourceWorks.

This is the new result:
image

Before was using a pattern (the red color indicates the pixels with changes).
image

Do you want to continue and update the test? Or, let me know to compare the behavior with other platforms and update it.

@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@bhavanesh2001 bhavanesh2001 marked this pull request as draft February 26, 2025 06:17
@bhavanesh2001 bhavanesh2001 marked this pull request as ready for review February 26, 2025 06:17
@jingo0
Copy link
Copy Markdown

jingo0 commented Mar 3, 2025

Will this fix be part of version 8.0 or 9.0?

@bhavanesh2001
Copy link
Copy Markdown
Contributor Author

@jingo0 If this gets approved, it will likely not go into .NET 8 since .NET 8 will go out of support in a few months.
https://dotnet.microsoft.com/platform/support/policy/maui

@github-actions github-actions bot force-pushed the fix_27438_BackgroundImageSource_iOS branch from a62180b to cc200bc Compare March 4, 2025 12:35
@PureWeen PureWeen added this to the .NET 9 SR6 milestone Mar 18, 2025
@PureWeen PureWeen moved this to Ready To Review in MAUI SDK Ongoing Mar 18, 2025
@PureWeen PureWeen modified the milestones: .NET 9 SR6, .NET 9 SR7 Mar 24, 2025
@PureWeen PureWeen modified the milestones: .NET 9 SR7, .NET 9 SR8 May 8, 2025
@bhavanesh2001 bhavanesh2001 force-pushed the fix_27438_BackgroundImageSource_iOS branch from 8c3682f to d5705c3 Compare May 14, 2025 18:58
@jsuarezruiz
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Copy Markdown
Member

@rmarinho rmarinho left a comment

Choose a reason for hiding this comment

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

Seems it scales different from iOS and Catalyst no ?

@bhavanesh2001
Copy link
Copy Markdown
Contributor Author

bhavanesh2001 commented May 27, 2025

Seems it scales different from iOS and Catalyst no ?

I think the platform view’s Frame is somehow incorrect at the time when BackgroundImageSource is set.

If I set BackgroundImageSource later at runtime, it appears correctly.

@bhavanesh2001 bhavanesh2001 requested a review from rmarinho May 27, 2025 19:36
{
Name = BackgroundLayerName,
Contents = backgroundImage.CGImage,
Frame = platformView.Frame,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is no specification of how image should fit the layer. Can manage it using ContentsGravity and MasksToBounds properties.

Copy link
Copy Markdown
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Javier's comment on the gravity is correct. We probably need to see what the other platforms do, but we should match. They probably stretch to fill? Or center?

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing May 30, 2025
@bhavanesh2001
Copy link
Copy Markdown
Contributor Author

@mattleibow @jsuarezruiz I think we currently don't set gravity explicitly on any platform, so whatever the platform provides by default remains in effect (for now).
Also, I don't think we should enforce any specific gravity value. Ideally, this should be user-configurable — perhaps via a new property, like BackgroundImageAspect.

@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 25, 2026

⚠️ Merge Conflict Detected — This PR has merge conflicts with its target branch. Please rebase onto the target branch and resolve the conflicts.

2 similar comments
@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 25, 2026

⚠️ Merge Conflict Detected — This PR has merge conflicts with its target branch. Please rebase onto the target branch and resolve the conflicts.

@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Mar 26, 2026

⚠️ Merge Conflict Detected — This PR has merge conflicts with its target branch. Please rebase onto the target branch and resolve the conflicts.

Copy link
Copy Markdown
Contributor

@kubaflo kubaflo left a comment

Choose a reason for hiding this comment

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

Could you please resolve conflicts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-drawing Shapes, Borders, Shadows, Graphics, BoxView, custom drawing community ✨ Community Contribution platform/ios

Projects

Status: Changes Requested

Development

Successfully merging this pull request may close these issues.

iOS Page BackgroundImage does not scale correctly

8 participants