Performs a bit-block transfer of the source rectangle of pixels from the specified source device context into a destination device context, while tiling the source to fit the destination.
#include "l_bitmap.h"
L_LTEFX_API L_INT L_EfxTileRect(hdcDest, prcDest, hdcSrc, prcSrc)
Handle to the target device context.
Pointer to the destination rectangle.
Handle to the source device context.
Pointer to the source rectangle.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Use this function as a replacement for the Windows BitBlt C API function when you want a special painting effect.
If the source rectangle is smaller than the destination rectangle, then the source rectangle will be duplicated (tiled) as many times as necessary to fit the destination rectangle.
For general information, refer to Implementing Special Effects.
Win32, x64.
This function shows how to use L_EfxTileRect.
L_INT EfxTileRectExample(HWND hWnd)
{
L_INT nRet;
HDC hdcDest; // Device context for the current window
HDC hdcSrc; // Device context for the source image
BITMAPHANDLE Bitmap; // image that will be blt
HBITMAP hbmMem; // image that will be blt
HPALETTE hSavedPalette = NULL; // Temporary copy of the current system palette
HPALETTE hPaintPal = NULL; // The palette that we will use to paint
L_INT nBitsPerPixel;
L_RECT rcDst;
L_RECT rcSrc;
// Get the device context
hdcDest = GetDC(hWnd);
// Check the device to see if we need a palette
nBitsPerPixel = GetDeviceCaps(hdcDest, BITSPIXEL) * GetDeviceCaps(hdcDest, PLANES);
// Load an image to BLT
// Load the image as screen bit-depth
nRet = L_LoadBitmap(MAKE_IMAGE_PATH("IMAGE1.CMP"), &Bitmap, sizeof(BITMAPHANDLE), (nBitsPerPixel <= 8) ? nBitsPerPixel : 24, ORDER_BGR, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
// Create the source DC
hdcSrc = CreateCompatibleDC(hdcDest);
// Convert the image to DDB and select it into the source dc
hbmMem = L_ConvertToDDB(hdcDest, &Bitmap);
L_FreeBitmap(&Bitmap);
hbmMem = (HBITMAP)SelectObject(hdcSrc, hbmMem);
if (nBitsPerPixel <= 8)
{
hPaintPal = L_CreatePaintPalette(hdcDest, &Bitmap);
hSavedPalette = SelectPalette(hdcDest, hPaintPal, FALSE);
// Realize our palette
RealizePalette(hdcDest);
}
// tile the image using L_EfxTileRect
GetClientRect(hWnd, &rcDst);
SetRect(&rcSrc, 0, 0, 100, 100);
nRet = L_EfxTileRect(hdcDest, &rcDst, hdcSrc, &rcSrc);
if (nRet != SUCCESS)
return nRet;
// Restore the old palette
if (hPaintPal)
{
SelectPalette(hdcDest, hSavedPalette, FALSE);
DeleteObject(hPaintPal);
}
// Release the device context
ReleaseDC(hWnd, hdcDest);
DeleteDC(hdcSrc);
DeleteObject(hbmMem);
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