CImage.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "vec2.h"
5 #include "color4.h"
6 
7 
8 namespace ion
9 {
10 
11  class CImage
12  {
13 
14  public:
15 
16  static CImage * Load(std::string const & FileName);
17 
18  CImage(ion::byte * const Data, vec2i const Size, int const Channels);
19  CImage(color4f const & Color, bool const Alpha = false);
20  ~CImage();
21 
22  int GetWidth() const;
23  int GetHeight() const;
24  vec2i GetSize() const;
25  int GetStride() const;
26  int GetChannels() const;
27 
28  color4i GetPixel(int const x, int const y) const;
29  void SetPixel(int const x, int const y, color4i const color);
30 
31  ion::byte const * GetData() const;
32  ion::byte * GetData();
33 
34  bool HasAlpha() const;
35 
36  void Write(std::string const & fileName);
37  void FlipY();
38 
39  void Crop(vec2i const & Position, vec2i const & Size);
40 
41  protected:
42 
45  int Channels;
46 
47  };
48 
49 }
color4i GetPixel(int const x, int const y) const
Definition: CImage.cpp:79
int GetChannels() const
Definition: CImage.cpp:74
int GetWidth() const
Definition: CImage.cpp:54
unsigned char byte
Definition: ionTypes.h:45
int GetHeight() const
Definition: CImage.cpp:59
vec2i Size
Definition: CImage.h:44
void FlipY()
Definition: CImage.cpp:122
~CImage()
Definition: CImage.cpp:49
vec2i GetSize() const
Definition: CImage.cpp:64
void Crop(vec2i const &Position, vec2i const &Size)
Definition: CImage.cpp:138
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
byte * Data
Definition: CImage.h:43
int Channels
Definition: CImage.h:45
ion::byte const * GetData() const
Definition: CImage.cpp:101
static CImage * Load(std::string const &FileName)
Definition: CImage.cpp:12
void SetPixel(int const x, int const y, color4i const color)
Definition: CImage.cpp:93
CImage(ion::byte *const Data, vec2i const Size, int const Channels)
Definition: CImage.cpp:29
Definition: CImage.h:11
void Write(std::string const &fileName)
Definition: CImage.cpp:116
int GetStride() const
Definition: CImage.cpp:69
bool HasAlpha() const
Definition: CImage.cpp:111