Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_icon.cpp
Go to the documentation of this file.
1// Copyright 2019 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "core/fpdfdoc/cpdf_icon.h"
8
9#include <utility>
10
11#include "core/fpdfapi/parser/cpdf_dictionary.h"
12#include "core/fpdfapi/parser/cpdf_stream.h"
13
14CPDF_Icon::CPDF_Icon(RetainPtr<const CPDF_Stream> pStream)
16
17CPDF_Icon::~CPDF_Icon() = default;
18
19CFX_SizeF CPDF_Icon::GetImageSize() const {
20 RetainPtr<const CPDF_Dictionary> pDict = m_pStream->GetDict();
21 if (!pDict)
22 return CFX_SizeF();
23
24 CFX_FloatRect rect = pDict->GetRectFor("BBox");
25 return {rect.right - rect.left, rect.top - rect.bottom};
26}
27
28CFX_Matrix CPDF_Icon::GetImageMatrix() const {
29 RetainPtr<const CPDF_Dictionary> pDict = m_pStream->GetDict();
30 if (!pDict)
31 return CFX_Matrix();
32
33 return pDict->GetMatrixFor("Matrix");
34}
35
36ByteString CPDF_Icon::GetImageAlias() const {
37 RetainPtr<const CPDF_Dictionary> pDict = m_pStream->GetDict();
38 if (!pDict)
39 return ByteString();
40
41 return pDict->GetByteStringFor("Name");
42}
CFX_Matrix()=default
CFX_Matrix GetImageMatrix() const
Definition cpdf_icon.cpp:28
CPDF_Icon(RetainPtr< const CPDF_Stream > pStream)
Definition cpdf_icon.cpp:14
CFX_SizeF GetImageSize() const
Definition cpdf_icon.cpp:19
ByteString GetImageAlias() const
Definition cpdf_icon.cpp:36