PhoenixPNG
1.2.5
Set of tools to ease use of png file
Toggle main menu visibility
Loading...
Searching...
No Matches
PImagePng_impl.h
Go to the documentation of this file.
1
/***************************************
2
Auteur : Pierre Aubert
3
Mail : pierre.aubert@lapp.in2p3.fr
4
Licence : CeCILL-C
5
****************************************/
6
7
#ifndef __PIMAGEPNG_IMPL_H__
8
#define __PIMAGEPNG_IMPL_H__
9
10
#include <algorithm>
11
#include "
PImagePng.h
"
12
14
19
template
<
typename
T>
20
void
PImagePng::setColor
(
const
T * matValue,
size_t
nbRow,
size_t
nbCol,
const
PColorMap
& colorMap){
21
size_t
nbValueRow(std::min(nbRow, (
size_t
)
p_image
.height));
22
size_t
nbValueCol(std::min(nbCol, (
size_t
)
p_image
.width));
23
24
for
(
size_t
i(0lu); i < nbValueRow; ++i){
25
for
(
size_t
j(0lu); j < nbValueCol; ++j){
26
float
value(matValue[i*nbCol + j]);
27
color_t
red(0), green(0), blue(0), alpha(0);
28
colorMap.
interpolate
(red, green, blue, alpha, value);
29
setColor
(j, i, red, green, blue, alpha);
30
}
31
}
32
33
}
34
35
#endif
36
color_t
unsigned char color_t
Type des of a color.
Definition
PColorMap.h:14
PImagePng.h
PColorMap
Describe a color map to adapt color with input value.
Definition
PColorMap.h:38
PColorMap::interpolate
void interpolate(color_t &red, color_t &green, color_t &blue, float value) const
Interpolate color by respect to the given value.
Definition
PColorMap.cpp:149
PImagePng::setColor
void setColor(size_t idxWidth, size_t idxHeight, color_t red, color_t green, color_t blue)
Set the color of the pixel at (idxWidth, idxHeight).
Definition
PImagePng.cpp:151
PImagePng::p_image
png_image p_image
Png image.
Definition
PImagePng.h:63
src
PImagePng_impl.h
Generated by
1.17.0