FotoSHOCK
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Pages
src
core
IO
codecs
pngCodec.hpp
1
/*
2
* Copyright 2011, 2012 Lukas Jirkovsky
3
*
4
* This file is part of FotoSHOCKcore.
5
*
6
* FotoSHOCKcore is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, version 3 of the License.
9
*
10
* FotoSHOCKcore is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with FotoSHOCKcore. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef PNGCODEC_H
20
#define PNGCODEC_H
21
22
#include "../Codec.hpp"
23
24
#include <png.h>
25
26
namespace
FotoSHOCKcore {
27
namespace
IO {
28
29
class
PngDecoder
:
public
Decoder
{
30
public
:
31
PngDecoder
(
const
std::string fileName);
32
virtual
~
PngDecoder
();
33
static
bool
canDecode(
const
std::string fileName);
34
virtual
ImageBufferBase
*
loadImage
(
unsigned
int
tileExtent);
35
virtual
ImageBufferBase
*
loadImage
(
unsigned
int
tileExtent,
PixelData
format);
36
private
:
37
template
<
typename
ValueType::Enum PixelFormat>
38
ImageBufferBase
*
loadImage
(png_bytepp rowPointers,
unsigned
int
width,
unsigned
int
height,
39
unsigned
int
tileExtent,
PixelData
loadData,
PixelData
pixelData);
40
41
png_structp readStruct;
42
png_infop pngInfo;
43
PixelData
loadData;
44
};
45
46
class
PngEncoder
:
public
Encoder
{
47
public
:
48
PngEncoder
(
const
std::string fileName);
49
virtual
~
PngEncoder
();
50
static
Formats::Enum
format();
51
virtual
void
saveImage
(
ImageBufferBase
* image,
int
quality);
52
private
:
53
template
<
typename
ValueType::Enum PixelFormat>
54
void
saveImage
(
ImageBufferBase
* image, png_bytepp rows);
55
};
56
57
}
58
}
59
60
#endif
Generated on Sat Jun 29 2013 14:25:18 for FotoSHOCK by
1.8.4