Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
vl::ImagePBO Class Reference

Represents a vl::Image with an associated Pixel Buffer Object. More...

#include <ImagePBO.hpp>

+ Inheritance diagram for vl::ImagePBO:

Public Member Functions

 ImagePBO ()
 Constructor. More...
 
 ImagePBO (const String &path)
 Constructors: loads an image from the specified path. More...
 
 ImagePBO (int x, int y, int z, int bytealign, EImageFormat format, EImageType type)
 Constructor: initializes an image with the specified parameters. More...
 
const BufferObjectpixelBufferObject () const
 The associated OpenGL Buffer Object. More...
 
BufferObjectpixelBufferObject ()
 The associated OpenGL Buffer Object. More...
 
void setPixelBufferObject (BufferObject *pbo)
 The associated OpenGL Buffer Object. More...
 
- Public Member Functions inherited from vl::Image
virtual ~Image ()
 
 Image ()
 Constructor. More...
 
 Image (void *buffer_ptr, int buffer_bytes)
 Initializes the image to use vl::Buffer::UserAllocatedBuffer mode and the given buffer instead of allocating its own buffer. More...
 
 Image (const String &file_path)
 Initializes the image reading from the give file path. More...
 
 Image (int x, int y, int z, int bytealign, EImageFormat format, EImageType type)
 Initializes a 1D, 2D or 3D image. For 2D images y and z must be set to 0. For 3D images z must be set to 0. More...
 
 Image (const Image &other)
 
Imageoperator= (const Image &other)
 
bool isCubemap () const
 
bool isValid () const
 Returns true if the image has valid width/height/depth, pitch and byte alignment, type/format combination. More...
 
EImageDimension dimension () const
 
void allocate1D (int x, EImageFormat format, EImageType type)
 
void allocate2D (int x, int y, int bytealign, EImageFormat format, EImageType type)
 
void allocate3D (int x, int y, int z, int bytealign, EImageFormat format, EImageType type)
 
void allocateCubemap (int x, int y, int bytealign, EImageFormat format, EImageType type)
 
void reset (int x, int y, int z, int bytealign, EImageFormat format, EImageType type, bool is_cubemap)
 Sets up the image configuration & clears the local storage. More...
 
void reset ()
 Disposes all the pixel data and resets the image settings to its defaults. More...
 
int byteAlignment () const
 Returns the byte-alignment of the row of the image. More...
 
void setByteAlignment (int bytealign)
 Modifies the byte-alignment of the rows of the image, thus changing its pitch. More...
 
int bitsPerPixel () const
 
int requiredMemory () const
 Returns the number of bytes requested to store the image. More...
 
String print () const
 
String printType () const
 
String printFormat () const
 
void setWidth (int x)
 
void setHeight (int y)
 
void setDepth (int z)
 
void setFormat (EImageFormat format)
 
void setType (EImageType type)
 
bool hasAlpha () const
 Whether an image contains relevant alpha information. More...
 
void setHasAlpha (bool has_alpha)
 Whether an image contains relevant alpha information. More...
 
int alphaBits () const
 The number of bits dedicated to the alpha channel. More...
 
bool isNormalMap () const
 Whether an image represents a normal map. More...
 
void setIsNormalMap (bool is_normalmap)
 Whether an image represents a normal map. More...
 
const KeyValuestags () const
 A set of key/value couples that can be used to attach extra information to an image like DICOM information etc. More...
 
KeyValuestags ()
 A set of key/value couples that can be used to attach extra information to an image like DICOM information etc. More...
 
void setTags (KeyValues *tags)
 A set of key/value couples that can be used to attach extra information to an image like DICOM information etc. More...
 
void setImageBuffer (Buffer *buffer)
 The buffer used to store the image pixels. More...
 
BufferimageBuffer ()
 The buffer used to store the image pixels. More...
 
const BufferimageBuffer () const
 The buffer used to store the image pixels. More...
 
const unsigned char * pixels () const
 Raw pointer to pixels. More...
 
unsigned char * pixels ()
 Raw pointer to pixels. More...
 
bool empty ()
 True if image is empty. More...
 
unsigned char * pixelsZSlice (int zth_slice)
 Zth slice of 3D image. More...
 
unsigned char * pixelsXP ()
 X-positive cubemap face. More...
 
unsigned char * pixelsXN ()
 X-negative cubemap face. More...
 
unsigned char * pixelsYP ()
 Y-positive cubemap face. More...
 
unsigned char * pixelsYN ()
 Y-negative cubemap face. More...
 
unsigned char * pixelsZP ()
 Z-positive cubemap face. More...
 
unsigned char * pixelsZN ()
 Z-negative cubemap face. More...
 
const unsigned char * pixelsXP () const
 
const unsigned char * pixelsXN () const
 
const unsigned char * pixelsYP () const
 
const unsigned char * pixelsYN () const
 
const unsigned char * pixelsZP () const
 
const unsigned char * pixelsZN () const
 
void setMipmaps (const std::vector< ref< Image > > &mipmaps)
 
const std::vector< ref< Image > > & mipmaps () const
 
std::vector< ref< Image > > & mipmaps ()
 
int width () const
 
int height () const
 
int depth () const
 
int pitch () const
 
EImageFormat format () const
 
EImageType type () const
 
int isCompressedFormat (EImageFormat fmt)
 
void flipVertically ()
 
ref< ImageconvertType (EImageType new_type) const
 Converts the type() of an image. More...
 
ref< ImageconvertFormat (EImageFormat new_format) const
 Converts the format() of an image. More...
 
bool equalize ()
 Equalizes the image. Returns false if the image format() or type() is not supported. This function supports both 3D images and cubemaps. More...
 
bool contrast (float black, float white)
 Adjusts the contrast of an image. Returns false if the image format() or type() is not supported. This function supports both 3D images and cubemaps. More...
 
bool contrastHounsfieldAuto ()
 Adjusts the contrast of an image using the window-center/window-width method used for CT images. Returns false if the image format() or type() is not supported. This function supports both 3D images and cubemaps. More...
 
bool contrastHounsfield (float center, float width, float intercept, float range)
 Adjusts the contrast of an image using the window-center/window-width method used for CT images. Returns false if the image format() or type() is not supported. This function supports both 3D images and cubemaps. More...
 
fvec4 sampleLinear (double x) const
 Performs a sampling on a 1d image using linear filtering. More...
 
fvec4 sampleLinear (double x, double y) const
 Performs a sampling on a 2d image using bilinear filtering. More...
 
fvec4 sampleLinear (double x, double y, double z) const
 Performs a sampling on a 3d image using trilinear filtering. More...
 
fvec4 sample (int x, int y=0, int z=0) const
 Returns the color associated to the specified pixel. More...
 
ref< ImagesubImage (int xstart, int ystart, int width, int height)
 Creates a new image containing the specified rectangular pixel area taken from the source image. More...
 
void copySubImage (Image *img_src, RectI src, ivec2 dst)
 Copies the rectangular area specified by src of img_src into an Image at position dst. More...
 
void substituteColorRGB_RGBA (unsigned int before, unsigned int after)
 Substitutes the color 'before' with the new color 'after'. More...
 
void substituteColorRGB_RGB (unsigned int before, unsigned int after)
 Substitutes the color 'before' with the new color 'after'. More...
 
void substituteColorGreenKey (unsigned int col0, unsigned int col1)
 
const StringfilePath () const
 The file from which the image was loaded. More...
 
void setFilePath (const String &path)
 The file from which the image was loaded. More...
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

Protected Attributes

ref< BufferObjectmPBO
 
- Protected Attributes inherited from vl::Image
ref< BuffermPixels
 
ref< KeyValuesmTags
 
String mFilePath
 
std::vector< ref< Image > > mMipmaps
 
int mWidth
 
int mHeight
 
int mDepth
 
int mPitch
 
int mByteAlign
 
EImageFormat mFormat
 
EImageType mType
 
bool mIsCubemap
 
bool mIsNormalMap
 
bool mHasAlpha
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Static Public Member Functions inherited from vl::Image
static int bitsPerPixel (EImageType type, EImageFormat format)
 Returns the number of bits used to represents one pixel. More...
 
static int requiredMemory (int x, int y, int z, int bytealign, EImageFormat format, EImageType type, bool is_cubemap)
 
static int requiredMemory1D (int x, EImageFormat format, EImageType type)
 
static int requiredMemory2D (int x, int y, int bytealign, EImageFormat format, EImageType type)
 
static int requiredMemory3D (int x, int y, int z, int bytealign, EImageFormat format, EImageType type)
 
static int requiredMemoryCubemap (int x, int y, int bytealign, EImageFormat format, EImageType type)
 
- Protected Member Functions inherited from vl::Image
void updatePitch ()
 
void allocate ()
 
- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

Represents a vl::Image with an associated Pixel Buffer Object.

Definition at line 44 of file ImagePBO.hpp.

Constructor & Destructor Documentation

◆ ImagePBO() [1/3]

vl::ImagePBO::ImagePBO ( )
inline

Constructor.

Definition at line 50 of file ImagePBO.hpp.

References mPBO.

◆ ImagePBO() [2/3]

vl::ImagePBO::ImagePBO ( const String path)
inline

Constructors: loads an image from the specified path.

Definition at line 57 of file ImagePBO.hpp.

References mPBO.

◆ ImagePBO() [3/3]

vl::ImagePBO::ImagePBO ( int  x,
int  y,
int  z,
int  bytealign,
EImageFormat  format,
EImageType  type 
)
inline

Constructor: initializes an image with the specified parameters.

Definition at line 64 of file ImagePBO.hpp.

References mPBO.

Member Function Documentation

◆ pixelBufferObject() [1/2]

const BufferObject* vl::ImagePBO::pixelBufferObject ( ) const
inline

◆ pixelBufferObject() [2/2]

BufferObject* vl::ImagePBO::pixelBufferObject ( )
inline

The associated OpenGL Buffer Object.

Definition at line 74 of file ImagePBO.hpp.

References mPBO.

◆ setPixelBufferObject()

void vl::ImagePBO::setPixelBufferObject ( BufferObject pbo)
inline

The associated OpenGL Buffer Object.

Definition at line 77 of file ImagePBO.hpp.

References mPBO.

Member Data Documentation

◆ mPBO

ref<BufferObject> vl::ImagePBO::mPBO
protected

Definition at line 80 of file ImagePBO.hpp.

Referenced by ImagePBO(), pixelBufferObject(), and setPixelBufferObject().


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