|
|
|
|
@ -33,13 +33,13 @@ ImageWrapper, BufferedImage, which stores image data in GPU memory, or for
|
|
|
|
|
example with Trade::ImageData. |
|
|
|
|
@see Image1D, Image2D, Image3D |
|
|
|
|
*/ |
|
|
|
|
template<size_t imageDimensions> class Image: public AbstractImage { |
|
|
|
|
template<size_t dimensions> class Image: public AbstractImage { |
|
|
|
|
public: |
|
|
|
|
const static size_t Dimensions = imageDimensions; /**< @brief Image dimension count */ |
|
|
|
|
const static size_t Dimensions = dimensions; /**< @brief Image dimension count */ |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Constructor |
|
|
|
|
* @param dimensions %Image dimensions |
|
|
|
|
* @param size %Image size |
|
|
|
|
* @param components Color components. Data type is detected |
|
|
|
|
* from passed data array. |
|
|
|
|
* @param data %Image data with proper size |
|
|
|
|
@ -47,11 +47,11 @@ template<size_t imageDimensions> class Image: public AbstractImage {
|
|
|
|
|
* Note that the image data are not copied on construction, but they |
|
|
|
|
* are deleted on class destruction. |
|
|
|
|
*/ |
|
|
|
|
template<class T> inline Image(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, T* data): AbstractImage(components, TypeTraits<T>::imageType()), _dimensions(dimensions), _data(data) {} |
|
|
|
|
template<class T> inline Image(const Math::Vector<Dimensions, GLsizei>& size, Components components, T* data): AbstractImage(components, TypeTraits<T>::imageType()), _size(size), _data(data) {} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Constructor |
|
|
|
|
* @param dimensions %Image dimensions |
|
|
|
|
* @param size %Image size |
|
|
|
|
* @param components Color components |
|
|
|
|
* @param type Data type |
|
|
|
|
* @param data %Image data |
|
|
|
|
@ -59,7 +59,7 @@ template<size_t imageDimensions> class Image: public AbstractImage {
|
|
|
|
|
* Note that the image data are not copied on construction, but they |
|
|
|
|
* are deleted on class destruction. |
|
|
|
|
*/ |
|
|
|
|
inline Image(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, ComponentType type, GLvoid* data): AbstractImage(components, type), _dimensions(dimensions), _data(reinterpret_cast<char*>(data)) {} |
|
|
|
|
inline Image(const Math::Vector<Dimensions, GLsizei>& size, Components components, ComponentType type, GLvoid* data): AbstractImage(components, type), _size(size), _data(reinterpret_cast<char*>(data)) {} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Constructor |
|
|
|
|
@ -74,8 +74,8 @@ template<size_t imageDimensions> class Image: public AbstractImage {
|
|
|
|
|
/** @brief Destructor */ |
|
|
|
|
inline ~Image() { delete[] _data; } |
|
|
|
|
|
|
|
|
|
/** @brief %Image dimensions */ |
|
|
|
|
inline constexpr const Math::Vector<Dimensions, GLsizei>& dimensions() const { return _dimensions; } |
|
|
|
|
/** @brief %Image size */ |
|
|
|
|
inline constexpr const Math::Vector<Dimensions, GLsizei>& size() const { return _size; } |
|
|
|
|
|
|
|
|
|
/** @brief Pointer to raw data */ |
|
|
|
|
inline void* data() { return _data; } |
|
|
|
|
@ -83,7 +83,7 @@ template<size_t imageDimensions> class Image: public AbstractImage {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Set image data |
|
|
|
|
* @param dimensions %Image dimensions |
|
|
|
|
* @param size %Image size |
|
|
|
|
* @param components Color components. Data type is detected |
|
|
|
|
* from passed data array. |
|
|
|
|
* @param data %Image data |
|
|
|
|
@ -91,13 +91,13 @@ template<size_t imageDimensions> class Image: public AbstractImage {
|
|
|
|
|
* Deletes previous data and replaces them with new. Note that the |
|
|
|
|
* data are not copied, but they are deleted on destruction. |
|
|
|
|
*/ |
|
|
|
|
template<class T> inline void setData(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, T* data) { |
|
|
|
|
setData(dimensions, components, TypeTraits<T>::imageType(), data); |
|
|
|
|
template<class T> inline void setData(const Math::Vector<Dimensions, GLsizei>& size, Components components, T* data) { |
|
|
|
|
setData(size, components, TypeTraits<T>::imageType(), data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Set image data |
|
|
|
|
* @param dimensions %Image dimensions |
|
|
|
|
* @param size %Image size |
|
|
|
|
* @param components Color components |
|
|
|
|
* @param type Data type |
|
|
|
|
* @param data %Image data |
|
|
|
|
@ -105,11 +105,11 @@ template<size_t imageDimensions> class Image: public AbstractImage {
|
|
|
|
|
* Deletes previous data and replaces them with new. Note that the |
|
|
|
|
* data are not copied, but they are deleted on destruction. |
|
|
|
|
*/ |
|
|
|
|
void setData(const Math::Vector<Dimensions, GLsizei>& dimensions, Components components, ComponentType type, GLvoid* data); |
|
|
|
|
void setData(const Math::Vector<Dimensions, GLsizei>& size, Components components, ComponentType type, GLvoid* data); |
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
Math::Vector<Dimensions, GLsizei> _dimensions; /**< @brief %Image dimensions */ |
|
|
|
|
char* _data; /**< @brief %Image data */ |
|
|
|
|
Math::Vector<Dimensions, GLsizei> _size; /**< @brief %Image size */ |
|
|
|
|
char* _data; /**< @brief %Image data */ |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
#ifndef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
|