Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.1
LEADTOOLS Raster Imaging C DLL Help

L_EfxDraw3dShape

Show in webframe

#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)

HDC hDC;

/* handle to the target device context */

L_UINT uShape;

/* type of shape */

RECT *pRect;

/* pointer to the display rectangle */

COLORREF crBack;

/* background color */

HDC hdcBack;

/* handle to the device context for background */

RECT *prcBack;

/* pointer to the display background rectangle */

L_UINT uBackStyle;

/* background style */

COLORREF crFill;

/* foreground color */

L_UINT uFillStyle;

/* foreground style */

COLORREF crBorder;

/* border color */

L_UINT uBorderStyle;

/* border style */

L_UINT uBorderWidth;

/* border width */

COLORREF crInnerHilite;

/* inner band highlight color */

COLORREF crInnerShadow;

/* inner band shadow color */

L_UINT uInnerStyle;

/* inner band style */

L_UINT uInnerWidth;

/* inner band width */

COLORREF crOuterHilite;

/* outer band highlight color */

COLORREF crOuterShadow;

/* outer band shadow color */

L_UINT uOuterStyle;

/* outer band style */

L_UINT uOuterWidth;

/* outer band width */

L_INT nShadowX;

/* horizontal position of the shadow */

L_INT nShadowY;

/* vertical position of the shadow */

COLORREF crShadow;

/* shadow color */

HRGN hRgn;

/* region handle */

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

Parameter

Description

hDC

Handle to the target device context.

uShape

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

pRect

Pointer to the display destination rectangle.

crBack

COLORREF value that specifies the background color.

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.

prcBack

Pointer to the display background rectangle.

uBackStyle

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

crFill

COLORREF value that specifies the foreground color.

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 (XX)

crBorder

COLORREF value that specifies the border color.

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)

uBorderWidth

Border width.

crInnerHilite

COLORREF value that specifies the inner band highlight color.

crInnerShadow

COLORREF value that specifies the inner band shadow color.

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.

uInnerWidth

Inner band width.

crOuterHilite

COLORREF value that specifies the outer band highlight color.

crOuterShadow

COLORREF value that specifies the outer band shadow color.

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

uOuterWidth

Outer band width.

nShadowX

Horizontal position of the shadow.

nShadowY

Vertical position of the shadow.

crShadow

COLORREF value that specifies the shadow color.

hRgn

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

Returns

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

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_EfxDraw3dText, L_EfxDrawFrame, L_EfxDrawRotated3dText, L_EfxEffectBlt, L_EfxGradientFillRect, L_EfxPaintBitmap, L_EfxPaintTransition, L_EfxPatternFillRect, L_EfxTileRect

Topics:

Implementing Special Effects

 

Using Color Values in LEADTOOLS

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;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.