| digiKam Developer Documentation Professional Photo Management with the Power of Open Source

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Digikam::TagRegion Class Reference

Use this small class to convert between the formatted textual representation of a tag region in the database and the corresponding object.

## Public Types
enum | Type { Invalid , Rect }

## Public Member Functions
| TagRegion ()=default
| Construct an invalid region.
| TagRegion (const QRect &rect)
| Construct with the region.
| TagRegion (const QString &descriptor)
| Construct with the textual descriptor.
bool | intersects (const TagRegion &other, double fraction=0)
| Returns true if this and the other region intersect.
bool | isValid () const
bool | operator!= (const TagRegion &other) const
bool | operator== (const TagRegion &other) const
QRect | toRect () const
| If type is Rect, returns the contained rectangle.
QVariant | toVariant () const
| Stores in / loads from a variant.
QString | toXml () const
| Returns an XML textual representation of this region.
Type | type () const

## Static Public Member Functions
static QRectF | absoluteToRelative (const QRect &region, const QSize &fullSize)
| Takes absolute region and full size to return the original relative region.
static QSize | adjustToOrientation (QRect &region, int orientation, const QSize &fullSize)
| Rotate and flip region to MetaEngine::ImageOrientation.
static TagRegion | fromVariant (const QVariant &var)
static QRect | mapFromOriginalSize (const DImg &reducedSizeImage, const QRect &fullSizeDetail)
static QRect | mapFromOriginalSize (const QSize &fullImageSize, const QSize &reducedImageSize, const QRect &fullSizeDetail)
static QRect | mapToOriginalSize (const DImg &reducedSizeImage, const QRect &reducedSizeDetail)
| Takes the original and reduced size from the DImg.
static QRect | mapToOriginalSize (const QSize &fullImageSize, const QSize &reducedImageSize, const QRect &reducedSizeDetail)
| Converts detail rectangles taken from a reduced size image to the original size, and vice versa.
static QRect | relativeToAbsolute (const QRectF &region, const DImg &reducedSizeImage)
| Takes the original and reduced size from the DImg, maps to original size.
static QRect | relativeToAbsolute (const QRectF &region, const QSize &fullSize)
| Takes a relative region and a full size and returns the absolute region.
static void | reverseToOrientation (QRect &region, int orientation, const QSize &fullSize)
| Reverse rotate and flip region to MetaEngine::ImageOrientation.

## Protected Attributes
Type | m_type = Invalid
QVariant | m_value

## Member Function Documentation

## ◆ absoluteToRelative()

QRectF Digikam::TagRegion::absoluteToRelative | ( | const QRect & | region,
|  | const QSize & | fullSize
| ) |  |
| static

Used to write back rectangles into image's XMP. see MetadataHub::write.

## ◆ adjustToOrientation()

QSize Digikam::TagRegion::adjustToOrientation | ( | QRect & | region,
|  | int | orientation,
|  | const QSize & | fullSize
| ) |  |
| static

The value region are calculated for the new image orientation.

## ◆ intersects()

bool Digikam::TagRegion::intersects | ( | const TagRegion & | other,
|  | double | fraction = `0`
| ) |  |

fraction describes the relative overlap area needed to return true: If fraction is 0, returns true if the regions intersect at all. If fraction is 1, returns true only if other is completely contained in this region. If fraction is x, 0 < x < 1, returns true if the area of this region covered by the other is greater than x. Invalid areas never intersect.

## ◆ reverseToOrientation()

void Digikam::TagRegion::reverseToOrientation | ( | QRect & | region,
|  | int | orientation,
|  | const QSize & | fullSize
| ) |  |
| static

The value region are calculated for the new image orientation.

## ◆ toVariant()

QVariant Digikam::TagRegion::toVariant | ( |  | ) | const

Will only use native QVariant types.