DISTRHO Plugin Framework
 All Classes Functions Variables Modules Pages
Public Member Functions | List of all members
Image Class Reference

#include <Image.hpp>

Public Member Functions

 Image ()
 
 Image (const char *const rawData, const uint width, const uint height, const GLenum format=GL_BGRA, const GLenum type=GL_UNSIGNED_BYTE)
 
 Image (const char *const rawData, const Size< uint > &size, const GLenum format=GL_BGRA, const GLenum type=GL_UNSIGNED_BYTE)
 
 Image (const Image &image)
 
 ~Image ()
 
void loadFromMemory (const char *const rawData, const uint width, const uint height, const GLenum format=GL_BGRA, const GLenum type=GL_UNSIGNED_BYTE) noexcept
 
void loadFromMemory (const char *const rawData, const Size< uint > &size, const GLenum format=GL_BGRA, const GLenum type=GL_UNSIGNED_BYTE) noexcept
 
bool isValid () const noexcept
 
uint getWidth () const noexcept
 
uint getHeight () const noexcept
 
const Size< uint > & getSize () const noexcept
 
const char * getRawData () const noexcept
 
GLenum getFormat () const noexcept
 
GLenum getType () const noexcept
 
void draw ()
 
void drawAt (const int x, const int y)
 
void drawAt (const Point< int > &pos)
 
Imageoperator= (const Image &image) noexcept
 
bool operator== (const Image &image) const noexcept
 
bool operator!= (const Image &image) const noexcept
 

Detailed Description

Base DGL Image class.

This is an Image class that handles raw image data in pixels. You can init the image data on the contructor or later on by calling loadFromMemory().

To generate raw data useful for this class see the utils/png2rgba.py script. Be careful when using a PNG without alpha channel, for those the format is 'GL_BGR' instead of the default 'GL_BGRA'.

Images are drawn on screen via 2D textures.

Constructor & Destructor Documentation

Image::Image ( )

Constructor for a null Image.

Image::Image ( const char *const  rawData,
const uint  width,
const uint  height,
const GLenum  format = GL_BGRA,
const GLenum  type = GL_UNSIGNED_BYTE 
)

Constructor using raw image data.

Note
: rawData must remain valid for the lifetime of this Image.
Image::Image ( const char *const  rawData,
const Size< uint > &  size,
const GLenum  format = GL_BGRA,
const GLenum  type = GL_UNSIGNED_BYTE 
)

Constructor using raw image data.

Note
: rawData must remain valid for the lifetime of this Image.
Image::Image ( const Image image)

Constructor using another image data.

Image::~Image ( )

Destructor.

Member Function Documentation

void Image::loadFromMemory ( const char *const  rawData,
const uint  width,
const uint  height,
const GLenum  format = GL_BGRA,
const GLenum  type = GL_UNSIGNED_BYTE 
)
noexcept

Load image data from memory.

Note
: rawData must remain valid for the lifetime of this Image.
void Image::loadFromMemory ( const char *const  rawData,
const Size< uint > &  size,
const GLenum  format = GL_BGRA,
const GLenum  type = GL_UNSIGNED_BYTE 
)
noexcept

Load image data from memory.

Note
: rawData must remain valid for the lifetime of this Image.
bool Image::isValid ( ) const
noexcept

Check if this image is valid.

uint Image::getWidth ( ) const
noexcept

Get width.

uint Image::getHeight ( ) const
noexcept

Get height.

const Size<uint>& Image::getSize ( ) const
noexcept

Get size.

const char* Image::getRawData ( ) const
noexcept

Get the raw image data.

GLenum Image::getFormat ( ) const
noexcept

Get the image format.

GLenum Image::getType ( ) const
noexcept

Get the image type.

void Image::draw ( )

Draw this image at (0, 0) point.

void Image::drawAt ( const int  x,
const int  y 
)

Draw this image at (x, y) point.

void Image::drawAt ( const Point< int > &  pos)

Draw this image at position pos.


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