DISTRHO Plugin Framework
Public Member Functions | List of all members
OpenGLImage Class Reference

#include <OpenGL.hpp>

Inheritance diagram for OpenGLImage:
ImageBase

Public Member Functions

 OpenGLImage ()
 
 OpenGLImage (const char *rawData, uint width, uint height, ImageFormat format=kImageFormatBGRA)
 
 OpenGLImage (const char *rawData, const Size< uint > &size, ImageFormat format=kImageFormatBGRA)
 
 OpenGLImage (const OpenGLImage &image)
 
 ~OpenGLImage () override
 
void loadFromMemory (const char *rawData, const Size< uint > &size, ImageFormat format=kImageFormatBGRA) noexcept override
 
void drawAt (const GraphicsContext &context, const Point< int > &pos) override
 
OpenGLImageoperator= (const OpenGLImage &image) noexcept
 
void loadFromMemory (const char *rdata, uint w, uint h, ImageFormat fmt=kImageFormatBGRA)
 
void draw (const GraphicsContext &context)
 
void drawAt (const GraphicsContext &context, int x, int y)
 
 OpenGLImage (const char *rawData, uint width, uint height, GLenum glFormat)
 
 OpenGLImage (const char *rawData, const Size< uint > &size, GLenum glFormat)
 
void draw ()
 
void drawAt (int x, int y)
 
void drawAt (const Point< int > &pos)
 
DISTRHO_DEPRECATED GLenum getType () const noexcept
 
- Public Member Functions inherited from ImageBase
virtual ~ImageBase ()
 
bool isValid () const noexcept
 
bool isInvalid () const noexcept
 
uint getWidth () const noexcept
 
uint getHeight () const noexcept
 
const Size< uint > & getSize () const noexcept
 
const char * getRawData () const noexcept
 
ImageFormat getFormat () const noexcept
 
void loadFromMemory (const char *rawData, uint width, uint height, ImageFormat format=kImageFormatBGRA) noexcept
 
void draw (const GraphicsContext &context)
 
void drawAt (const GraphicsContext &context, int x, int y)
 
ImageBaseoperator= (const ImageBase &image) noexcept
 
bool operator== (const ImageBase &image) const noexcept
 
bool operator!= (const ImageBase &image) const noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from ImageBase
 ImageBase ()
 
 ImageBase (const char *rawData, uint width, uint height, ImageFormat format)
 
 ImageBase (const char *rawData, const Size< uint > &size, ImageFormat format)
 
 ImageBase (const ImageBase &image)
 
- Protected Attributes inherited from ImageBase
const char * rawData
 
Size< uint > size
 
ImageFormat format
 

Detailed Description

OpenGL 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

◆ OpenGLImage() [1/6]

OpenGLImage::OpenGLImage ( )

Constructor for a null Image.

◆ OpenGLImage() [2/6]

OpenGLImage::OpenGLImage ( const char *  rawData,
uint  width,
uint  height,
ImageFormat  format = kImageFormatBGRA 
)

Constructor using raw image data.

Note
rawData must remain valid for the lifetime of this Image.

◆ OpenGLImage() [3/6]

OpenGLImage::OpenGLImage ( const char *  rawData,
const Size< uint > &  size,
ImageFormat  format = kImageFormatBGRA 
)

Constructor using raw image data.

Note
rawData must remain valid for the lifetime of this Image.

◆ OpenGLImage() [4/6]

OpenGLImage::OpenGLImage ( const OpenGLImage image)

Constructor using another image data.

◆ ~OpenGLImage()

OpenGLImage::~OpenGLImage ( )
override

Destructor.

◆ OpenGLImage() [5/6]

OpenGLImage::OpenGLImage ( const char *  rawData,
uint  width,
uint  height,
GLenum  glFormat 
)
explicit

Constructor using raw image data, specifying an OpenGL image format.

Note
rawData must remain valid for the lifetime of this Image. DEPRECATED This constructor uses OpenGL image format instead of DISTRHO one.

◆ OpenGLImage() [6/6]

OpenGLImage::OpenGLImage ( const char *  rawData,
const Size< uint > &  size,
GLenum  glFormat 
)
explicit

Constructor using raw image data, specifying an OpenGL image format.

Note
rawData must remain valid for the lifetime of this Image. DEPRECATED This constructor uses OpenGL image format instead of DISTRHO one.

Member Function Documentation

◆ loadFromMemory()

void OpenGLImage::loadFromMemory ( const char *  rawData,
const Size< uint > &  size,
ImageFormat  format = kImageFormatBGRA 
)
overridevirtualnoexcept

Load image data from memory.

Note
rawData must remain valid for the lifetime of this Image.

Reimplemented from ImageBase.

◆ drawAt() [1/3]

void OpenGLImage::drawAt ( const GraphicsContext context,
const Point< int > &  pos 
)
overridevirtual

Draw this image at position pos using the graphics context context.

Implements ImageBase.

◆ operator=()

OpenGLImage& OpenGLImage::operator= ( const OpenGLImage image)
noexcept

TODO document this.

◆ draw()

void OpenGLImage::draw ( )

Draw this image at (0, 0) point using the current OpenGL context. DEPRECATED This function does not take into consideration the current graphics context and only works in OpenGL.

◆ drawAt() [2/3]

void OpenGLImage::drawAt ( int  x,
int  y 
)

Draw this image at (x, y) point using the current OpenGL context. DEPRECATED This function does not take into consideration the current graphics context and only works in OpenGL.

◆ drawAt() [3/3]

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

Draw this image at position pos using the current OpenGL context. DEPRECATED This function does not take into consideration the current graphics context and only works in OpenGL.

◆ getType()

DISTRHO_DEPRECATED GLenum OpenGLImage::getType ( ) const
inlinenoexcept

Get the image type. DEPRECATED Type is always assumed to be GL_UNSIGNED_BYTE.


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