# KExiv2Iface::Matrix

KExiv2Iface::Matrix Namespace Reference

## Functions

RotationMatrix matrix (RotationMatrix::TransformationAction action)

RotationMatrix matrix (KExiv2::ImageOrientation exifOrientation)

## Variables

static const RotationMatrix flipHorizontal (-1, 0, 0, 1)

static const RotationMatrix flipVertical (1, 0, 0,-1)

static const RotationMatrix identity (1, 0, 0, 1)

static const RotationMatrix rotate180 (-1, 0, 0,-1)

static const RotationMatrix rotate270 (0,-1, 1, 0)

static const RotationMatrix rotate90 (0, 1,-1, 0)

static const RotationMatrix rotate90flipHorizontal (0, 1, 1, 0)

static const RotationMatrix rotate90flipVertical (0,-1,-1, 0)

## Detailed Description

If the picture is displayed according to the exif orientation tag, the user will request rotating operations relative to what he sees, and that is the picture rotated according to the EXIF tag.

So the operation requested and the given EXIF angle must be combined. E.g. if orientation is "6" (rotate 90 clockwiseto show correctly) and the user selects 180 clockwise, the operation is 270. If the user selected 270, the operation would be None (and clearing the exif tag).

This requires to describe the transformations in a model which cares for both composing (180+90=270) and eliminating (180+180=no action), as well as the non-commutative nature of the operations (vflip+90 is not 90+vflip)

All 2D transformations can be described by a 2x3 matrix, see QWRotationMatrix. All transformations needed here - rotate 90, 180, 270, flipV, flipH - can be described in a 2x2 matrix with the values 0,1,-1 (because flipping is expressed by changing the sign only, and sine and cosine of 90, 180 and 270 are either 0,1 or -1).

x' = m11 x + m12 y y' = m21 x + m22 y

Moreover, all combinations of these rotate/flip operations result in one of the eight matrices defined below. (I did not proof that mathematically, but empirically)

static const RotationMatrix identity; //( 1, 0, 0, 1) static const RotationMatrix rotate90; //( 0, 1, -1, 0) static const RotationMatrix rotate180; //(-1, 0, 0, -1) static const RotationMatrix rotate270; //( 0, -1, 1, 0) static const RotationMatrix flipHorizontal; //(-1, 0, 0, 1) static const RotationMatrix flipVertical; //( 1, 0, 0, -1) static const RotationMatrix rotate90flipHorizontal; //( 0, 1, 1, 0), first rotate, then flip static const RotationMatrix rotate90flipVertical; //( 0, -1, -1, 0), first rotate, then flip

This file is part of the KDE documentation.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6857858,"math_prob":0.99533385,"size":2601,"snap":"2020-45-2020-50","text_gpt3_token_len":750,"char_repetition_ratio":0.22795533,"word_repetition_ratio":0.04699739,"special_character_ratio":0.30718955,"punctuation_ratio":0.19839679,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9703022,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-27T00:16:22Z\",\"WARC-Record-ID\":\"<urn:uuid:79af4cc2-56db-4cd7-a732-167ff8c5c53a>\",\"Content-Length\":\"19135\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:00cf06fa-d36d-48e6-987b-fcb5a91b073a>\",\"WARC-Concurrent-To\":\"<urn:uuid:2de828a0-8783-46b8-baeb-be771a79d922>\",\"WARC-IP-Address\":\"172.67.73.202\",\"WARC-Target-URI\":\"https://api.kde.org/libkexiv2/html/namespaceKExiv2Iface_1_1Matrix.html\",\"WARC-Payload-Digest\":\"sha1:YHG4UOSAOXICVYUPMZCDBCACISG2N4SZ\",\"WARC-Block-Digest\":\"sha1:YUWDFYH4PSLW3ZQCLXSDO3EDGBS7BTJY\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141189030.27_warc_CC-MAIN-20201126230216-20201127020216-00608.warc.gz\"}"}