L_EfxPatternFillRect

Summary

Draws a rectangle into the target device context, and then fills the rectangle with the specified pattern and color.

Syntax

#include "l_bitmap.h"

L_LTEFX_API L_INT L_EfxPatternFillRect(hDC, pRect, uStyle, crBack, crFore)

Parameters

HDC hDC

Handle to the target device context.

RECT *pRect

Pointer to the display destination rectangle.

L_UINT uStyle

Filling style. The following are possible values. (Values cannot be combined.)

Value Meaning
EFX_PATTERN_SOLID Solid ◼
EFX_PATTERN_HORZ_LINE Horizontal lines ▤
EFX_PATTERN_VERT_LINE Vertical lines ▥
EFX_PATTERN_DOWNWARD_DIAG Downward diagonal lines ▨
EFX_PATTERN_UPWARD_DIAG Upward diagonal lines ▧
EFX_PATTERN_CROSS Cross line ▦
EFX_PATTERN_DIAG_CROSS Diagonal cross lines ▩
EFX_PATTERN_MAX Diagonal cross lines ▩

COLORREF crBack

COLORREF value that specifies the background color.

COLORREF crFore

COLORREF value that specifies the foreground color.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

For general information, refer to Implementing Special Effects.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example shows the minimum requirements for using the L_EfxPatternFillRect function to draw and fill a rectangle with a pattern and color.

L_INT EfxPatternFillRectExample(HWND hWnd, RECT * pDest) 
{ 
   L_INT    nRet; 
   HDC      hdc;                   // Device context for the current window 
   HPALETTE hSavedPalette = NULL;  // Temporary copy of the current system palette 
   HPALETTE hOurPalette = NULL;    // The palette that we will use to paint 
   L_INT    nBitsPerPixel; 
 
   // Get the device context 
   hdc = GetDC(hWnd); 
 
   // Check the device to see if we need a palette 
   nBitsPerPixel = GetDeviceCaps(hdc, BITSPIXEL) * GetDeviceCaps(hdc, PLANES); 
   if (nBitsPerPixel <= 8) 
   { 
      hOurPalette = (HPALETTE)GetStockObject(DEFAULT_PALETTE); 
      hSavedPalette = SelectPalette(hdc, hOurPalette, FALSE); 
      // Realize our palette 
      RealizePalette(hdc); 
   } 
 
   // Draw the pattern filled rectangle 
   nRet = L_EfxPatternFillRect(hdc, // device context 
      pDest,                        // destination rectangle 
      EFX_PATTERN_DIAG_CROSS,       // diagonal cross pattern 
      RGB(0, 0, 0),                 // background color, black 
      RGB(0, 0, 255));              // foreground color, blue 
   if (nRet != SUCCESS) 
      return nRet; 
 
   // Restore the old palette 
   if (hOurPalette) 
      SelectPalette(hdc, hSavedPalette, FALSE); 
 
   // Release the device context 
   ReleaseDC(hWnd, hdc); 
 
   return SUCCESS; 
} 

Help Version 22.0.2023.7.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.