class PColourConverter: public PObject

This class defines a means to convert an image from one colour format to another.

Inheritance:


Public Methods

[more] PColourConverter ( const PString & srcColourFormat, const PString & dstColourFormat, unsigned width, unsigned height )
Create a new converter.
[more]virtual BOOL SetFrameSize ( unsigned width, unsigned height )
Set the frame size to be used.
[more]virtual BOOL SetSrcFrameSize ( unsigned width, unsigned height )
Set the source frame size to be used.
[more]virtual BOOL SetDstFrameSize ( unsigned width, unsigned height, BOOL bScale )
Set the destination frame size to be used.
[more]const PString& GetSrcColourFormat ()
Get the source colour format
[more]const PString& GetDstColourFormat ()
Get the destination colour format
[more]PINDEX GetMaxSrcFrameBytes ()
Get the maximum frame size in bytes for source frames.
[more]PINDEX GetMaxDstFrameBytes ()
Get the maximum frame size in bytes for destination frames.
[more]virtual BOOL Convert ( const BYTE * srcFrameBuffer, BYTE * dstFrameBuffer, PINDEX * bytesReturned = NULL )
Convert from one colour format to another.
[more]virtual BOOL ConvertInPlace ( BYTE * frameBuffer, PINDEX * bytesReturned = NULL, BOOL noIntermediateFrame = FALSE )
Convert from one colour format to another.
[more]static PColourConverter* Create ( const PString & srcColourFormat, const PString & dstColourFormat, unsigned width, unsigned height )
Create an instance of a colour conversion function.
[more]BOOL GetDstFrameSize (unsigned &w, unsigned &h) const
Return the output frame size
[more]BOOL GetSrcFrameSize (unsigned &w, unsigned &h) const
Return the input frame size


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions

Miscellaneous functions


Documentation

This class defines a means to convert an image from one colour format to another. It is an ancestor class for the individual formatting functions.
o PColourConverter( const PString & srcColourFormat, const PString & dstColourFormat, unsigned width, unsigned height )
Create a new converter.
Parameters:
srcColourFormat - Name of source colour format
dstColourFormat - Name of destination colour format
width - Width of frame
height - Height of frame

ovirtual BOOL SetFrameSize( unsigned width, unsigned height )
Set the frame size to be used.

Default behaviour calls SetSrcFrameSize() and SetDstFrameSize().

Parameters:
width - New width of frame
height - New height of frame

ovirtual BOOL SetSrcFrameSize( unsigned width, unsigned height )
Set the source frame size to be used.

Default behaviour sets the srcFrameWidth and srcFrameHeight variables and recalculates the frame buffer size in bytes then returns TRUE if the size was calculated correctly.

Parameters:
width - New width of frame
height - New height of frame

ovirtual BOOL SetDstFrameSize( unsigned width, unsigned height, BOOL bScale )
Set the destination frame size to be used.

Default behaviour sets the dstFrameWidth and dstFrameHeight variables, and the scale / crop preference. It then recalculates the frame buffer size in bytes then returns TRUE if the size was calculated correctly.

Parameters:
width - New width of target frame
height - New height of target frame
bScale - TRUE if scaling is preferred over crop

oconst PString& GetSrcColourFormat()
Get the source colour format

oconst PString& GetDstColourFormat()
Get the destination colour format

oPINDEX GetMaxSrcFrameBytes()
Get the maximum frame size in bytes for source frames.

Note a particular device may be able to provide variable length frames (eg motion JPEG) so will be the maximum size of all frames.

oPINDEX GetMaxDstFrameBytes()
Get the maximum frame size in bytes for destination frames.

Note a particular device may be able to provide variable length frames (eg motion JPEG) so will be the maximum size of all frames.

ovirtual BOOL Convert( const BYTE * srcFrameBuffer, BYTE * dstFrameBuffer, PINDEX * bytesReturned = NULL )
Convert from one colour format to another. This version will copy the data from one frame buffer to another. An implementation of this function should allow for the case of where srcFrameBuffer and dstFrameBuffer are the same, if the conversion algorithm allows for that to occur without an intermediate frame store.

The function should return FALSE if srcFrameBuffer and dstFrameBuffer are the same and that form pf conversion is not allowed

Parameters:
srcFrameBuffer - Frame store for source pixels
dstFrameBuffer - Frame store for destination pixels
bytesReturned - Bytes written to dstFrameBuffer

ovirtual BOOL ConvertInPlace( BYTE * frameBuffer, PINDEX * bytesReturned = NULL, BOOL noIntermediateFrame = FALSE )
Convert from one colour format to another. This version will copy the data from one frame buffer to the same frame buffer. Not all conversions can do this so an intermediate store and copy may be required. If the noIntermediateFrame parameter is TRUE and the conversion cannot be done in place then the function returns FALSE. If the in place conversion can be done then that parameter is ignored.

Note that the frame should be large enough to take the destination pixels.

Default behaviour calls Convert() from the frameBuffer to itself, and if that returns FALSE then calls it again (provided noIntermediateFrame is FALSE) using an intermediate store, copying the intermediate store back to the original frame store.

Parameters:
frameBuffer - Frame buffer to translate data
bytesReturned - Bytes written to frameBuffer
noIntermediateFrame - Flag to use intermediate store

ostatic PColourConverter* Create( const PString & srcColourFormat, const PString & dstColourFormat, unsigned width, unsigned height )
Create an instance of a colour conversion function. Returns NULL if there is no registered colour converter between the two named formats.
Parameters:
srcColourFormat - Name of source colour format
dstColourFormat - Name of destination colour format
width - Width of frame (used for both src and dst)
height - Height of frame (used for both src and dst)

oBOOL GetDstFrameSize(unsigned &w, unsigned &h) const
Return the output frame size

oBOOL GetSrcFrameSize(unsigned &w, unsigned &h) const
Return the input frame size


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.