1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PNGHELPER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PNGHELPER_HXX
23 #include "sal/types.h"
24 #include "pdfioutdev_gpl.hxx"
31 static sal_uInt32 crc_table
[ 256 ];
32 static bool bCRCTableInit
;
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
);
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
)
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
);
47 static void appendIHDR( OutputBuffer
& o_rOutputBuf
, int width
, int height
, int depth
, int colortype
);
48 static void appendIEND( OutputBuffer
& o_rOutputBuf
);
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
);
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
);
58 static void createPng( OutputBuffer
& o_rOutputBuf
,
66 static void createPng( OutputBuffer
& o_rOutputBuf
,
68 int width
, int height
, GfxImageColorMap
* colorMap
,
70 int maskWidth
, int maskHeight
, GfxImageColorMap
* maskColorMap
);
73 static void createPng( OutputBuffer
& o_rOutputBuf
,
75 int width
, int height
, GfxImageColorMap
* colorMap
,
77 int maskWidth
, int maskHeight
, bool maskInvert
);
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */