DISTRHO Plugin Framework
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ImageBase Class Referenceabstract

#include <ImageBase.hpp>

Inheritance diagram for ImageBase:
CairoImage OpenGLImage VulkanImage

Public Member Functions

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
 
virtual void loadFromMemory (const char *rawData, const Size< uint > &size, ImageFormat format=kImageFormatBGRA) noexcept
 
void draw (const GraphicsContext &context)
 
void drawAt (const GraphicsContext &context, int x, int y)
 
virtual void drawAt (const GraphicsContext &context, const Point< int > &pos)=0
 
ImageBaseoperator= (const ImageBase &image) noexcept
 
bool operator== (const ImageBase &image) const noexcept
 
bool operator!= (const ImageBase &image) const noexcept
 

Protected Member Functions

 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

const char * rawData
 
Size< uint > size
 
ImageFormat format
 

Detailed Description

Base DGL Image class.

This is an Image class that handles raw image data in pixels. It is an abstract class that provides the common methods to build on top. Cairo and OpenGL Image classes are based upon this one.

See also
CairoImage, OpenGLImage

Constructor & Destructor Documentation

◆ ImageBase() [1/4]

ImageBase::ImageBase ( )
protected

Constructor for a null Image.

◆ ImageBase() [2/4]

ImageBase::ImageBase ( const char *  rawData,
uint  width,
uint  height,
ImageFormat  format 
)
protected

Constructor using raw image data.

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

◆ ImageBase() [3/4]

ImageBase::ImageBase ( const char *  rawData,
const Size< uint > &  size,
ImageFormat  format 
)
protected

Constructor using raw image data.

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

◆ ImageBase() [4/4]

ImageBase::ImageBase ( const ImageBase image)
protected

Constructor using another image data.

◆ ~ImageBase()

virtual ImageBase::~ImageBase ( )
virtual

Destructor.

Member Function Documentation

◆ isValid()

bool ImageBase::isValid ( ) const
noexcept

Check if this image is valid.

◆ isInvalid()

bool ImageBase::isInvalid ( ) const
noexcept

Check if this image is not valid.

◆ getWidth()

uint ImageBase::getWidth ( ) const
noexcept

Get width.

◆ getHeight()

uint ImageBase::getHeight ( ) const
noexcept

Get height.

◆ getSize()

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

Get size.

◆ getRawData()

const char* ImageBase::getRawData ( ) const
noexcept

Get the raw image data.

◆ getFormat()

ImageFormat ImageBase::getFormat ( ) const
noexcept

Get the image format.

◆ loadFromMemory() [1/2]

void ImageBase::loadFromMemory ( const char *  rawData,
uint  width,
uint  height,
ImageFormat  format = kImageFormatBGRA 
)
noexcept

Load image data from memory.

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

◆ loadFromMemory() [2/2]

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

Load image data from memory.

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

Reimplemented in VulkanImage, OpenGLImage, and CairoImage.

◆ draw()

void ImageBase::draw ( const GraphicsContext context)

Draw this image at (0, 0) point using the current OpenGL context.

◆ drawAt() [1/2]

void ImageBase::drawAt ( const GraphicsContext context,
int  x,
int  y 
)

Draw this image at (x, y) point using the current OpenGL context.

◆ drawAt() [2/2]

virtual void ImageBase::drawAt ( const GraphicsContext context,
const Point< int > &  pos 
)
pure virtual

Draw this image at position pos using the current OpenGL context.

Implemented in VulkanImage, OpenGLImage, and CairoImage.

◆ operator=()

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

TODO document this.


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