diff options
author | Eik Brauer <ebrauer@google.com> | 2016-02-23 12:19:25 +0100 |
---|---|---|
committer | Eik Brauer <ebrauer@google.com> | 2016-02-23 12:19:25 +0100 |
commit | 883a1e5419990f51b8e928969e9c5a09869bce0e (patch) | |
tree | f3ab9cc87169355c9c5df36d5cddab75d33de2d0 /src/piex_types.h | |
parent | ffde000e0b3ed2a99232fc16c7ae11a9d4695939 (diff) | |
download | piex-883a1e5419990f51b8e928969e9c5a09869bce0e.tar.gz |
Prepares support for uncompressed thumbnails.android-n-preview-1
Diffstat (limited to 'src/piex_types.h')
-rw-r--r-- | src/piex_types.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/piex_types.h b/src/piex_types.h index f7c4d3e..b4824fc 100644 --- a/src/piex_types.h +++ b/src/piex_types.h @@ -30,6 +30,25 @@ enum Error { kUnsupported, }; +// Defines the properties of an image. width and height are required for +// uncompressed images, but are optional for compressed images. An image is +// invalid when its length is 0. +struct Image { + enum Format { + kJpegCompressed, + }; + + std::uint16_t width = 0; + std::uint16_t height = 0; + std::uint32_t length = 0; + std::uint32_t offset = 0; + Format format = kJpegCompressed; + + bool operator>(const Image& rhs) const { + return width > rhs.width && height > rhs.height; + } +}; + // Contains relevant image information as well as the 'preview_offset' and the // 'preview_length' which are used to obtain the JPEG compressed preview image. // 'full_width' and 'full_height' are correctly cropped but not rotated. @@ -61,10 +80,15 @@ struct PreviewImageData { // correctly. A thumbnail is typically 160x120 pixel small and usually // has black borders at the top and bottom. If length is 0 the image could not // be extracted. + // Note: Deprecate the offset, length versions. Use these Image structs + // instead. std::uint32_t preview_offset = 0; std::uint32_t preview_length = 0; std::uint32_t thumbnail_offset = 0; std::uint32_t thumbnail_length = 0; + Image preview; + Image thumbnail; + std::uint32_t exif_orientation = 1; // horizontal as default ColorSpace color_space = kSrgb; |