metadata: Use gufo instead of kamadak exif

A bunch of metadata code is now provided by gufo.
This commit is contained in:
Sophie Herold 2024-11-12 00:35:05 +01:00
parent 51b4ddbc5c
commit 5409203ec9
12 changed files with 212 additions and 438 deletions

View file

@ -1,4 +1,4 @@
// Copyright (c) 2023 Sophie Herold
// Copyright (c) 2023-2024 Sophie Herold
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -44,8 +44,8 @@ impl LpImage {
imp.snapshot_rotate_mirror(
&snapshot,
-orientation.rotation as f32,
orientation.mirrored,
-(orientation.rotate().degrees() as f32),
orientation.mirror(),
scale as f64,
);

View file

@ -15,6 +15,8 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later
use gufo::common::orientation::Rotation;
use super::*;
use crate::metadata;
@ -98,7 +100,7 @@ impl LpImage {
/// Image size of original image with EXIF rotation applied
pub fn image_size(&self) -> (i32, i32) {
let orientation = self.imp().metadata.borrow().orientation();
if orientation.rotation.abs() == 90. || orientation.rotation.abs() == 270. {
if orientation.rotate() == Rotation::_90 || orientation.rotate() == Rotation::_270 {
let (x, y) = self.imp().original_dimensions();
(y, x)
} else {

View file

@ -31,8 +31,8 @@ impl LpImage {
self.imp().snapshot_rotate_mirror(
&snapshot,
-orientation.rotation as f32,
orientation.mirrored,
-(orientation.rotate().degrees() as f32),
orientation.mirror(),
scale,
);

View file

@ -76,9 +76,11 @@ impl LpImage {
pub fn reset_rotation(&self) {
log::debug!("Resetting rotation");
let orientation = self.metadata().orientation();
self.imp().rotation_target.set(-orientation.rotation);
self.set_mirrored(orientation.mirrored);
self.set_rotation(-orientation.rotation);
self.imp()
.rotation_target
.set(-(orientation.rotate().degrees() as f64));
self.set_mirrored(orientation.mirror());
self.set_rotation(-(orientation.rotate().degrees() as f64));
}
pub fn rotate_by(&self, angle: f64) {