Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
Public Member Functions | Private Attributes | List of all members
blowbox::Image Class Reference

#include <image.h>

Public Member Functions

 Image (const String &image_file_path)
 
 ~Image ()
 
unsigned char *const GetPixelData () const
 
const ResolutionGetResolution () const
 
const PixelCompositionGetPixelComposition () const
 

Private Attributes

String image_file_path_
 
Resolution resolution_
 
unsigned char * pixel_data_
 
PixelComposition pixel_composition_
 

Detailed Description

Load and access image files with the use of blowbox::Image.

blowbox::Image lets you easily load images that are stored on disk based on a file path that you provide. Supplied file paths are relative to the application's current working directory. The class provides accessor functions for the underlying pixel data. All data is stored on the CPU, no GPU is involved in the Image class whatsoever. Under the hood, stb_image is used to load the images into RAM.

Constructor & Destructor Documentation

blowbox::Image::Image ( const String image_file_path)

Constructs an Image object by loading it from disk.

Parameters
[in]image_file_pathThe file path to the image you want to be loaded.
blowbox::Image::~Image ( )

Destructs the Image object.

This destroys the entire Image object and cleans up all data inside of it. Make sure nobody depends on this Image anymore.

Member Function Documentation

const PixelComposition & blowbox::Image::GetPixelComposition ( ) const

Returns the pixel composition of the image. Every pixel is composed of a number of channels. This function helps find out what that is.

Returns
The composition of a single pixel. Refer to blowbox::PixelComposition for more information.
unsigned char *const blowbox::Image::GetPixelData ( ) const

Returns the pixel data that is contained within the image. If you want to know how the pixels are composed, use Image::GetPixelComposition().

Returns
This returns an unsigned char* which acts as an array of pixels which is the size of the image width * image height * components_per_pixel. Do not delete this pointer, it is owned by the Image instance.
Remarks
For an explanation on how to read the data in this pointer, refer to blowbox::PixelComposition.
const Resolution & blowbox::Image::GetResolution ( ) const

Returns the resolution of the image.

Returns
The resolution of the image.

Member Data Documentation

String blowbox::Image::image_file_path_
private

The file path that links to the image that was used to load this image from disk.

PixelComposition blowbox::Image::pixel_composition_
private

The per pixel composition of the pixel data. Refer to blowbox::PixelComposition.

unsigned char* blowbox::Image::pixel_data_
private

The actual pixel data of the image. This pointer is owned, generated and destroyed by stb_image. We are only allowed to read from it.

Resolution blowbox::Image::resolution_
private

The resolution of the image is stored here.


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