Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue in orientation of images #21458

Merged
merged 11 commits into from
Apr 14, 2024
Merged

Conversation

stephen-hawley
Copy link
Contributor

Description of Change

Added code to retrieve image orientation from the metadata, translate it and apply it to the image constructor.

Issues Fixed

Fixes #21314

In brief, pull the image properties from the CGImageSource and translate it to the values for the UIImage constructor.
The conversion code was based on this documentation from Apple.

@stephen-hawley stephen-hawley requested a review from a team as a code owner March 26, 2024 15:56
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 26, 2024
@PureWeen PureWeen requested review from PureWeen and removed request for jfversluis March 26, 2024 16:03
@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

dalexsoto
dalexsoto previously approved these changes Mar 26, 2024
Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

❤️

}

return image;
}

static UIImageOrientation ToUIImageOrientation (CGImageSource cgImageSource)
Copy link
Member

Choose a reason for hiding this comment

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

The code format is not quite right :) seems mono days? we provide the rules in a .editorconfig..

Our dotnet format on this file only will also work.

@rmarinho
Copy link
Member

Will this be a breaking change? Like before images will always appear UP and now can show in a different orientation? Should we target this only to net9 ?

@jsuarezruiz jsuarezruiz added the area-controls-image Image control label Mar 27, 2024
@dotnet-policy-service dotnet-policy-service bot added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Mar 27, 2024
@stephen-hawley
Copy link
Contributor Author

Will this be a breaking change? Like before images will always appear UP and now can show in a different orientation? Should we target this only to net9 ?

Not really, no. It restores correct behavior that was in place before February 16th.

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

Can you add a UITest? our docs are somewhat lacking in that area but you can see an example here.

#20352

I think you could either do a screen shot or check the dims of the image to make sure it renders the right direction

@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@stephen-hawley
Copy link
Contributor Author

/azp run

Copy link

Commenter does not have sufficient privileges for PR 21458 in repo dotnet/maui

@mattleibow
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@stephen-hawley
Copy link
Contributor Author

/azp run

Copy link

Commenter does not have sufficient privileges for PR 21458 in repo dotnet/maui

@mattleibow
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

mattleibow
mattleibow previously approved these changes Apr 13, 2024
@PureWeen
Copy link
Member

/rebase

@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

Test failures unrelated

@PureWeen PureWeen merged commit ea369b9 into dotnet:main Apr 14, 2024
43 of 47 checks passed
@stephen-hawley stephen-hawley deleted the image-orientation branch April 22, 2024 13:57
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-image Image control community ✨ Community Contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image displays JPG photos taken in Portrait orientation in Landscape orientation (regression in 8.0.10)
7 participants