#include "l_bitmap.h"
L_INT pEXT_CALLBACK YourFunction (pBitmap, pBuffer, nLines, pUserData)
Handles the converted image data that the L_ColorResBitmap function has written to a buffer.
The pointer to the bitmap handle referencing the bitmap that contains the image information.
A pointer to a buffer containing one or more lines of output image data that the calling function has already converted.
The number of lines in the pBuffer
buffer.
A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the calling function.)
Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
This is an optional callback function for additional processing. (The bitmap is modified the same way, whether you provide a callback function or not.) For an explanation of how the callback function is used, refer to L_ColorResBitmap.
Required DLLs and Libraries
This COLORRESCALLBACK function paints the image as the image is processed.
/* Structure used for the callback function's user data */
typedef struct tagIMAGECBPARM
{
HWND hwnd; /* Current window */
HDC hdc; /* Device context for the current window */
L_INT nRow; /* First row in the input buffer */
HPALETTE hpalPaint; /* Paint palette handle */
RECT rLeadDest; /* Destination rectangle for painting */
RECT rLeadSource; /* Source rectangle for painting */
} IMAGECBPARM, * LPIMAGECBPARM;
/*******************************************************************************/
L_INT EXT_CALLBACK ColorResCallback (pBITMAPHANDLE pBitmap,
L_UCHAR *pBuffer, L_INT nLines,
L_VOID * pColorResUserData)
{
LPIMAGECBPARM pUserData = (LPIMAGECBPARM) pColorResUserData;
/* If this is the first call (row 0), select and realize the palette */
if( pUserData->nRow == 0 )
{
SendMessage (pUserData->hwnd, WM_QUERYNEWPALETTE, 0, 0L);
SelectPalette( pUserData->hdc, pUserData->hpalPaint, TRUE );
RealizePalette(pUserData->hdc);
}
/* Paint the buffer to the specified device context */
L_PaintDCBuffer( pUserData->hdc, /* Device context - from function parameter */
pBitmap, /* Bitmap handle - from function parameter */
&pUserData->rLeadSource, /* Source rect - set globally in WM_CREATE */
&pUserData->rLeadSource, /* Source clip rect - same as source rect */
&pUserData->rLeadDest, /* Destination rect - set globally in WM_CREATE */
&pUserData->rLeadDest, /* Destination clip rect - same as destination rect */
SRCCOPY, /* ROP code for normal painting */
pBuffer, /* Input buffer - from function parameter */
pUserData->nRow, /* First row in buffer - from function parameter */
nLines ); /* Number of lines in the buffer - from function parameter */
/* Increment the current row by the number of lines in the buffer */
pUserData->nRow += nLines;
return( SUCCESS );
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document