alternative Standard Libary  0.29.8
std::graphic::image< T, BC > Template-Klassenreferenz

#include <image.hpp>

Öffentliche Typen

using color_type = std::math::color< T >
 
using basic_color = BC
 
using self_type = image< T, BC >
 
using size_type = std::math::vector2< int >
 

Öffentliche Methoden

 image ()
 
 image (std::string name, size_type size)
 
 image (std::string name, size_type size, stream *str)
 
 ~image ()
 
void setpixel (size_type pos, color_type col)
 
color_typegetpixel (size_type pos)
 
color_typeget ()
 
color_typeoperator[] (size_type pos)
 

Öffentliche Attribute

std::prop_t< std::stringName
 

Geschützte Methoden

void create (size_type size, color_type color)
 

Ausführliche Beschreibung

template<typename T, std::math::color< T > BC = std::math::colors_base<T>::Navy>
class std::graphic::image< T, BC >

Dokumentation der benutzerdefinierten Datentypen

◆ basic_color

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
using std::graphic::image< T, BC >::basic_color = BC

◆ color_type

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
using std::graphic::image< T, BC >::color_type = std::math::color<T>

◆ self_type

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
using std::graphic::image< T, BC >::self_type = image<T, BC>

◆ size_type

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
using std::graphic::image< T, BC >::size_type = std::math::vector2<int>

Beschreibung der Konstruktoren und Destruktoren

◆ image() [1/3]

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
std::graphic::image< T, BC >::image ( )
inline
56  {
57  create(size_type(32,32), BC);
58  }
std::math::vector2< int > size_type
Definition: image.hpp:52
void create(size_type size, color_type color)
Definition: image.hpp:98

◆ image() [2/3]

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
std::graphic::image< T, BC >::image ( std::string  name,
size_type  size 
)
inline
59  {
60  create(size, BC);
61  Name = name;
62  }
void create(size_type size, color_type color)
Definition: image.hpp:98
std::prop_t< std::string > Name
Definition: image.hpp:54

◆ image() [3/3]

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
std::graphic::image< T, BC >::image ( std::string  name,
size_type  size,
stream str 
)
inline
63  {
64  Name = name;
65  create(size, BC);
66  auto x = std::_min<int>( (m_vecSize.x * m_vecSize.y *4),
67  str->size() );
68  unsigned char colorBlock[4];
69  for (int i = 0; i < x; i++) {
70 
71  if (str->read(colorBlock, 0, 4) == 4)
72  m_imgData[i] = color_type( colorBlock[0],
73  colorBlock[1],
74  colorBlock[2],
75  colorBlock[3]);
76  }
77  }
value_type y
Definition: vector2.hpp:65
void create(size_type size, color_type color)
Definition: image.hpp:98
std::math::color< T > color_type
Definition: image.hpp:49
std::string str(T begin, T end)
Definition: utils.hpp:39
value_type x
Definition: vector2.hpp:64
std::prop_t< std::string > Name
Definition: image.hpp:54

◆ ~image()

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
std::graphic::image< T, BC >::~image ( )
inline
78  {
79  if(m_imgData) { delete m_imgData; }
80  }

Dokumentation der Elementfunktionen

◆ create()

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
void std::graphic::image< T, BC >::create ( size_type  size,
color_type  color 
)
inlineprotected
98  {
99  m_imgData = new color_type[size.x * size.y];
100  #pragma openmp
101  for(int i = 0; i < size.x * size.y; i++) {
102  m_imgData[i] = basic_color;
103  }
104  }
BC basic_color
Definition: image.hpp:50
std::math::color< T > color_type
Definition: image.hpp:49

◆ get()

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
color_type* std::graphic::image< T, BC >::get ( )
inline
91  {
92  return m_imgData;
93  }

◆ getpixel()

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
color_type& std::graphic::image< T, BC >::getpixel ( size_type  pos)
inline
86  {
87  if(pos.x < m_vecSize.x && pos.y < m_vecSize.y ) {
88  return m_imgData[ pos.x + pos.y * m_vecSize.x];
89  }
90  }
value_type y
Definition: vector2.hpp:65
value_type x
Definition: vector2.hpp:64

◆ operator[]()

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
color_type& std::graphic::image< T, BC >::operator[] ( size_type  pos)
inline
94  {
95  return getpixel(pos);
96  }
color_type & getpixel(size_type pos)
Definition: image.hpp:86

◆ setpixel()

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
void std::graphic::image< T, BC >::setpixel ( size_type  pos,
color_type  col 
)
inline
81  {
82  if(pos.x < m_vecSize.x && pos.y < m_vecSize.y ) {
83  m_imgData[ pos.x + pos.y * m_vecSize.x] = col;
84  }
85  }
value_type y
Definition: vector2.hpp:65
value_type x
Definition: vector2.hpp:64

Dokumentation der Datenelemente

◆ Name

template<typename T , std::math::color< T > BC = std::math::colors_base<T>::Navy>
std::prop_t<std::string> std::graphic::image< T, BC >::Name

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: