LibreOffice Module sdext (master) 1
pnghelper.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_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PNGHELPER_HXX
21#define INCLUDED_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PNGHELPER_HXX
22
23#include <sal/types.h>
24#include "pdfioutdev_gpl.hxx"
25
26
27namespace pdfi
28{
30 {
31 static sal_uInt32 crc_table[ 256 ];
32 static bool bCRCTableInit;
33
34 static void initCRCTable();
35 static void appendFileHeader( OutputBuffer& o_rOutputBuf );
36 static size_t startChunk( const char* pChunkName, OutputBuffer& o_rOut );
37 static void endChunk( size_t nStart, OutputBuffer& o_rOut );
38
39 static void set( sal_uInt32 i_nValue, OutputBuffer& o_rOutputBuf, size_t i_nIndex );
40 static void append( sal_uInt32 i_nValue, OutputBuffer& o_rOutputBuf )
41 {
42 size_t nCur = o_rOutputBuf.size();
43 o_rOutputBuf.insert( o_rOutputBuf.end(), 4, Output_t(0) );
44 set( i_nValue, o_rOutputBuf, nCur );
45 }
46
47 static void appendIHDR( OutputBuffer& o_rOutputBuf, int width, int height, int depth, int colortype );
48 static void appendIEND( OutputBuffer& o_rOutputBuf );
49
50 public:
51 static void updateCRC( sal_uInt32& io_rCRC, const sal_uInt8* i_pBuf, size_t i_nLen );
52 static sal_uInt32 getCRC( const sal_uInt8* i_pBuf, size_t i_nLen );
53
54 // deflates the passed buff i_pBuf and appends it to the output vector
55 // returns the number of bytes added to the output
56 static sal_uInt32 deflateBuffer( const Output_t* i_pBuf, size_t i_nLen, OutputBuffer& o_rOut );
57
58 static void createPng( OutputBuffer& o_rOutputBuf,
59 Stream* str,
60 int width,
61 int height,
62 GfxRGB const & zeroColor,
63 GfxRGB const & oneColor,
64 bool bIsMask
65 );
66 static void createPng( OutputBuffer& o_rOutputBuf,
67 Stream* str,
68 int width, int height, GfxImageColorMap* colorMap,
69 Stream* maskStr,
70 int maskWidth, int maskHeight, GfxImageColorMap* maskColorMap );
71
72 // for one bit masks
73 static void createPng( OutputBuffer& o_rOutputBuf,
74 Stream* str,
75 int width, int height, GfxImageColorMap* colorMap,
76 Stream* maskStr,
77 int maskWidth, int maskHeight, bool maskInvert );
78
79 };
80}
81
82#endif
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static void appendFileHeader(OutputBuffer &o_rOutputBuf)
Definition: pnghelper.cxx:118
static void append(sal_uInt32 i_nValue, OutputBuffer &o_rOutputBuf)
Definition: pnghelper.hxx:40
static size_t startChunk(const char *pChunkName, OutputBuffer &o_rOut)
Definition: pnghelper.cxx:125
static void initCRCTable()
Definition: pnghelper.cxx:36
static void createPng(OutputBuffer &o_rOutputBuf, Stream *str, int width, int height, GfxRGB const &zeroColor, GfxRGB const &oneColor, bool bIsMask)
Definition: pnghelper.cxx:178
static bool bCRCTableInit
Definition: pnghelper.hxx:32
static void endChunk(size_t nStart, OutputBuffer &o_rOut)
Definition: pnghelper.cxx:144
static void set(sal_uInt32 i_nValue, OutputBuffer &o_rOutputBuf, size_t i_nIndex)
Definition: pnghelper.cxx:136
static sal_uInt32 getCRC(const sal_uInt8 *i_pBuf, size_t i_nLen)
Definition: pnghelper.cxx:69
static void appendIHDR(OutputBuffer &o_rOutputBuf, int width, int height, int depth, int colortype)
Definition: pnghelper.cxx:159
static sal_uInt32 deflateBuffer(const Output_t *i_pBuf, size_t i_nLen, OutputBuffer &o_rOut)
Definition: pnghelper.cxx:76
static void updateCRC(sal_uInt32 &io_rCRC, const sal_uInt8 *i_pBuf, size_t i_nLen)
Definition: pnghelper.cxx:58
static void appendIEND(OutputBuffer &o_rOutputBuf)
Definition: pnghelper.cxx:172
static sal_uInt32 crc_table[256]
Definition: pnghelper.hxx:31
std::vector< Output_t > OutputBuffer
unsigned char Output_t
unsigned char sal_uInt8