zenilib: Zeni::Image Class Reference

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
Zeni::Image Class Reference
Zenilib

Image. More...

`#include <Image.h>`

## Public Types

enum | Color_Space { Luminance, Luminance_Alpha, RGB, RGBA }

## Public Member Functions

| Image ()
| Image (const String &filename, const bool &tileable_=false)
| Image (const Point2i &size_, const Color_Space &color_space_, const bool &tileable_=false)
bool | blit (const Point2i &upper_left, const Image &source)
| Copy a different Image in the same color-space into this Image. Returns true if blits successfully, false otherwise. More...
Color_Space | color_space () const
| Determine the Color_Space of the raw image data. More...
Color | extract_Color (const Point2i &pixel) const
| Get the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right. More...
Color | extract_Color (const Point2f &coordinate) const
| Get the Color value of a given coordinate, [0.0f, 0.0f] to (1.0f, 1.0f), with wrapping if (tileable == true). More...
Uint32 | extract_RGBA (const Point2i &pixel) const
| Get the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right. More...
const Uint8 * | get_data () const
| Get access to the raw image data. More...
Uint8 * | get_data ()
| Get access to the raw image data. More...
int | height () const
| Get the number of pixels in the image in the y-direction. More...
void | resize (const int &width, const int &height)
void | set_Color (const Point2i &pixel, const Color &color)
| Set the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right. More...
void | set_RGBA (const Point2i &pixel, const Uint32 &rgba)
| Set the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right. More...
const Point2i & | size () const
| Get the dimensions of the image. More...
bool | tileable () const
| Determine if the given Image is tileable. More...
int | width () const
| Get the number of pixels in the image in the x-direction. More...

## Detailed Description

Image.

This class describes a image, loaded from a file.

Author
  bazald

Contact: bazal.nosp@m.d@ze.nosp@m.nipex.nosp@m..com

Definition at line 52 of file Image.h.

## Member Enumeration Documentation

enum Zeni::Image::Color_Space

Enumerator
Luminance |
Luminance_Alpha |
RGB |
RGBA |

Definition at line 54 of file Image.h.

## Constructor & Destructor Documentation

Zeni::Image::Image | ( |  | ) |

Definition at line 33 of file Image.cpp.

Zeni::Image::Image | ( | const String & | filename,
|  | const bool & | tileable_ = `false`
| ) |  |

Definition at line 42 of file Image.cpp.

References file, Zeni::File_Ops::get_asset_FILE(), header(), int, j, Luminance, Luminance_Alpha, NULL, PNG_COLOR_TYPE_GRAY, PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_RGB, PNG_COLOR_TYPE_RGB_ALPHA, png_destroy_read_struct(), png_get_IHDR(), png_get_rowbytes(), png_init_io(), png_jmpbuf, PNG_LIBPNG_VER_STRING, png_read_image(), png_read_info(), png_read_update_info(), png_set_sig_bytes(), png_sig_cmp(), RGB, RGBA, u, Zeni::Point2i::x, Zeni::Point2i::y, and ZENI_LOGE().

Zeni::Image::Image | ( | const Point2i & | size_,
|  | const Color_Space & | color_space_,
|  | const bool & | tileable_ = `false`
| ) |  |

Definition at line 180 of file Image.cpp.

## Member Function Documentation

bool Zeni::Image::blit | ( | const Point2i & | upper_left,
|  | const Image & | source
| ) |  |

Copy a different Image in the same color-space into this Image. Returns true if blits successfully, false otherwise.

Definition at line 352 of file Image.cpp.

References assert, max, memcpy, min, Zeni::Point2i::x, and Zeni::Point2i::y.

Image::Color_Space Zeni::Image::color_space | ( |  | ) | const

inline

Determine the Color_Space of the raw image data.

Definition at line 25 of file Image.hxx.

Referenced by Zeni::Window::alert_window_resized().

Color Zeni::Image::extract_Color | ( | const Point2i & | pixel | ) | const

Get the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right.

Definition at line 219 of file Image.cpp.

References assert, Luminance, Luminance_Alpha, RGB, and RGBA.

Referenced by extract_Color(), and resize().

Color Zeni::Image::extract_Color | ( | const Point2f & | coordinate | ) | const

Get the Color value of a given coordinate, [0.0f, 0.0f] to (1.0f, 1.0f), with wrapping if (tileable == true).

Definition at line 276 of file Image.cpp.

References extract_Color(), floor(), Zeni::Color::interpolate_to(), Zeni::Point2i::x, Zeni::Point2f::x, Zeni::Point2i::y, and Zeni::Point2f::y.

Uint32 Zeni::Image::extract_RGBA | ( | const Point2i & | pixel | ) | const

Get the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right.

Definition at line 248 of file Image.cpp.

References assert, Luminance, Luminance_Alpha, RGB, and RGBA.

const Uint8 * Zeni::Image::get_data | ( |  | ) | const

inline

Get access to the raw image data.

Definition at line 29 of file Image.hxx.

Referenced by Zeni::Window::alert_window_resized().

Uint8 * Zeni::Image::get_data | ( |  | ) |

inline

Get access to the raw image data.

Definition at line 33 of file Image.hxx.

int Zeni::Image::height | ( |  | ) | const

inline

Get the number of pixels in the image in the y-direction.

Definition at line 45 of file Image.hxx.

References Zeni::Point2i::y.

Referenced by Zeni::Window::alert_window_resized(), and resize().

void Zeni::Image::resize | ( | const int & | width,
|  | const int & | height
| ) |  |

Definition at line 334 of file Image.cpp.

References extract_Color(), height(), i, j, set_Color(), swap(), and width().

void Zeni::Image::set_Color | ( | const Point2i & | pixel,
|  | const Color & | color
| ) |  |

Set the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right.

Definition at line 191 of file Image.cpp.

References Zeni::Color::get_rgba(), and set_RGBA().

Referenced by resize().

void Zeni::Image::set_RGBA | ( | const Point2i & | pixel,
|  | const Uint32 & | rgba
| ) |  |

Set the Color value of the pixel specified [0, 0] being the upper left, (width, height) being the lower right.

Definition at line 195 of file Image.cpp.

References assert, Luminance, Luminance_Alpha, RGB, and RGBA.

Referenced by set_Color().

const Point2i & Zeni::Image::size | ( |  | ) | const

inline

Get the dimensions of the image.

Definition at line 37 of file Image.hxx.

bool Zeni::Image::tileable | ( |  | ) | const

inline

Determine if the given Image is tileable.

Definition at line 49 of file Image.hxx.

int Zeni::Image::width | ( |  | ) | const

inline

Get the number of pixels in the image in the x-direction.

Definition at line 41 of file Image.hxx.

References Zeni::Point2i::x.

Referenced by Zeni::Window::alert_window_resized(), and resize().

The documentation for this class was generated from the following files:

- zenilib/jni/external/zenilib/zeni_graphics/Zeni/Image.h
- zenilib/jni/external/zenilib/zeni_graphics/Image.cpp
- zenilib/jni/external/zenilib/zeni_graphics/Zeni/Image.hxx