CImage.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionMath.h>
5 
6 
7 namespace ion
8 {
9 
10  class CImage
11  {
12 
13  public:
14 
15  static CImage * Load(std::string const & FileName);
16 
17  CImage(byte * const Data, vec2u const Size, u8 const Channels);
18  CImage(color4f const & Color, bool const Alpha = false);
19  ~CImage();
20 
21  uint GetWidth() const;
22  uint GetHeight() const;
23  vec2u GetSize() const;
24  uint GetStride() const;
25  uint GetChannels() const;
26 
27  color4i GetPixel(uint const x, uint const y) const;
28  void SetPixel(uint const x, uint const y, color4i const color);
29 
30  u8 const * GetData() const;
31  u8 * GetData();
32 
33  bool HasAlpha() const;
34 
35  void Write(std::string const & fileName);
36  void FlipY();
37 
38  void Crop(vec2i const & Position, vec2i const & Size);
39 
40  protected:
41 
45 
46  };
47 
48 }
unsigned char byte
Definition: ionTypes.h:102
vec2u Size
Definition: CImage.h:43
Definition: SColor.h:8
uint GetChannels() const
Definition: CImage.cpp:75
Uint8 u8
Definition: ionTypes.h:82
unsigned int uint
Definition: ionTypes.h:99
u8 Channels
Definition: CImage.h:44
uint GetWidth() const
Definition: CImage.cpp:55
void FlipY()
Definition: CImage.cpp:120
~CImage()
Definition: CImage.cpp:50
void Crop(vec2i const &Position, vec2i const &Size)
Definition: CImage.cpp:134
Customized variant of vec4 that intelligently handles conversion between floating point and integer c...
Definition: SColor.h:62
uint GetStride() const
Definition: CImage.cpp:70
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
byte * Data
Definition: CImage.h:42
static CImage * Load(std::string const &FileName)
Definition: CImage.cpp:13
uint GetHeight() const
Definition: CImage.cpp:60
vec2u GetSize() const
Definition: CImage.cpp:65
Definition: CImage.h:10
u8 const * GetData() const
Definition: CImage.cpp:99
void Write(std::string const &fileName)
Definition: CImage.cpp:114
void SetPixel(uint const x, uint const y, color4i const color)
Definition: CImage.cpp:91
color4i GetPixel(uint const x, uint const y) const
Definition: CImage.cpp:80
bool HasAlpha() const
Definition: CImage.cpp:109
CImage(byte *const Data, vec2u const Size, u8 const Channels)
Definition: CImage.cpp:30