13#ifndef _CS237_IMAGE_HPP_
14#define _CS237_IMAGE_HPP_
17#error "cs237-image.hpp should not be included directly"
125 size_t width ()
const {
return this->_wid; }
152 Image2D (std::string
const &file,
bool flip =
true);
158 Image2D (std::ifstream &inS,
bool flip =
true);
174 bool write (
const char *file,
bool flip =
true);
184 bool write (std::ofstream &outS,
bool flip =
true);
Definition cs237-image.hpp:58
ImageBase(uint32_t nd)
Definition cs237-image.hpp:99
ImageBase(uint32_t nd, Channels chans, ChannelTy ty, size_t nPixels)
ImageBase()
Definition cs237-image.hpp:95
Channels channels() const
return the format of the pixels.
Definition cs237-image.hpp:63
size_t nBytes() const
the total number of bytes of image data
Definition cs237-image.hpp:71
ChannelTy _type
the representation type of the data
Definition cs237-image.hpp:90
void * _data
the raw image data
Definition cs237-image.hpp:93
bool _sRGB
should the image be interpreted as an sRGB encoded image?
Definition cs237-image.hpp:91
size_t nBytesPerPixel() const
the number of bytes per pixel
ChannelTy type() const
returns the type of the channels
Definition cs237-image.hpp:65
vk::Format format() const
return the vulkan format of the image data
Definition cs237-image.hpp:67
Channels _chans
the texture format
Definition cs237-image.hpp:89
size_t _nBytes
size in bytes of image data
Definition cs237-image.hpp:92
unsigned int nChannels() const
the number of channels (1, 2, 3, or 4)
void * data() const
the data pointer
Definition cs237-image.hpp:69
uint32_t _nDims
the number of dimensions (1 or 2)
Definition cs237-image.hpp:88
uint32_t nDims() const
the number of dimensions (1, 2, or 3)
Definition cs237-image.hpp:61
A 2D Image used to store 2D data, such as a normal map.
Definition cs237-image.hpp:201
DataImage2D(std::ifstream &inS, bool flip=true)
Definition cs237-image.hpp:228
DataImage2D(std::string const &file, bool flip=true)
Definition cs237-image.hpp:218
DataImage2D(uint32_t wid, uint32_t ht, Channels chans, ChannelTy ty)
Definition cs237-image.hpp:208
Definition cs237-image.hpp:112
Image1D(std::string const &file)
Image1D(uint32_t wid, Channels chans, ChannelTy ty)
bool write(const char *file)
size_t width() const
return the width of the image
Definition cs237-image.hpp:125
Definition cs237-image.hpp:139
uint32_t _ht
the height of the image in pixels
Definition cs237-image.hpp:197
bool write(const char *file, bool flip=true)
void bitblt(Image2D const &src, uint32_t row, uint32_t col)
size_t height() const
return the height of the image
Definition cs237-image.hpp:164
Image2D(std::ifstream &inS, bool flip=true)
bool write(std::ofstream &outS, bool flip=true)
uint32_t _wid
the width of the image in pixels
Definition cs237-image.hpp:196
size_t width() const
return the width of the image
Definition cs237-image.hpp:161
Image2D(std::string const &file, bool flip=true)
Image2D(uint32_t wid, uint32_t ht, Channels chans, ChannelTy ty)
vk::Format toVkFormat(Channels chans, ChannelTy ty, bool sRGB)
convert an image format and channel type to a Vulkan image format
Definition cs237-aabb.hpp:22
ChannelTy
the type used to represent the channels
Definition cs237-image.hpp:39
Channels
the channels of an image
Definition cs237-image.hpp:25
@ BGR
three-channel image in blue-green-red order
@ BGRA
four-channel image in blue-green-red-alpha order
@ RGB
three-channel image in red-green-blue order
@ RGBA
four-channel image in red-green-n-blue-alpha order
std::string to_string(Channels ch)
convert a Channels value to a printable string
Axis-Aligned Bounding Box parameterized over the scalar type.
Definition cs237-aabb.hpp:28