Commit graph

80 commits

Author SHA1 Message Date
Sophie Herold
c4d8145dd3 image: Deny drag gesture for touchscreens
ScrolledWindow can handle the panning in images
better than we can.

This fixes an issue where zoomed in images can't
be zoomed or rotated on touchscreens.

Issue #176

Part-of: <https://gitlab.gnome.org/GNOME/loupe/-/merge_requests/264>
2023-07-31 21:08:58 +02:00
Sophie Herold
55551ae6a2 general: Update copyright notices
Part-of: <https://gitlab.gnome.org/GNOME/loupe/-/merge_requests/258>
2023-07-18 17:48:43 +00:00
Sophie Herold
06d688e79e src: Format let-else statements 2023-07-07 19:22:51 +00:00
Christopher Davis
439286be40 general: Use std's OnceCell where possible
Rust's standard library now provides a drop-in replacement
for `OnceCell`. It requires no API changes from `once_cell`'s
version.

This commit replaces the version from `once_cell` with the
new `std` struct where possible. We still need to use
`once_cell` for properties until
https://github.com/gtk-rs/gtk-rs-core/pull/1113
is merged. We also still need it for Lazy until that lands.

Part-of: <https://gitlab.gnome.org/GNOME/Incubator/loupe/-/merge_requests/241>
2023-06-23 18:59:09 +00:00
Sophie Herold
cc1c8a3da5 image: Use contains in modifier type flag checks
This, for example, allows to also pan the image
with Ctrl+Shift+Scroll like in EOG.

Closes #175

Part-of: <https://gitlab.gnome.org/GNOME/Incubator/loupe/-/merge_requests/237>
2023-06-20 20:42:14 +00:00
Sophie Herold
0c2bdbd736 image: Do not guess bg color for opaque images
In theory this feature made sense to see a black square
but in practice it seems mostly confusing.

Closes #186

Part-of: <https://gitlab.gnome.org/GNOME/Incubator/loupe/-/merge_requests/235>
2023-06-20 20:02:18 +00:00
Sophie Herold
c1422cf728 image: Notify when setting file property
This fixes new file names not being shown in HeaderBar
after renames.
2023-06-20 16:54:38 +02:00
Sophie Herold
2faef84321 image: Also set zoom target when not animating
This currently only seems to affect HighRes scrolling
where SVGs are not rendered for the zoom level.

Closes #185
2023-06-20 13:23:21 +00:00
Sophie Herold
1b2dde79b6 decoder: Use glycin for image loading expect SVG
This gives us sandboxed image decoding and others the
option to extend Loupe with other image formats.
2023-06-07 20:21:28 +00:00
Sophie Herold
24bbd7eae2 window: Show controls on mouse click 2023-05-03 22:22:03 +02:00
Sophie Herold
fab6558285 image: Cancel scroll deceleration on gesture
Seems like the deceleration from kinetic scrolling can
interact with gestures, making the image jump around.

Closes #103

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/211>
2023-05-03 19:50:47 +00:00
Sophie Herold
6db58463bf imageView: Skip unsupported formats when sliding
If an image with unsupported format is opened directly,
the error is shown.

Closes #92

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/212>
2023-05-03 18:58:02 +00:00
Sophie Herold
dab333e510 image: Include alpha<1 in bg color detection
Only ignore alpha=0 pixels instead of alpha<1 pixels.
Also apply agorithm to non transparent images.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/191>
2023-04-20 18:36:40 +00:00
Sophie Herold
2f9fad47a1 src: Update or add auto generated license headers
Closes #55

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/169>
2023-04-19 20:02:01 +02:00
Sophie Herold
83b95a58bd image: Also allow drag with middle button
Closes #138

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/180>
2023-04-19 00:51:00 +00:00
Sophie Herold
e5d5841e5d tiling: Store tiling for each layer and fix bugs
Tilings now have a flexible origin and are stored with the
tile layer. This allows to make the first tile centered
in the viewport, allowing for faster getting a complete
viewport.

This also fixes some rendering bugs caused by forgetting
tiles the were still needed. But not all of them.

Fixes #83, #94
Issue #82

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/179>
2023-04-19 02:16:37 +02:00
Sophie Herold
587599f50b print: Render SVG for correct size
Closes #140

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/165>
2023-04-18 23:52:53 +00:00
Sophie Herold
ae5ca76176 printing: Add printing support
Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/165>
2023-04-18 23:52:53 +00:00
Sophie Herold
e96b9ccac9 image: More fine-grained zoom instructions
Add parameters to use zoom_to without animation or
snapping to best fit. Hopefully fixing 100%/200% snapping
to best fit when close to filling the window and
fixing high res scroll wheel bugs.

Closes #120, #134

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/177>
2023-04-18 23:23:18 +00:00
Sophie Herold
44e265374b image: Fix thumbnail for auto rotated images
Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/175>
2023-04-18 22:35:19 +00:00
Sophie Herold
3684a9c02e image: Use lighter background for light theme
Closes #124

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/171>
2023-04-18 21:49:43 +00:00
Sophie Herold
8669b870af image: Fix textures and bg color not reloading
The reload procedure for changed image files is triggered
but the old data has to be deleted to be re-generated.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/176>
2023-04-18 21:03:02 +00:00
Sophie Herold
5a93ec71da image: Do not require monitor information
Before, monitor information not being available lead to panic.

Closes #77

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/167>
2023-04-18 17:08:35 +00:00
Sophie Herold
fad8bb7939 decoder: Use GFile instead of PathBuf
This allows to show images from locations that don't
have a representation with path.

This also works around not being able to read files in trash:///

Closes #56

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/174>
2023-04-18 16:22:49 +00:00
Sophie Herold
032707a210 fileModel: Use GFile with URI as key
Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/174>
2023-04-18 16:22:49 +00:00
Sophie Herold
f8cc9f5f84 i18n: Use gettext function instead of wrapper
No need to deviate from the default here.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/170>
2023-04-12 12:58:40 +00:00
Sophie Herold
8b3cfd000a cargo: Remove gtk-macros dependency
Using the crate is depreacted. Replaced spawn! macro
with our own spawn function
2023-04-06 21:08:33 +00:00
Sophie Herold
1b18486826 image: Move background color guess to other thread
Also, skip it completely for JPEG and BMP

Issue #111
2023-04-04 22:13:36 +00:00
Sophie Herold
5d7cbe026f image: Remove debug prints from bg color guesser
Closes #111
2023-04-03 16:56:54 +02:00
Sophie Herold
7bf9baa581 image: Ensure contrast for transparent images
Determine if the image is transparent and has low
contrast with default background color. If so,
use a different background color.

Closes #31

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/151>
2023-04-02 23:08:51 +00:00
Sophie Herold
533158bb69 image: Request tiles on size_allocate
Fixes tiles for SVG might be missing when enlarging window.

Closes #104

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/155>
2023-04-02 21:36:24 +00:00
Sophie Herold
750fbfd305 image: Settle with either rotate or zoom gesture
Add thresholds after which the gesture is assumed to be
only zoom or rotate.

Closes #95, #29

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/145>
2023-04-02 16:47:57 +00:00
Sophie Herold
e5fc4bc85c image: Add high DPI support
Always interpret the scaling percentag in physical pixels.
This makes 100% show the image 1:1 in screen pixels.

Closes #37
2023-04-02 15:22:12 +00:00
Sophie Herold
67207bb215 image: Use mipmaps for zoom-out and NN for zoom-in
Before we always used "linear" filtering. This gave
a harsh image with moire patterns when zooming out
and washed out images when zooming in.

Closes #68, #71

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/125>
2023-03-25 15:32:31 +00:00
Sophie Herold
0e24f347e6 imagePage: Move popover out of LpImage
It cause 'not measured' errors and we have enough
things to handle in LpImage already.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/146>
2023-03-18 21:24:45 +00:00
Sophie Herold
f33c4bd470 decoder: Support animated formats (GIF, WEBP, APNG)
Closes #27
2023-03-18 20:23:08 +00:00
Sophie Herold
889c818c14 code: Use pub(super) in GObject impl structs
This helps with getting warnings for fields we no longer use

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/143>
2023-03-14 21:25:45 +00:00
Sophie Herold
b8d5f833f3 decoder: Cleanup and better image format detection
Closes #97

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/140>
2023-03-14 03:59:21 +01:00
Sophie Herold
42d558d22f propertiesView: Use image dimensions from decoder
This also shows the units for SVG dimensions if not pixels.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/136>
2023-03-14 02:31:07 +00:00
Sophie Herold
a2a9b4134b propertiesView: Use decoder format
Use the format that we actually used when decoding.
The mime type is usually derived from the file extension
which might not always be correct.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/132>
2023-03-14 00:50:40 +00:00
Sophie Herold
a0ce234946 image: Limit SVG zoom to RSVG limits
See <https://gitlab.gnome.org/GNOME/librsvg/-/issues/938>
for details about the problem.

Closes #88
2023-03-11 00:06:51 +00:00
Sophie Herold
05ef429b86 image: Add newly designed thumbnail for DnD
The old method stopped working with the new decoder setup.

The new design features a frame for contrast and rotates
images based on EXIF information.

Closes #89
2023-03-08 01:48:34 +00:00
Sophie Herold
f12ff1ea4d widgets: Add some widget descriptions 2023-03-06 22:59:40 +01:00
Sophie Herold
f80ec7db56 decoder: Use image-rs, libheif-rs, librsvg
This adds proper support for a lot of image formats including SVGs.
It will be the basis for many features to come. The technical core
is an asynchronous renderer that can arrange textures in smaller tiles
which might be generated on demand.

Closes #34, #40, #41, #49

Basis for fixing the following issues #7, #27, #36, #43, #68, #71
2023-03-04 21:48:51 -05:00
Sophie Herold
257d154f08 image: Fix high-res mouse wheel zoom
High res scrolling is reported as wheel deltas < 1. Use a
formula that works for all delta values.

Closes #63
2023-03-01 20:31:56 +01:00
Lubosz Sarnecki
30136f9050 code: Fix some typos.
Fix some typos, mainly in comments with the power of
Builder's spell correction.
2023-02-21 00:19:05 +01:00
Sophie Herold
449742173b image: Fix pan direction for pinch on touchscreen 2023-02-19 01:45:57 +00:00
Sophie Herold
004ebd5615 cargo: Update dependencies 2023-02-15 17:04:59 +01:00
Sophie Herold
9c51dea6d1 image: Fix rotation gesture on touchscreens
Use angle-delta instead of total angle. Total angle is
absolute on touchscreens.
2023-02-12 20:24:28 +00:00
Sophie Herold
caefec74b4 image: Limit rubberbanding zoom and add stiffness 2023-02-07 21:56:00 +01:00