L_EfxDraw3dText

#include "l_bitmap.h"

L_LTEFX_API L_INT L_EfxDraw3dText(hDC, pszText, pRect, uFlags, nXDepth, nYDepth, crText, crShadow, crHilite, hFont, hdcFore)

Draws three-dimensional text into the target device context using the specified font, color, and style.

Parameters

HDC hDC

Handle to the target device context.

L_TCHAR * pszText

Text string.

RECT *pRect

Pointer to the display destination rectangle.

L_UINT uFlags

Text style. Use this parameter to control the style and justification of the three-dimensional text. For valid values, refer to Effect Text Style Flags and Effect Text Alignment Flags.

L_INT nXDepth

Horizontal shadow position.

L_INT nYDepth

Vertical shadow position.

COLORREF crText

COLORREF value that specifies the text color.

COLORREF crShadow

COLORREF value that specifies the shadow color.

COLORREF crHilite

COLORREF value that specifies the border color.

HFONT hFont

Handle to the selected font.

HDC hdcFore

Handle to the source device context for the foreground. Use this parameter to place an image (such as a gradient) on the surface of the three-dimensional text. Use NULL to paint the color specified in crText.

Returns

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

Comments

Use the uFlags parameter to control the style and justification of the three-dimensional text. Use the hdcFore parameter to place an image (such as a gradient) on the surface of the three-dimensional text.

Drop shadows are available only for the following uFlags values:

The crShadow color is used for three-dimensional effects for the following uFlags values:

The crHilite color is used only for the following uFlags values:

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 L_EfxDraw3dText.

L_INT EfxDraw3dTextExample(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 3d Text */ 
  nRet = L_EfxDraw3dText(hdc,                 /* device context */ 
                  TEXT("3D Text - LEADTOOLS"), 
                  pDest,               /* destination rectangle */ 
                                       /* style flags for 3D Text */ 
                  EFX_TEXT_DROPSHADOW | EFX_TEXT_HCENTER | EFX_TEXT_VCENTER, 
                  2,                   /* horizontal  shadow position */ 
                  2,                   /* vertical shadow position */ 
                  RGB ( 0,0,255 ),     /* text color, blue */ 
                  RGB ( 0,0,0 ),       /* shadow color, black */ 
                  RGB ( 255,255,255 ), /* border color, white */ 
                  (HFONT) GetStockObject(SYSTEM_FONT ), 
                  NULL );              /* do not put an image in the font */ 
  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 20.0.2019.12.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help