207 inline void display(
const Image<byte>& IR,
const Image<byte>& IG,
const Image<byte>& IB,
IntPoint2 p,
bool xorMode=
false,
double fact=1.) {
display(IR,IG,IB,p.
x(),p.
y(),xorMode,fact); }
217 template <
typename T,
int dim>
231 #ifndef DOXYGEN_SHOULD_SKIP_THIS 234 template <
typename T>
Color rainbowColor(T x, T m, T M) {
237 x=std::min(T(1.),std::max(T(0.),x));
239 return Color(0,byte(255*x/r),255);
242 return Color(0,255,byte(255*(1-x/r)));
245 return Color(byte(255*x/r),255,0);
247 return Color(255,byte(255*(1-x/r)),0);
258 template <
typename T,
int dim>
264 for ( ; it1 != I.
end() ; ++it1, ++it2) {
265 *it2 = rainbowColor(*it1,m,M);
275 template <
typename T,
int dim>
278 std::pair<T,T> r=range(I);
279 return rainbow(I,r.first,r.second);
288 template <
typename T,
int dim>
294 for ( ; it1 != I.
end() ; ++it1, ++it2) {
295 T v=std::min(M,std::max(m,*it1));
296 *it2 = byte((v-m)*255/(M-m));
306 template <
typename T,
int dim>
309 std::pair<T,T> r=range(I);
310 if (r.first==r.second)
311 r.second=r.second+T(1);
312 return grey(I,r.first,r.second);
321 template <
typename T,
int dim>
327 for ( ; it1 != I.
end() ; ++it1, ++it2) {
328 RGB<T> v=pmin(M,pmax(m,*it1));
329 *it2 =
Color(div((v-m)*255,(M-m)));
339 template <
typename T,
int dim>
342 std::pair<RGB<T>,
RGB<T> > r=prange(I);
343 return color(I,r.first,r.second);
bool saveColorImage(const std::string &name, const Color *cols, int w, int h, int quality=85)
Save color image.
Base::const_iterator const_iterator
Const iterator type.
Definition: Image.h:36
iterator begin()
Begin iterator.
Definition: FArray.h:202
bool loadColorImage(const std::string &name, Color *&cols, int &w, int &h)
Load color image.
RGB< byte > Color
RGB<byte> alias.
Definition: Color.h:281
void display(const Image< byte > &I, int x=0, int y=0, bool xorMode=false, double fact=1.)
Display grey image.
Definition: IO.h:161
void createMaskFromColor(Image< AlphaColor > &I, AlphaColor col)
Create a transparency mask from a specified color-key.
Definition: IO.h:22
Iterator on Coordinates.
Definition: Coords.h:83
bool loadGreyImage(const std::string &name, byte *&g, int &w, int &h)
Load grey image.
bool saveAlphaColorImage(const std::string &name, Imagine::AlphaColor *cols, int w, int h, int quality=85)
Save color image with alpha channel.
const T & x() const
Read alias.
Definition: FVector.h:104
void putAlphaColorImage(int x, int y, Imagine::AlphaColor *cols, int w, int h, bool xorMode=false, double fact=1.)
Display color bitmap with alpha channel.
RED GREEN BLUE Alpha color.
Definition: Color.h:138
Image< Color, dim > rainbow(const Image< T, dim > &I, T m, T M)
Rainbow representation.
Definition: IO.h:259
int size(int i) const
ith size.
Definition: MultiArray.h:225
Coords< dim > sizes() const
Sizes.
Definition: MultiArray.h:211
void setMaskFromColor(byte *&r, byte *&g, byte *&b, byte *&a, int w, int h, const Color &col)
Create a transparency mask from a specified color-key.
bool save(const Image< byte > &I, std::string name)
Save grey image.
Definition: IO.h:53
Image.
Definition: Image.h:24
void putColorImage(int x, int y, const Color *cols, int w, int h, bool xorMode=false, double fact=1.)
Display color bitmap.
T * data()
Data pointer (read/write).
Definition: Array.h:217
Image< byte, dim > grey(const Image< T, dim > &I, T m, T M)
Grey level representation.
Definition: IO.h:289
bool saveGreyImage(const std::string &name, const byte *g, int w, int h, int quality=85)
Save grey image.
void putGreyImage(int x, int y, const byte *g, int w, int h, bool xorMode=false, double fact=1.)
Display grey bitmap.
bool loadAlphaColorImage(const std::string &name, AlphaColor *&acols, int &w, int &h)
Load color image with alpha channel.
int height() const
Size alias 1.
Definition: MultiArray.h:239
bool load(Image< byte > &I, std::string name)
Load grey image.
Definition: IO.h:37
Image< T > cut2D(const Image< T, dim > &I, const Coords< dim > &cut, int d1, int d2)
2D cut.
Definition: IO.h:218
const T & y() const
Read alias.
Definition: FVector.h:118
iterator begin()
Begin iterator.
Definition: Array.h:231
Imagine++ namespace.
Definition: Array.h:7
Image< Color, dim > color(const Image< RGB< T >, dim > &I, const RGB< T > &m, const RGB< T > &M)
Color representation.
Definition: IO.h:322
RED GREEN BLUE color.
Definition: Color.h:26
iterator end()
End iterator.
Definition: Array.h:245
int width() const
Size alias 0.
Definition: MultiArray.h:232