1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_image_Orientation_h
7 #define mozilla_image_Orientation_h
14 enum class Angle
: uint8_t {
21 enum class Flip
: uint8_t {
27 * A struct that describes an image's orientation as a rotation optionally
28 * followed by a reflection. This may be used to be indicate an image's inherent
29 * orientation or a desired orientation for the image.
33 explicit Orientation(Angle aRotation
= Angle::D0
,
34 Flip mFlip
= Flip::Unflipped
)
39 bool IsIdentity() const {
40 return (rotation
== Angle::D0
) && (flip
== Flip::Unflipped
);
43 bool SwapsWidthAndHeight() const {
44 return (rotation
== Angle::D90
) || (rotation
== Angle::D270
);
47 bool operator==(const Orientation
& aOther
) const {
48 return (rotation
== aOther
.rotation
) && (flip
== aOther
.flip
);
51 bool operator!=(const Orientation
& aOther
) const {
52 return !(*this == aOther
);
60 } // namespace mozilla
62 #endif // mozilla_image_Orientation_h