LibreOffice Module vcl (master)  1
Exif.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
21 #define INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
22 
23 #include <tools/stream.hxx>
24 
25 namespace exif {
27  TOP_LEFT = 1,
28  TOP_RIGHT = 2,
31  LEFT_TOP = 5,
32  RIGHT_TOP = 6,
35 };
36 };
37 
38 enum Tag {
39  ORIENTATION = 0x0112
40 };
41 
42 class Exif final
43 {
44 private:
47 
48  bool processJpeg(SvStream& rStream, bool bSetValue);
49  bool processExif(SvStream& rStream, sal_uInt16 aLength, bool bSetValue);
50  void processIFD(sal_uInt8* pExifData, sal_uInt16 aLength, sal_uInt16 aOffset, sal_uInt16 aNumberOfTags, bool bSetValue, bool bLittleEndian);
51 
52  struct ExifIFD {
57  };
58 
59  struct TiffHeader {
60  sal_uInt16 byteOrder;
61  sal_uInt16 tagAlign;
62  sal_uInt32 offset;
63  };
64 
65  static exif::Orientation convertToOrientation(sal_Int32 value);
66 
67 public:
68  Exif();
69  ~Exif();
70 
71  bool hasExif() const { return mbExifPresent;}
72 
74  sal_Int32 getRotation() const;
75 
77 
78  bool read(SvStream& rStream);
79  void write(SvStream& rStream);
80 
81 };
82 
83 #endif // INCLUDED_VCL_SOURCE_FILTER_JPEG_EXIF_HXX
84 
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool processJpeg(SvStream &rStream, bool bSetValue)
Definition: Exif.cxx:89
Definition: Exif.hxx:25
sal_uInt8 type[2]
Definition: Exif.hxx:54
sal_uInt8 offset[4]
Definition: Exif.hxx:56
void write(SvStream &rStream)
Definition: Exif.cxx:82
sal_uInt16 tagAlign
Definition: Exif.hxx:61
bool read(SvStream &rStream)
Definition: Exif.cxx:73
~Exif()
Definition: Exif.cxx:32
sal_uInt16 byteOrder
Definition: Exif.hxx:60
Tag
Definition: Exif.hxx:38
void setOrientation(exif::Orientation orientation)
Definition: Exif.cxx:36
sal_uInt8 tag[2]
Definition: Exif.hxx:53
bool mbExifPresent
Definition: Exif.hxx:46
Orientation
Definition: Exif.hxx:26
sal_uInt32 offset
Definition: Exif.hxx:62
exif::Orientation maOrientation
Definition: Exif.hxx:45
static exif::Orientation convertToOrientation(sal_Int32 value)
Definition: Exif.cxx:40
exif::Orientation getOrientation() const
Definition: Exif.hxx:73
unsigned char sal_uInt8
orientation
Definition: jobdata.hxx:27
void processIFD(sal_uInt8 *pExifData, sal_uInt16 aLength, sal_uInt16 aOffset, sal_uInt16 aNumberOfTags, bool bSetValue, bool bLittleEndian)
Definition: Exif.cxx:200
Definition: Exif.hxx:42
Exif()
Definition: Exif.cxx:27
bool processExif(SvStream &rStream, sal_uInt16 aLength, bool bSetValue)
Definition: Exif.cxx:229
sal_Int32 getRotation() const
Definition: Exif.cxx:55
sal_uInt8 count[4]
Definition: Exif.hxx:55
bool hasExif() const
Definition: Exif.hxx:71