#353 fixed rendering of panoramas with inconsistent metadata
This commit is contained in:
parent
1b1e7fd1e4
commit
5f5c848934
3 changed files with 43 additions and 2 deletions
|
@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file.
|
||||||
- Collection / Info: edit MP4 metadata (date / location / title / description / rating / tags)
|
- Collection / Info: edit MP4 metadata (date / location / title / description / rating / tags)
|
||||||
- Widget: option to open collection on tap
|
- Widget: option to open collection on tap
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- rendering of panoramas with inconsistent metadata
|
||||||
|
|
||||||
## <a id="v1.7.1"></a>[v1.7.1] - 2022-10-09
|
## <a id="v1.7.1"></a>[v1.7.1] - 2022-10-09
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -15,8 +15,8 @@ class PanoramaInfo {
|
||||||
factory PanoramaInfo.fromMap(Map map) {
|
factory PanoramaInfo.fromMap(Map map) {
|
||||||
var cLeft = map['croppedAreaLeft'] as int?;
|
var cLeft = map['croppedAreaLeft'] as int?;
|
||||||
var cTop = map['croppedAreaTop'] as int?;
|
var cTop = map['croppedAreaTop'] as int?;
|
||||||
final cWidth = map['croppedAreaWidth'] as int?;
|
var cWidth = map['croppedAreaWidth'] as int?;
|
||||||
final cHeight = map['croppedAreaHeight'] as int?;
|
var cHeight = map['croppedAreaHeight'] as int?;
|
||||||
var fWidth = map['fullPanoWidth'] as int?;
|
var fWidth = map['fullPanoWidth'] as int?;
|
||||||
var fHeight = map['fullPanoHeight'] as int?;
|
var fHeight = map['fullPanoHeight'] as int?;
|
||||||
final projectionType = map['projectionType'] as String?;
|
final projectionType = map['projectionType'] as String?;
|
||||||
|
@ -27,6 +27,41 @@ class PanoramaInfo {
|
||||||
cTop = ((fHeight - cHeight) / 2).round();
|
cTop = ((fHeight - cHeight) / 2).round();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// handle inconsistent sizing (e.g. rotated image taken with OnePlus EB2103)
|
||||||
|
if (cWidth != null && cHeight != null && fWidth != null && fHeight != null) {
|
||||||
|
final croppedOrientation = cWidth > cHeight ? Orientation.landscape : Orientation.portrait;
|
||||||
|
final fullOrientation = fWidth > fHeight ? Orientation.landscape : Orientation.portrait;
|
||||||
|
var inconsistent = false;
|
||||||
|
if (croppedOrientation != fullOrientation) {
|
||||||
|
// inconsistent orientation
|
||||||
|
inconsistent = true;
|
||||||
|
final tmp = cHeight;
|
||||||
|
cHeight = cWidth;
|
||||||
|
cWidth = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cWidth > fWidth) {
|
||||||
|
// inconsistent full/cropped width
|
||||||
|
inconsistent = true;
|
||||||
|
final tmp = fWidth;
|
||||||
|
fWidth = cWidth;
|
||||||
|
cWidth = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cHeight > fHeight) {
|
||||||
|
// inconsistent full/cropped height
|
||||||
|
inconsistent = true;
|
||||||
|
final tmp = cHeight;
|
||||||
|
cHeight = fHeight;
|
||||||
|
fHeight = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inconsistent) {
|
||||||
|
cLeft = (fWidth - cWidth) ~/ 2;
|
||||||
|
cTop = (fHeight - cHeight) ~/ 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rect? croppedAreaRect;
|
Rect? croppedAreaRect;
|
||||||
if (cLeft != null && cTop != null && cWidth != null && cHeight != null) {
|
if (cLeft != null && cTop != null && cWidth != null && cHeight != null) {
|
||||||
croppedAreaRect = Rect.fromLTWH(cLeft.toDouble(), cTop.toDouble(), cWidth.toDouble(), cHeight.toDouble());
|
croppedAreaRect = Rect.fromLTWH(cLeft.toDouble(), cTop.toDouble(), cWidth.toDouble(), cHeight.toDouble());
|
||||||
|
|
|
@ -49,6 +49,7 @@ class Namespaces {
|
||||||
static const mpreg = 'http://ns.microsoft.com/photo/1.2/t/Region#';
|
static const mpreg = 'http://ns.microsoft.com/photo/1.2/t/Region#';
|
||||||
static const mwgrs = 'http://www.metadataworkinggroup.com/schemas/regions/';
|
static const mwgrs = 'http://www.metadataworkinggroup.com/schemas/regions/';
|
||||||
static const nga = 'https://standards.nga.gov/metadata/media/image/artobject/1.0';
|
static const nga = 'https://standards.nga.gov/metadata/media/image/artobject/1.0';
|
||||||
|
static const opMedia = 'http://ns.oneplus.com/media/1.0/';
|
||||||
static const panorama = 'http://ns.adobe.com/photoshop/1.0/panorama-profile';
|
static const panorama = 'http://ns.adobe.com/photoshop/1.0/panorama-profile';
|
||||||
static const panoStudio = 'http://www.tshsoft.com/xmlns';
|
static const panoStudio = 'http://www.tshsoft.com/xmlns';
|
||||||
static const pdf = 'http://ns.adobe.com/pdf/1.3/';
|
static const pdf = 'http://ns.adobe.com/pdf/1.3/';
|
||||||
|
@ -113,6 +114,7 @@ class Namespaces {
|
||||||
mp: 'Microsoft Photo 1.2',
|
mp: 'Microsoft Photo 1.2',
|
||||||
mwgrs: 'Regions',
|
mwgrs: 'Regions',
|
||||||
nga: 'National Gallery of Art',
|
nga: 'National Gallery of Art',
|
||||||
|
opMedia: 'OnePlus Media',
|
||||||
panorama: 'Panorama',
|
panorama: 'Panorama',
|
||||||
panoStudio: 'PanoramaStudio',
|
panoStudio: 'PanoramaStudio',
|
||||||
pdf: 'PDF',
|
pdf: 'PDF',
|
||||||
|
|
Loading…
Reference in a new issue