CMSC23700 Common Code Library
Support code for CS23700 programming projects
Loading...
Searching...
No Matches
cs237::Image1D Class Reference

#include <cs237-image.hpp>

Inheritance diagram for cs237::Image1D:
Collaboration diagram for cs237::Image1D:

Public Member Functions

 Image1D (uint32_t wid, Channels chans, ChannelTy ty)
 
 Image1D (std::string const &file)
 
size_t width () const
 return the width of the image
 
bool write (const char *file)
 
- Public Member Functions inherited from cs237::__detail::ImageBase
uint32_t nDims () const
 the number of dimensions (1, 2, or 3)
 
Channels channels () const
 return the format of the pixels.
 
ChannelTy type () const
 returns the type of the channels
 
vk::Format format () const
 return the vulkan format of the image data
 
voiddata () const
 the data pointer
 
size_t nBytes () const
 the total number of bytes of image data
 
unsigned int nChannels () const
 the number of channels (1, 2, 3, or 4)
 
size_t nBytesPerPixel () const
 the number of bytes per pixel
 
void addAlphaChannel ()
 

Additional Inherited Members

- Protected Member Functions inherited from cs237::__detail::ImageBase
 ImageBase ()
 
 ImageBase (uint32_t nd)
 
 ImageBase (uint32_t nd, Channels chans, ChannelTy ty, size_t nPixels)
 
virtual ~ImageBase ()
 
- Protected Attributes inherited from cs237::__detail::ImageBase
uint32_t _nDims
 the number of dimensions (1 or 2)
 
Channels _chans
 the texture format
 
ChannelTy _type
 the representation type of the data
 
bool _sRGB
 should the image be interpreted as an sRGB encoded image?
 
size_t _nBytes
 size in bytes of image data
 
void_data
 the raw image data
 

Constructor & Destructor Documentation

◆ Image1D() [1/2]

cs237::Image1D::Image1D ( uint32_t  wid,
Channels  chans,
ChannelTy  ty 
)

create and allocate space for an uninitialized image

Parameters
widthe width of the image
chansthe image format
tythe type of the elements

◆ Image1D() [2/2]

cs237::Image1D::Image1D ( std::string const &  file)

create and initialize an image from a PNG file.

Parameters
filethe name of the PNG file

Member Function Documentation

◆ width()

size_t cs237::Image1D::width ( ) const
inline

return the width of the image

◆ write()

bool cs237::Image1D::write ( const char *  file)

write the texture to a file in PNG format

Parameters
filethe name of the PNG file
Returns
true if successful, false otherwise

The documentation for this class was generated from the following file: