MythTV master
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Orientation Class Reference

Encapsulates Exif orientation processing. More...

#include <libmythmetadata/imagemetadata.h>

Collaboration diagram for Orientation:
[legend]

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 () const
 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 &degrees)
 Convert degrees of rotation into Exif orientation code. More...
 

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...
 

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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Orientation() [1/2]

Orientation::Orientation ( int  composite)
inlineexplicit

Definition at line 66 of file imagemetadata.h.

◆ Orientation() [2/2]

Orientation::Orientation ( int  current,
int  file 
)
inline

Definition at line 68 of file imagemetadata.h.

Member Function Documentation

◆ Apply()

int Orientation::Apply ( int  transform) const
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.

See also
http://jpegclub.org/exif_orientation.html
Parameters
transformRotation/flip to apply
Returns
int New orientation code that will apply the transform to the image

Definition at line 55 of file imagemetadata.cpp.

Referenced by Transform().

◆ AsText()

QString Orientation::AsText ( int  orientation)
staticprivate

Converts orientation code to text description for info display.

Parameters
orientationExif code
Returns
QString Description text

Definition at line 183 of file imagemetadata.cpp.

Referenced by Description().

◆ Composite()

int Orientation::Composite ( ) const
inline

Encode original & current orientation to a single Db field.

Definition at line 71 of file imagemetadata.h.

Referenced by ImageScanThread< DBFS >::SyncFile(), and Transform().

◆ Description()

QString Orientation::Description ( ) const

Generate text description of orientation.

Reports code & its interpretation of file orientation and, if different, the Db orientation

Returns
Text description of orientation

Definition at line 169 of file imagemetadata.cpp.

Referenced by ReadMetaThread::run().

◆ FromRotation()

int Orientation::FromRotation ( const QString &  degrees)
static

Convert degrees of rotation into Exif orientation code.

Parameters
degreesCW rotation required to show video correctly
Returns
QString Orientation code as per Exif spec.

Definition at line 153 of file imagemetadata.cpp.

Referenced by VideoMetaData::GetOrientation().

◆ GetCurrent()

int Orientation::GetCurrent ( ) const

Determines orientation required for an image.

Returns
Exif orientation code to apply after the image has been loaded.

Definition at line 40 of file imagemetadata.cpp.

Referenced by ThumbThread< DBFS >::CreateThumbnail(), Slide::LoadSlide(), and ImageScanThread< DBFS >::SyncFile().

◆ Transform()

int Orientation::Transform ( int  transform)

Adjust orientation to apply a transform to an image.

Parameters
transformRotation/flip/reset to apply
Returns
int Adjusted composite orientation of the image

Definition at line 29 of file imagemetadata.cpp.

Referenced by ImageHandler< DBFS >::HandleTransform().

Member Data Documentation

◆ m_current

int Orientation::m_current
private

The orientation to use: the file orientation with user transformations applied.

Definition at line 84 of file imagemetadata.h.

Referenced by Apply(), Description(), GetCurrent(), and Transform().

◆ m_file

int Orientation::m_file
private

The orientation of the raw file image, as specified by the camera.

Definition at line 86 of file imagemetadata.h.

Referenced by Apply(), and Description().


The documentation for this class was generated from the following files: