L_EfxTileRect

#include "l_bitmap.h"

L_LTEFX_API L_INT L_EfxTileRect(hdcDest, prcDest, hdcSrc, prcSrc)

HDC hdcDest;

handle to the target device context

RECT *prcDest;

pointer to the destination rectangle

HDC hdcSrc;

handle to the source device context

RECT *prcSrc;

pointer to the source rectangle

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.

Parameter

Description

hdcDest

Handle to the target device context.

prcDest

Pointer to the destination rectangle.

hdcSrc

Handle to the source device context.

prcSrc

Pointer to the source rectangle.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

Required DLLs and Libraries

LTEFX

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64.

See Also

Functions:

L_EfxEffectBlt, L_EfxDraw3dShape, L_EfxDraw3dText, L_EfxDrawFrame, L_EfxDrawRotated3dText, L_EfxGradientFillRect, L_EfxPaintBitmap, L_EfxPaintTransition, L_EfxPatternFillRect

Topics:

Implementing Special Effects

 

Using Color Values in LEADTOOLS

Example

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(TEXT("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 Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help