Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PColourConverter::ConvertInPlace ( BYTE *  frameBuffer,
PINDEX *  bytesReturned = NULL,
BOOL  noIntermediateFrame = FALSE 
) [virtual, inherited]

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.

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

Definition at line 532 of file vconvert.cxx.

References PColourConverter::Convert().

  if (Convert(frameBuffer, frameBuffer, bytesReturned))
    return TRUE;

  if (noIntermediateFrame) {
    PTRACE(2,"PColCnv\tError in ConvertInPlace, no intermediate frame available.");
    return FALSE;

  BYTE * intermediate = intermediateFrameStore.GetPointer(dstFrameBytes);
  PINDEX bytes;
  if (!Convert(frameBuffer, intermediate, &bytes))
    return FALSE;

  memcpy(frameBuffer, intermediate, bytes);
  if (bytesReturned != NULL)
    *bytesReturned = bytes;
  return TRUE;

Generated by  Doxygen 1.6.0   Back to index