-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1857 from alicevision/mug/exifOrientation
[ui] Viewer2D: support all Exif orientation tags
- Loading branch information
Showing
3 changed files
with
99 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import QtQuick 2.11 | ||
|
||
/** | ||
* Loader with a predefined transform to orient its content according to the provided Exif tag. | ||
* Useful when displaying images and overlayed information in the Viewer2D. | ||
* | ||
* Usage: | ||
* - set the orientationTag property to specify Exif orientation tag. | ||
* - set the xOrigin/yOrigin properties to specify the transform origin. | ||
*/ | ||
Loader { | ||
property var orientationTag: undefined | ||
|
||
property real xOrigin: 0 | ||
property real yOrigin: 0 | ||
|
||
transform: [ | ||
Rotation { | ||
angle: { | ||
switch(orientationTag) { | ||
case "3": | ||
return 180; | ||
case "4": | ||
return 180; | ||
case "5": | ||
return 90; | ||
case "6": | ||
return 90; | ||
case "7": | ||
return -90; | ||
case "8": | ||
return -90; | ||
default: | ||
return 0; | ||
} | ||
} | ||
origin.x: xOrigin | ||
origin.y: yOrigin | ||
}, | ||
Scale { | ||
xScale : { | ||
switch(orientationTag) { | ||
case "2": | ||
return -1; | ||
case "4": | ||
return -1; | ||
case "5": | ||
return -1; | ||
case "7": | ||
return -1; | ||
default: | ||
return 1; | ||
} | ||
} | ||
origin.x: xOrigin | ||
origin.y: yOrigin | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters