LibreOffice Module vcl (master)
1
vcl
source
filter
GraphicNativeMetadata.cxx
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
#include <
vcl/GraphicNativeMetadata.hxx
>
21
#include <
vcl/gfxlink.hxx
>
22
#include "
jpeg/Exif.hxx
"
23
#include <memory>
24
25
GraphicNativeMetadata::GraphicNativeMetadata
()
26
: mRotation(0)
27
{
28
}
29
30
bool
GraphicNativeMetadata::read
(
Graphic
const
& rGraphic)
31
{
32
GfxLink
aLink = rGraphic.
GetGfxLink
();
33
if
(aLink.
GetType
() !=
GfxLinkType::NativeJpg
)
34
return
false
;
35
36
sal_uInt32 aDataSize = aLink.
GetDataSize
();
37
if
(!aDataSize)
38
return
false
;
39
40
std::unique_ptr<sal_uInt8[]>
aBuffer
(
new
sal_uInt8
[aDataSize]);
41
42
memcpy(
aBuffer
.get(), aLink.
GetData
(), aDataSize);
43
SvMemoryStream
aMemoryStream(
aBuffer
.get(), aDataSize, StreamMode::READ);
44
45
read
(aMemoryStream);
46
47
return
true
;
48
}
49
50
bool
GraphicNativeMetadata::read
(
SvStream
& rStream)
51
{
52
Exif
aExif;
53
aExif.
read
(rStream);
54
mRotation
= aExif.
getRotation
();
55
56
return
true
;
57
}
58
59
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Exif.hxx
GraphicNativeMetadata.hxx
Exif
Definition:
Exif.hxx:44
Exif::read
bool read(SvStream &rStream)
Definition:
Exif.cxx:66
Exif::getRotation
Degree10 getRotation() const
Definition:
Exif.cxx:49
GfxLink
Definition:
gfxlink.hxx:61
GfxLink::GetData
const sal_uInt8 * GetData() const
Definition:
gfxlink.cxx:87
GfxLink::GetDataSize
sal_uInt32 GetDataSize() const
Definition:
gfxlink.hxx:85
GfxLink::GetType
GfxLinkType GetType() const
Definition:
gfxlink.hxx:78
GraphicNativeMetadata::read
bool read(Graphic const &rGraphic)
Definition:
GraphicNativeMetadata.cxx:30
GraphicNativeMetadata::mRotation
Degree10 mRotation
Definition:
GraphicNativeMetadata.hxx:28
GraphicNativeMetadata::GraphicNativeMetadata
GraphicNativeMetadata()
Definition:
GraphicNativeMetadata.cxx:25
Graphic
Definition:
graph.hxx:83
Graphic::GetGfxLink
GfxLink GetGfxLink() const
Definition:
graph.cxx:510
SvMemoryStream
SvStream
gfxlink.hxx
GfxLinkType::NativeJpg
@ NativeJpg
sal_uInt8
unsigned char sal_uInt8
aBuffer
std::unique_ptr< char[]> aBuffer
Generated on Sun Jul 30 2023 04:35:21 for LibreOffice Module vcl (master) by
1.9.3