PrevUpHomeNext

Image generators and loaders

Image specification
Image

#include <oglplus/images/image_spec.hpp>

The ImageSpec class is used to specify various parameters of a texture image, like its width, height, depth, pixel data type, format and internal format and a pointer to and size of a block of memory where the raw image data is stored. It is used mostly as a parameter type for Texture, Renderbuffer and other similar functions.

ImageSpec defines multiple constructors which allow to specify values for various subsets of the parameters listed above and initialize the unspecified parameters with appropriate default values.

namespace images {

struct ImageSpec
{
	typedef OneOf<DataType, PixelDataType> PixDataType;

	ImageSpec(void); 1

	ImageSpec(
		SizeType width,
		SizeType height,
		PixelDataInternalFormat internal_format
	): 2

	ImageSpec(
		SizeType width,
		SizeType height,
		PixelDataFormat format,
		PixDataType type
	); 3

	ImageSpec(
		SizeType width,
		PixelDataFormat format,
		PixelDataInternalFormat internal_format,
		PixDataType type
	); 4

	ImageSpec(
		SizeType width,
		SizeType height,
		PixelDataFormat format,
		PixelDataInternalFormat internal_format,
		PixDataType type
	); 5

	ImageSpec(
		SizeType width,
		SizeType height,
		SizeType depth,
		PixelDataFormat format,
		PixelDataInternalFormat internal_format,
		PixDataType type
	); 6

	template <typename T>
	ImageSpec(
		SizeType width,
		PixelDataFormat format,
		PixelDataInternalFormat internal_format,
		const T* data
	); 7

	template <typename T>
	ImageSpec(
		SizeType width,
		SizeType height,
		PixelDataFormat format,
		const T* data
	); 8

	template <typename T>
	ImageSpec(
		SizeType w,
		SizeType h,
		PixelDataFormat format,
		PixelDataInternalFormat internal_format,
		const T* data
	); 9
};

} // namespace images

1

Nil image specification.

2

Specifies a two dimensional image with a particular internal_format, without any image data. Can be used for example to initialize the storage space of a Renderbuffer.

3

Specifies a two dimensional image with a particular format and data type, without any image data.

4

Specifies a one dimensional image with a particular format, internal_format and pixel data type, without any image data.

5

Specifies a two dimensional image with a particular format, internal_format and pixel data type, without any image data.

6

Specifies a three dimensional image with a particular format, internal_format and pixel data type, without any image data.

7

Specifies a one dimensional image with a particular format, internal_format and a pointer to pixel data. The data type is derived from the type T.

8

Specifies a two dimensional image with a particular format, and matching internal format and a pointer to pixel data. The data type is derived from the type T.

9

Specifies a two dimensional image with a particular format, internal_format and a pointer to pixel data. The data type is derived from the type T.

#include <oglplus/images/image.hpp>

The Image class is used to store bitmap image data and various parameters, like its width, height, depth, pixel data type, format and internal format. It is used mostly as a parameter type for Texture, Renderbuffer and other similar functions.

namespace images {

class Image
{
public:
	Image(const Image& that);

	Image(Image&& tmp)
	noexcept;

	Image& operator = (Image&& tmp)
	noexcept;

	template <typename T>
	Image(
		SizeType width,
		SizeType height,
		SizeType depth,
		SizeType channels,
		const T* data
	);

	template <typename T>
	Image(
		SizeType width,
		SizeType height,
		SizeType depth,
		SizeType channels,
		const T* data,
		PixelDataFormat format,
		PixelDataInternalFormat internal
	);

	GLsizei Dimension(std::size_t i) const
	noexcept; 1

	GLsizei Width(void) const
	noexcept; 2

	GLsizei Height(void) const
	noexcept; 3

	GLsizei Depth(void) const
	noexcept; 4

	GLsizei Channels(void) const
	noexcept; 5

	PixelDataType Type(void) const
	noexcept;

	PixelDataFormat Format(void) const
	noexcept;

	PixelDataInternalFormat InternalFormat(void) const
	noexcept;

	template <typename T>
	const T* Data(void) const
	noexcept;

	const void* RawData(void) const
	noexcept;

	std::size_t DataSize(void) const
	noexcept; 6

//TODO
};

} // namespace images

1

Returns the size of the i-th dimension of the image.

2

Returns the width of the image.

3

Returns the height of the image.

4

Returns the depth of the image.

5

Returns the number of channels.

6

Returns the size of data in bytes.


PrevUpHomeNext