# vconvert.h File Reference

`#include <ptbuildopts.h>`
`#include <ptlib/videoio.h>`

Go to the source code of this file.

## Classes

class | PColourConverterRegistration
| This class registers a colour conversion class. More...
class | PColourConverter
| This class defines a means to convert an image from one colour format to another. More...
class | PSynonymColour
| Define synonym colour format converter. More...
class | PSynonymColourRegistration
| Define synonym colour format registration. More...

## Defines

#define | PCOLOUR_CONVERTER2(cls, ancestor, srcFmt, dstFmt)
| Declare a colour converter class with Convert() function.
#define | PCOLOUR_CONVERTER(cls, src, dst) PCOLOUR_CONVERTER2(cls,PColourConverter,src,dst)
| Declare a colour converter class with Convert() function.
#define | PSYNONYM_COLOUR_CONVERTER(from, to) static PSynonymColourRegistration p_##from##_##to##_registration_instance(#from,#to)
| Define synonym colour format.

## Define Documentation

#define PCOLOUR_CONVERTER | ( | cls,
|  | src,
|  | dst |  | ) | PCOLOUR_CONVERTER2(cls,PColourConverter,src,dst)

Declare a colour converter class with Convert() function.

This should only be used once and at the global scope level for each converter. It declares everything needs so only the body of the Convert() function need be added.

#define PCOLOUR_CONVERTER2 | ( | cls,
|  | ancestor,
|  | srcFmt,
|  | dstFmt |  | ) |

Value:

    class cls : public ancestor { \
      public: \
      cls(const PVideoFrameInfo & src, const PVideoFrameInfo & dst) \
        : ancestor(src, dst) { } \
      virtual PBoolean Convert(const BYTE *, BYTE *, PINDEX * = NULL); \
      virtual PBoolean Convert(const BYTE *, BYTE *, unsigned int , PINDEX * = NULL); \
    }; \
    static class cls##_Registration : public PColourConverterRegistration { \
      public: cls##_Registration() \
        : PColourConverterRegistration(srcFmt,dstFmt) { } \
      protected: virtual PColourConverter * Create(const PVideoFrameInfo & src, const PVideoFrameInfo & dst) const; \
    } p_##cls##_registration_instance; \
    PColourConverter * cls##_Registration::Create(const PVideoFrameInfo & src, const PVideoFrameInfo & dst) const \
      { return new cls(src, dst); } \
    PBoolean cls::Convert(const BYTE *srcFrameBuffer, BYTE *dstFrameBuffer, unsigned int p_srcFrameBytes, PINDEX * bytesReturned) \
      { srcFrameBytes = p_srcFrameBytes;return Convert(srcFrameBuffer, dstFrameBuffer, bytesReturned); } \
    PBoolean cls::Convert(const BYTE *srcFrameBuffer, BYTE *dstFrameBuffer, PINDEX * bytesReturned)

Declare a colour converter class with Convert() function.

This should only be used once and at the global scope level for each converter. It declares everything needs so only the body of the Convert() function need be added.

#define PSYNONYM_COLOUR_CONVERTER | ( | from,
|  | to |  | ) | static PSynonymColourRegistration p_##from##_##to##_registration_instance(#from,#to)

Define synonym colour format.

This is a class that defines for which no conversion is required between the specified colour format names.