MythTV
master
|
Encapsulates Exif orientation processing. More...
#include <libmythmetadata/imagemetadata.h>
Public Member Functions | |
Orientation (int composite) | |
Orientation (int current, int file) | |
int | Composite () const |
Encode original & current orientation to a single Db field. More... | |
int | Transform (int transform) |
Adjust orientation to apply a transform to an image. More... | |
int | GetCurrent (bool compensate) |
Determines orientation required for an image. More... | |
QString | Description () const |
Generate text description of orientation. More... | |
Static Public Member Functions | |
static int | FromRotation (const QString °rees) |
Convert degrees of rotation into Exif orientation code. More... | |
Private Types | |
using | Matrix = QHash< int, QHash< int, int > > |
Private Member Functions | |
int | Apply (int transform) const |
Adjust current orientation code to apply a transform to an image. More... | |
Static Private Member Functions | |
static QString | AsText (int orientation) |
Converts orientation code to text description for info display. More... | |
static Matrix | InitOrientationMatrix () |
Initialises conversion matrix for Qt 5.4.1. More... | |
Private Attributes | |
int | m_current |
The orientation to use: the file orientation with user transformations applied. More... | |
int | m_file |
The orientation of the raw file image, as specified by the camera. More... | |
Static Private Attributes | |
static const bool | krunningQt541 = (strcmp(qVersion(), "5.4.1") == 0) |
True when using Qt 5.4.1 with its deviant orientation behaviour. More... | |
static const Matrix | kQt541_orientation |
Orientation conversions for proper display on Qt 5.4.1. More... | |
Encapsulates Exif orientation processing.
The exif code indicates how the raw image should be rotated/mirrored in order to display correctly. This manipulation is expensive, so done once only. User transformations are applied to the code to achieve the required effect. Both file orientation and current orientation are stored in the Db (together) to cope with deviant Qt versions. This composite code is 2-digits where 1st = current orientation, 2nd = original file orientation
Definition at line 62 of file imagemetadata.h.
|
private |
Definition at line 83 of file imagemetadata.h.
|
inlineexplicit |
Definition at line 66 of file imagemetadata.h.
|
inline |
Definition at line 68 of file imagemetadata.h.
|
inline |
Encode original & current orientation to a single Db field.
Definition at line 71 of file imagemetadata.h.
Referenced by ImageScanThread< ImageDbSg >::SyncFile(), and Transform().
int Orientation::Transform | ( | int | transform | ) |
Adjust orientation to apply a transform to an image.
transform | Rotation/flip/reset to apply |
Definition at line 26 of file imagemetadata.cpp.
Referenced by ImageHandler< ImageDbSg >::HandleTransform().
int Orientation::GetCurrent | ( | bool | compensate | ) |
Determines orientation required for an image.
Some Qt versions automatically apply file orientation when an image is loaded. This compensates for that to ensure images are always orientated correctly.
compensate | Whether to compensate for Qt auto-rotation |
Definition at line 83 of file imagemetadata.cpp.
Referenced by ThumbThread< ImageDbSg >::CreateThumbnail(), Slide::LoadSlide(), and ImageScanThread< ImageDbSg >::SyncFile().
QString Orientation::Description | ( | ) | const |
Generate text description of orientation.
Reports code & its interpretation of file orientation and, if different, the Db orientation
Definition at line 226 of file imagemetadata.cpp.
Referenced by ReadMetaThread::run().
|
static |
Convert degrees of rotation into Exif orientation code.
degrees | CW rotation required to show video correctly |
Definition at line 210 of file imagemetadata.cpp.
Referenced by VideoMetaData::GetOrientation().
|
staticprivate |
Converts orientation code to text description for info display.
orientation | Exif code |
Definition at line 240 of file imagemetadata.cpp.
Referenced by Description().
|
private |
Adjust current orientation code to apply a transform to an image.
When displayed the image will be orientated iaw its orientation code. The transform is effected by applying the reverse transform to the orientation code.
transform | Rotation/flip to apply |
Definition at line 112 of file imagemetadata.cpp.
Referenced by Transform().
|
staticprivate |
Initialises conversion matrix for Qt 5.4.1.
Definition at line 38 of file imagemetadata.cpp.
|
staticprivate |
True when using Qt 5.4.1 with its deviant orientation behaviour.
Definition at line 86 of file imagemetadata.h.
Referenced by GetCurrent(), and InitOrientationMatrix().
|
staticprivate |
Orientation conversions for proper display on Qt 5.4.1.
Definition at line 88 of file imagemetadata.h.
Referenced by GetCurrent().
|
private |
The orientation to use: the file orientation with user transformations applied.
Definition at line 92 of file imagemetadata.h.
Referenced by Apply(), Description(), GetCurrent(), and Transform().
|
private |
The orientation of the raw file image, as specified by the camera.
Definition at line 94 of file imagemetadata.h.
Referenced by Apply(), Description(), and GetCurrent().