OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 29 matching lines...) Expand all Loading... |
40 OriginTopLeft = 1, // default | 40 OriginTopLeft = 1, // default |
41 OriginTopRight = 2, // mirror along y-axis | 41 OriginTopRight = 2, // mirror along y-axis |
42 OriginBottomRight = 3, // 180 degree rotation | 42 OriginBottomRight = 3, // 180 degree rotation |
43 OriginBottomLeft = 4, // mirror along the x-axis | 43 OriginBottomLeft = 4, // mirror along the x-axis |
44 OriginLeftTop = 5, // mirror along x-axis + 270 degree CW rotation | 44 OriginLeftTop = 5, // mirror along x-axis + 270 degree CW rotation |
45 OriginRightTop = 6, // 90 degree CW rotation | 45 OriginRightTop = 6, // 90 degree CW rotation |
46 OriginRightBottom = 7, // mirror along x-axis + 90 degree CW rotation | 46 OriginRightBottom = 7, // mirror along x-axis + 90 degree CW rotation |
47 OriginLeftBottom = 8, // 270 degree CW rotation | 47 OriginLeftBottom = 8, // 270 degree CW rotation |
48 // All other values are "reserved" as of EXIF 2.2 | 48 // All other values are "reserved" as of EXIF 2.2 |
49 DefaultImageOrientation = OriginTopLeft, | 49 DefaultImageOrientation = OriginTopLeft, |
| 50 ImageOrientationEnumEnd = OriginLeftBottom + 1, |
50 }; | 51 }; |
51 | 52 |
52 enum RespectImageOrientationEnum { | 53 enum RespectImageOrientationEnum { |
53 DoNotRespectImageOrientation = 0, | 54 DoNotRespectImageOrientation = 0, |
54 RespectImageOrientation = 1 | 55 RespectImageOrientation = 1 |
55 }; | 56 }; |
56 | 57 |
57 class PLATFORM_EXPORT ImageOrientation { | 58 class PLATFORM_EXPORT ImageOrientation { |
58 public: | 59 public: |
59 ImageOrientation(ImageOrientationEnum orientation = DefaultImageOrientation) | 60 ImageOrientation(ImageOrientationEnum orientation = DefaultImageOrientation) |
(...skipping 17 matching lines...) Expand all Loading... |
77 return static_cast<ImageOrientationEnum>(exifValue); | 78 return static_cast<ImageOrientationEnum>(exifValue); |
78 } | 79 } |
79 | 80 |
80 // This transform can be used for drawing an image according to the orientat
ion. | 81 // This transform can be used for drawing an image according to the orientat
ion. |
81 // It should be used in a right-handed coordinate system. | 82 // It should be used in a right-handed coordinate system. |
82 AffineTransform transformFromDefault(const FloatSize& drawnSize) const; | 83 AffineTransform transformFromDefault(const FloatSize& drawnSize) const; |
83 | 84 |
84 inline bool operator==(const ImageOrientation& other) const { return other.m
_orientation == m_orientation; } | 85 inline bool operator==(const ImageOrientation& other) const { return other.m
_orientation == m_orientation; } |
85 inline bool operator!=(const ImageOrientation& other) const { return !(*this
== other); } | 86 inline bool operator!=(const ImageOrientation& other) const { return !(*this
== other); } |
86 | 87 |
| 88 ImageOrientationEnum orientation() const { return m_orientation; } |
| 89 |
87 private: | 90 private: |
88 // FIXME: This only needs to be one byte. | 91 // FIXME: This only needs to be one byte. |
89 ImageOrientationEnum m_orientation; | 92 ImageOrientationEnum m_orientation; |
90 }; | 93 }; |
91 | 94 |
92 } // namespace blink | 95 } // namespace blink |
93 | 96 |
94 #endif // ImageOrientation_h | 97 #endif // ImageOrientation_h |
OLD | NEW |