L_EfxDraw3dShape

#include "l_bitmap.h"

L_LTEFX_API L_INT L_EfxDraw3dShape(hDC, uShape, pRect, crBack, hdcBack, prcBack, uBackStyle, crFill, uFillStyle, crBorder, uBorderStyle, uBorderWidth, crInnerHilite, crInnerShadow, uInnerStyle, uInnerWidth, crOuterHilite, crOuterShadow, uOuterStyle, uOuterWidth, nShadowX, nShadowY, crShadow, hRgn)

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

Parameters

HDC hDC

Handle to the target device context.

L_UINT uShape

Shape type. For valid values, refer to Effect Shapes.

RECT *pRect

Pointer to the display destination rectangle.

COLORREF crBack

COLORREF value that specifies the background color.

HDC hdcBack

Handle to the source device context for background. Use this parameter and prcBack to place an image from another device context into the background of the shape. To use a background image, the uFillStyle parameter must not be EFX_FILLSTYLE_SOLID.

RECT *prcBack

Pointer to the display background rectangle.

L_UINT uBackStyle

Background style. For valid values, refer to Effect Background Styles.

COLORREF crFill

COLORREF value that specifies the foreground color.

L_UINT uFillStyle

Foreground style. The following are valid values:

Value Meaning
EFX_FILLSTYLE_SOLID Solid filling ◼
EFX_FILLSTYLE_TRANSPARENT Transparent filling ◻
EFX_FILLSTYLE_HORIZONTAL Horizontal lines ▤
EFX_FILLSTYLE_VERTICAL Vertical lines ▥
EFX_FILLSTYLE_FDIAGONAL Downward diagonal lines ▨
EFX_FILLSTYLE_BDIAGONAL Upward diagonal lines ▧
EFX_FILLSTYLE_CROSS Cross lines ▦
EFX_FILLSTYLE_DIAGCROSS Diagonal cross lines ▩

COLORREF crBorder

COLORREF value that specifies the border color.

L_UINT uBorderStyle

Border style. The following are valid values:

Value Meaning
EFX_BORDERSTYLE_TRANSPARENT Transparent
EFX_BORDERSTYLE_SOLID Solid line
EFX_BORDERSTYLE_DASH Dash line (valid only for 1-pixel lines)
EFX_BORDERSTYLE_DOT Dot line (valid only for 1-pixel lines)
EFX_BORDERSTYLE_DASHDOT Dash dot line (valid only for 1-pixel lines)
EFX_BORDERSTYLE_DASHDOTDOT Dash dot dot line (valid only for 1-pixel lines)

L_UINT uBorderWidth

Border width.

COLORREF crInnerHilite

COLORREF value that specifies the inner band highlight color.

COLORREF crInnerShadow

COLORREF value that specifies the inner band shadow color.

L_UINT uInnerStyle

Inner band style. The following are valid values:

Value Meaning
EFX_INNERSTYLE_NONE None
EFX_INNERSTYLE_INSET Inner band inset
EFX_INNERSTYLE_RAISED Inner band raised

The inner band is available only for squares and rectangles.

L_UINT uInnerWidth

Inner band width.

COLORREF crOuterHilite

COLORREF value that specifies the outer band highlight color.

COLORREF crOuterShadow

COLORREF value that specifies the outer band shadow color.

L_UINT uOuterStyle

Outer band style. The following are valid values:

Value Meaning
EFX_OUTERSTYLE_NONE None
EFX_OUTERSTYLE_INSET Outer band inset
EFX_OUTERSTYLE_RAISED Outer band raised

L_UINT uOuterWidth

Outer band width.

L_INT nShadowX

Horizontal position of the shadow.

L_INT nShadowY

Vertical position of the shadow.

COLORREF crShadow

COLORREF value that specifies the shadow color.

HRGN hRgn

Handle to a Windows region that defines the shape. This parameter is used only if the uShape parameter is EFX_SHAPE_REGION.

Returns

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

Comments

Use hdcBack and prcBack to place an image from another device context into the background of the shape.

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

L_INT EfxDraw3dShapeExample(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; 
  HDC       hdcMem;                 /* HDC for background image */ 
  HBITMAP   hbmMem;                 /* Bitmap for background image */ 
  RECT      rcbm; 
 
  /* 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);  
  } 
  /* Create the gradient for the background of the 3D shape */   
  rcbm.top     = pDest->top; 
  rcbm.left    = pDest->left; 
  rcbm.bottom  = pDest->bottom; 
  rcbm.right   = pDest->right; 
 
  OffsetRect(&rcbm, -pDest->left, -pDest->top); 
  hdcMem = CreateCompatibleDC(hdc); 
  hbmMem = CreateCompatibleBitmap(hdc, rcbm.right, rcbm.bottom); 
  hbmMem = (HBITMAP)SelectObject(hdcMem, hbmMem); 
  /* Place a gradient in the background of the 3D shape */ 
  nRet = L_EfxGradientFillRect ( hdcMem, 
                          &rcbm, 
                          EFX_GRADIENT_LINE_L_TO_R, 
                          RGB(255, 0, 0), 
                          RGB(0, 0, 255), 
                          16 ); 
  if(nRet != SUCCESS) 
     return nRet; 
 
  /* Draw the 3D shape */ 
  nRet = L_EfxDraw3dShape ( hdc,                    /* device context */ 
                     EFX_SHAPE_STAR4,        /* star shape */ 
                     pDest,                  /* destination rectangle */ 
                     RGB ( 0,0,255 ),        /* background color, blue */ 
                     hdcMem,                 /* use this to place an image in the background */ 
                     &rcbm,                  /* display background rectangle */ 
                     EFX_BACKSTYLE_TRANSLUCENTTILEDIMAGE,/* style flags for 3D shape */ 
                     RGB (255,0,0 ),         /* foreground color, red */ 
                     EFX_FILLSTYLE_TRANSPARENT,/* foreground style */ 
                     RGB ( 255,0,0 ),        /* border color, red */ 
                     EFX_BORDERSTYLE_SOLID,  /* border style */ 
                     5,                      /* border width */ 
                     RGB ( 255,255,255 ),    /* inner band highlight color, white */ 
                     RGB ( 128,128,128 ),    /* inner band shadow color */ 
                     EFX_INNERSTYLE_INSET,   /* inner band style */ 
                     3,                      /* inner band width */ 
                     RGB ( 255,0,0 ),        /* outer band highlight color, RED */ 
                     RGB ( 128,128,128 ),    /* outer band shadow color */ 
                     EFX_OUTERSTYLE_INSET,   /* outer band style */ 
                     3,                      /* outer band width */ 
                     2,                      /* horizontal shadow position */ 
                     2,                      /* vertical shadow position */ 
                     RGB ( 0,0,0 ),          /* shadow color, black */ 
                     NULL );                 /* no region handle */ 
  if(nRet != SUCCESS) 
     return nRet; 
 
  /* Restore the old palette */ 
  if  ( hOurPalette ) 
    SelectPalette (hdc, hSavedPalette, FALSE); 
  /* Release the device context */ 
  ReleaseDC(hWnd, hdc); 
  DeleteObject(SelectObject(hdcMem, hbmMem)); 
  DeleteDC(hdcMem);  
   return SUCCESS; 
} 

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

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