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

Picture placements #24

Merged
merged 4 commits into from
Jan 16, 2024
Merged

Picture placements #24

merged 4 commits into from
Jan 16, 2024

Conversation

simonhamp
Copy link
Owner

Added

  • Support different types of picture placement - currently offers Natural and Cover:
    • Natural keeps the ratio of the image and simply scales it down to the size defined in the layout - the final box size will depend on the dimensions of the original image. The lower of the PictureBox's width and height is used as the width of the image
    • Cover forces the image into the PictureBox's dimensions, scaling the image as necessary to make sure that it covers the space. This always occurs from the center of the image

Changed

  • Refactors pictures into a class of their own (unsurprisingly: Picture) - this keeps all of their config (path, opacity, placement) together and allows for a cleaner, more consistent API

The positioning was based on the defined size of the box rather than the actual dimensions of the image

This resolves that by 'pre-rendering' the image and getting its final dimensions before positioning the box
@simonhamp simonhamp merged commit 847573d into main Jan 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant