LibreOffice Module vcl (master) 1
PngImageReader.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 */
10
11#ifndef INCLUDED_VCL_FILTER_PNGIMAGEREADER_HXX
12#define INCLUDED_VCL_FILTER_PNGIMAGEREADER_HXX
13
14#include <sal/config.h>
15
16#include <memory>
17#include <vector>
18
19#include <vcl/dllapi.h>
21
22#include <com/sun/star/uno/Reference.hxx>
23
24constexpr sal_uInt64 PNG_SIGNATURE = 0x89504E470D0A1A0A;
25constexpr sal_uInt32 PNG_IHDR_SIGNATURE = 0x49484452;
26constexpr sal_uInt32 PNG_IDAT_SIGNATURE = 0x49444154;
27constexpr sal_uInt32 PNG_PHYS_SIGNATURE = 0x70485973;
28constexpr sal_uInt32 PNG_TRNS_SIGNATURE = 0x74524E53;
29constexpr sal_uInt32 PNG_ACTL_SIGNATURE = 0x6163544C;
30constexpr sal_uInt32 PNG_FCTL_SIGNATURE = 0x6663544C;
31constexpr sal_uInt32 PNG_FDAT_SIGNATURE = 0x66644154;
32constexpr sal_uInt32 PNG_IEND_SIGNATURE = 0x49454E44;
33constexpr sal_uInt32 PNG_IEND_CRC = 0xAE426082;
34constexpr int PNG_SIGNATURE_SIZE = 8;
35constexpr int PNG_IHDR_SIZE = 13;
36constexpr int PNG_TYPE_SIZE = 4;
37constexpr int PNG_SIZE_SIZE = 4;
38constexpr int PNG_CRC_SIZE = 4;
39constexpr int PNG_IEND_SIZE = 0;
40
42{
43class XStatusIndicator;
44}
45
46class Graphic;
47class BitmapEx;
48class SvStream;
49
50namespace vcl
51{
53{
55 css::uno::Reference<css::task::XStatusIndicator> mxStatusIndicator;
56
57public:
58 PngImageReader(SvStream& rStream);
59
60 // Returns true if image was successfully read without errors.
61 // A usable bitmap may be returned even if there were errors (e.g. incomplete image).
62 bool read(BitmapEx& rBitmap);
63 bool read(Graphic& rGraphic);
64 // Returns a bitmap without indicating if there were errors.
65 BitmapEx read();
66
67 // Returns the contents of the msOG chunk (containing a Gif image), if it exists.
68 // Does not change position in the stream.
69 static BinaryDataContainer getMicrosoftGifChunk(SvStream& rStream);
70
71 static bool isAPng(SvStream& rStream);
72};
73
74} // namespace vcl
75
76#endif
77
78/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_uInt32 PNG_FDAT_SIGNATURE
constexpr int PNG_SIZE_SIZE
constexpr sal_uInt32 PNG_FCTL_SIGNATURE
constexpr int PNG_TYPE_SIZE
constexpr sal_uInt32 PNG_TRNS_SIGNATURE
constexpr sal_uInt32 PNG_IHDR_SIGNATURE
constexpr sal_uInt32 PNG_ACTL_SIGNATURE
constexpr int PNG_IEND_SIZE
constexpr sal_uInt32 PNG_IEND_SIGNATURE
constexpr sal_uInt32 PNG_IEND_CRC
constexpr sal_uInt64 PNG_SIGNATURE
constexpr sal_uInt32 PNG_IDAT_SIGNATURE
constexpr int PNG_SIGNATURE_SIZE
constexpr int PNG_CRC_SIZE
constexpr int PNG_IHDR_SIZE
constexpr sal_uInt32 PNG_PHYS_SIGNATURE
Container for the binary data, whose responsibility is to manage the make it as simple as possible to...
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator
#define VCL_DLLPUBLIC
Definition: dllapi.h:29