Skip to content

Picture placements#24

Merged
simonhamp merged 4 commits intomainfrom
picture-placements
Jan 16, 2024
Merged

Picture placements#24
simonhamp merged 4 commits intomainfrom
picture-placements

Conversation

@simonhamp
Copy link
Copy Markdown
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
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