Loading...
Searching...
No Matches
transform.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Raspberry Pi Ltd
*
* 2D plane transforms
*/
#pragma once
namespace libcamera {
enum class Orientation;
enum class Transform : int {
Identity = 0,
Rot0 = Identity,
HFlip = 1,
VFlip = 2,
HVFlip = HFlip | VFlip,
Rot180 = HVFlip,
Transpose = 4,
Rot270 = HFlip | Transpose,
Rot90 = VFlip | Transpose,
Rot180Transpose = HFlip | VFlip | Transpose
};
constexpr Transform operator&(Transform t0, Transform t1)
{
return static_cast<Transform>(static_cast<int>(t0) & static_cast<int>(t1));
}
constexpr Transform operator|(Transform t0, Transform t1)
{
return static_cast<Transform>(static_cast<int>(t0) | static_cast<int>(t1));
}
constexpr Transform operator^(Transform t0, Transform t1)
{
return static_cast<Transform>(static_cast<int>(t0) ^ static_cast<int>(t1));
}
constexpr Transform &operator&=(Transform &t0, Transform t1)
{
return t0 = t0 & t1;
}
constexpr Transform &operator|=(Transform &t0, Transform t1)
{
return t0 = t0 | t1;
}
constexpr Transform &operator^=(Transform &t0, Transform t1)
{
return t0 = t0 ^ t1;
}
Transform operator*(Transform t0, Transform t1);
Transform operator-(Transform t);
constexpr bool operator!(Transform t)
{
return t == Transform::Identity;
}
constexpr Transform operator~(Transform t)
{
return static_cast<Transform>(~static_cast<int>(t) & 7);
}
Transform transformFromRotation(int angle, bool *success = nullptr);
Transform operator/(const Orientation &o1, const Orientation &o2);
Orientation operator*(const Orientation &o, const Transform &t);
const char *transformToString(Transform t);
} /* namespace libcamera */
libcamera
Top-level libcamera namespace.
Definition bound_method.h:15
libcamera::operator&=
constexpr Transform & operator&=(Transform &t0, Transform t1)
Apply bitwise AND-assignment operator between the bits in the two transforms.
Definition transform.h:42
libcamera::Transform
Transform
Enum to represent a 2D plane transform.
Definition transform.h:14
libcamera::Transform::HFlip
@ HFlip
Definition transform.h:17
libcamera::Transform::VFlip
@ VFlip
Definition transform.h:18
libcamera::Transform::Rot0
@ Rot0
Definition transform.h:16
libcamera::Transform::Transpose
@ Transpose
Definition transform.h:21
libcamera::Transform::HVFlip
@ HVFlip
Definition transform.h:19
libcamera::Transform::Rot270
@ Rot270
Definition transform.h:22
libcamera::Transform::Identity
@ Identity
Definition transform.h:15
libcamera::Transform::Rot90
@ Rot90
Definition transform.h:23
libcamera::Transform::Rot180Transpose
@ Rot180Transpose
Definition transform.h:24
libcamera::Transform::Rot180
@ Rot180
Definition transform.h:20
libcamera::transformFromRotation
Transform transformFromRotation(int angle, bool *success=nullptr)
Return the transform representing a rotation of the given angle clockwise.
Definition transform.cpp:278
libcamera::operator~
constexpr Transform operator~(Transform t)
Return the transform with all the bits inverted individually.
Definition transform.h:66
libcamera::operator*
Transform operator*(Transform t0, Transform t1)
Compose two transforms by applying t0 first then t1.
Definition transform.cpp:209
libcamera::operator|
constexpr Transform operator|(Transform t0, Transform t1)
Apply bitwise OR operator between the bits in the two transforms.
Definition transform.h:32
libcamera::Orientation
Orientation
The image orientation in a memory buffer.
Definition orientation.h:14
libcamera::operator^
constexpr Transform operator^(Transform t0, Transform t1)
Apply bitwise XOR operator between the bits in the two transforms.
Definition transform.h:37
libcamera::transformToString
const char * transformToString(Transform t)
Return a character string describing the transform.
Definition transform.cpp:393
libcamera::operator!
constexpr bool operator!(Transform t)
Return true if the transform is the Identity, otherwise false.
Definition transform.h:61
libcamera::operator&
constexpr Transform operator&(Transform t0, Transform t1)
Apply bitwise AND operator between the bits in the two transforms.
Definition transform.h:27
libcamera::operator/
Transform operator/(const Orientation &o1, const Orientation &o2)
Return the Transform that applied to o2 gives o1.
Definition transform.cpp:347
libcamera::operator|=
constexpr Transform & operator|=(Transform &t0, Transform t1)
Apply bitwise OR-assignment operator between the bits in the two transforms.
Definition transform.h:47
libcamera::operator-
Transform operator-(Transform t)
Invert a transform.
Definition transform.cpp:235
libcamera::operator^=
constexpr Transform & operator^=(Transform &t0, Transform t1)
Apply bitwise XOR-assignment operator between the bits in the two transforms.
Definition transform.h:52