FotoSHOCK
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Pages
src
core
IO
codecs
jpgCodec.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 JPGCODEC_H
20
#define JPGCODEC_H
21
22
#include "../Codec.hpp"
23
24
#include <jpeglib.h>
25
26
namespace
FotoSHOCKcore {
27
namespace
IO {
28
29
class
JpgDecoder
:
public
Decoder
{
30
public
:
31
JpgDecoder
(
const
std::string fileName);
32
virtual
~
JpgDecoder
();
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
(j_decompress_ptr cinfo,
unsigned
int
tileExtent,
PixelData
loadData,
PixelData
pixelData);
39
};
40
41
class
JpgEncoder
:
public
Encoder
{
42
public
:
43
JpgEncoder
(
const
std::string fileName);
44
virtual
~
JpgEncoder
();
45
static
Formats::Enum
format();
46
virtual
void
saveImage
(
ImageBufferBase
* image,
int
quality);
47
private
:
48
template
<
typename
ValueType::Enum PixelFormat>
49
void
saveImage
(
ImageBufferBase
* image, j_compress_ptr cinfo);
50
};
51
52
}
53
}
54
55
#endif
Generated on Sat Jun 29 2013 14:25:18 for FotoSHOCK by
1.8.4