1 /*
2  *  Copyright (c) 2010 Dmitry Kazakov <dimula73@gmail.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __KIS_LEGACY_TILE_COMPRESSOR_H
20 #define __KIS_LEGACY_TILE_COMPRESSOR_H
21 
22 #include "kis_abstract_tile_compressor.h"
23 
24 
25 class KRITAIMAGE_EXPORT KisLegacyTileCompressor : public KisAbstractTileCompressor
26 {
27 public:
28     KisLegacyTileCompressor();
29     ~KisLegacyTileCompressor() override;
30 
31     bool writeTile(KisTileSP tile, KisPaintDeviceWriter &store) override;
32     bool readTile(QIODevice *stream, KisTiledDataManager *dm) override;
33 
34 
35     void compressTileData(KisTileData *tileData,quint8 *buffer,
36                           qint32 bufferSize, qint32 &bytesWritten) override;
37     bool decompressTileData(quint8 *buffer, qint32 bufferSize, KisTileData *tileData) override;
38     qint32 tileDataBufferSize(KisTileData *tileData) override;
39 
40 private:
41     /**
42      * Quite self describing
43      */
44     qint32 maxHeaderLength();
45 
46     /**
47      * Writes header into the buffer. Buffer size
48      * should be maxHeaderLength() + 1 bytes at least
49      * (to fit terminating '\0')
50      */
51     bool writeHeader(KisTileSP tile, quint8 *buffer);
52 };
53 
54 #endif /* __KIS_LEGACY_TILE_COMPRESSOR_H */
55 
56