diff --git a/src/Buffer.h b/src/Buffer.h index 5c787b7a7..5b0f5dd8a 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -636,7 +636,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @requires_gl %Buffer data queries are not available in OpenGL ES. * Use @ref Magnum::Buffer::map() "map()" instead. */ - template Containers::Array data(); + template Containers::Array data(); /** * @brief %Buffer subdata @@ -652,7 +652,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @requires_gl %Buffer data queries are not available in OpenGL ES. * Use @ref Magnum::Buffer::map() "map()" instead. */ - template Containers::Array subData(GLintptr offset, GLsizeiptr size); + template Containers::Array subData(GLintptr offset, GLsizeiptr size); #endif /** diff --git a/src/Image.h b/src/Image.h index 9c9881e86..7af8728e0 100644 --- a/src/Image.h +++ b/src/Image.h @@ -101,8 +101,14 @@ template class Image: public AbstractImage { * * @see @ref release() */ - unsigned char* data() { return _data; } - const unsigned char* data() const { return _data; } /**< @overload */ + template T* data() { + return reinterpret_cast(_data); + } + + /** @overload */ + template const T* data() const { + return reinterpret_cast(_data); + } /** * @brief Set image data diff --git a/src/ImageReference.h b/src/ImageReference.h index d2f754e16..02bd8141f 100644 --- a/src/ImageReference.h +++ b/src/ImageReference.h @@ -79,6 +79,11 @@ template class ImageReference: public AbstractImage { /** @brief Pointer to raw data */ constexpr const unsigned char* data() const { return _data; } + /** @overload */ + template const T* data() const { + return reinterpret_cast(_data); + } + /** * @brief Set image data * @param data %Image data diff --git a/src/Trade/ImageData.h b/src/Trade/ImageData.h index 181b768bb..bc2f09dd4 100644 --- a/src/Trade/ImageData.h +++ b/src/Trade/ImageData.h @@ -91,8 +91,14 @@ template class ImageData: public AbstractImage { * * @see @ref release() */ - unsigned char* data() { return _data; } - const unsigned char* data() const { return _data; } /**< @overload */ + template T* data() { + return reinterpret_cast(_data); + } + + /** @overload */ + template const T* data() const { + return reinterpret_cast(_data); + } /** * @brief Release data storage