L_EfxPaintTransition

Summary

Draws a rectangle into the target device context with the specified fill pattern and color while using a special effect.

Syntax

#include "l_bitmap.h"

L_LTEFX_API L_INT L_EfxPaintTransition(hDC, uTransition, crBack, crFore, uSteps, pDest, uEffect, uGrain, uDelay, nSpeed, nCycles, uPass, uMaxPass, fTransparency, crTransparency, uWandWidth, crWand, uROP)

Parameters

HDC hDC

Handle to the target device context.

L_UINT uTransition

Filling style during transition. For valid values, refer to Effect Transition Filling Styles.

COLORREF crBack

COLORREF value that specifies the background color. If a gradient transition is specified in the uTransition parameter, this is the beginning color for the gradient transition. Otherwise, it is the only color that is used.

COLORREF crFore

COLORREF value that specifies the foreground color. If a gradient transition is specified in the uTransition parameter, this is the ending color for the gradient transition. Otherwise, this color is not used.

L_UINT uSteps

Number of gradient color steps. This parameter is used only if a gradient transition is specified in the uTransition parameter. Valid values are 2 to 256.

RECT *pDest

Pointer to the display destination rectangle.

L_UINT uEffect

Effect to apply when painting. For valid values, refer to Effect Types.

L_UINT uGrain

This is the smallest size (pixel width or height) to be updated when painting an effect. Using a small grain makes the painting smoother, but takes longer to paint. Using a large grain makes the painting more coarse, but paints faster. If the uEffect parameter is from the Wave class this represents the duration or height of the wave. Valid values are 1 to 256.

L_UINT uDelay

Delay between graining steps, in milliseconds.

L_INT nSpeed

Speed of the wave. Valid values are 1 to 256. This parameter is valid only if the uEffect parameter is from the Wave class.

L_INT nCycles

Number of cycles or repetitions used to draw the wave. This parameter is valid only if the uEffect parameter is from the Wave class.

L_UINT uPass

Pass number when using a pattern brush. Use 1 for painting in one pass.

L_UINT uMaxPass

Maximum passes for a pattern brush. Use 1 for painting in one pass.

L_BOOL fTransparency

TRUE to implement transparency by not painting pixels of the color specified in the crTransparency parameter; FALSE if transparency is not implemented.

COLORREF crTransparency

COLORREF value that specifies the transparency paint color.

L_UINT uWandWidth

Wand width, in pixels.

COLORREF crWand

COLORREF value that specifies the wand color.

L_UINT32 uROP

Windows ROP code for display. This parameter takes the same codes as the Windows BitBlt function. For ordinary painting, use SRCCOPY.

Returns

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

Comments

Use this function to create a special effect screen transition before painting the next image.

Use the uGrain and uDelay parameters to control the speed of the display. The uGrain parameter controls the size of the painting increment, and uDelay controls the time between increments.

The wand is a solid color bar that moves during an effect. Small grain sizes produce the best wand effects. Many of the effects listed in Effect Types can have a wand.

Use the uPass and uMaxPass parameters to paint the image in more than one pass. For example, if you want a 3-pass paint, use uMaxPass of 3 and paint 3 times, once with uPass = 1, once with uPass = 2, and once with uPass = 3.

For general information, refer to Implementing Special Effects.

Multipass painting for the EFX_EFFECT_PUSH_CLASS is disabled.

If the uEffect parameter is from the Twirl class, White Turnover class, Turnover class, Replace class, Laser class, Fade Normal class, Fade Black and White class, Fade Color class or Wave class, the uPass and uMaxPass parameters have no effect.

If the uEffect parameter is from the Fade Normal class, Fade Black and White class or Fade Color class, the uGrain parameter has no effect. However, if the uEffect parameter is from the Wave class, the uGrain parameter contains the wave size.

If the uEffect parameter is from the White Turnover class, the Turnover class or the Replace class, the uWandWidth and crWand parameters have no effect. However, if the uEffect parameter is from the Fade Color class, the crWand parameter contains the bitmap color level.

The nSpeed and nCycles parameters are valid only if the uEffect parameter is from the Wave class.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This example shows the minimum requirements for using L_EfxPaintTransition.

L_INT EfxPaintTransitionExample(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); 
   } 
 
   // Paint the transition in 3 steps 
   nRet = L_EfxPaintTransition(hdc,    // device context 
      EFX_TRANS_GRADIENT_LINE_R_TO_L,  // transition effect to paint 
      RGB(255, 0, 0),                  // background color, red 
      RGB(0, 0, 255),                  // foreground color, blue 
      12,                              // gradient color steps 
      pDest,                           // destination rectangle 
      EFX_EFFECT_WIPE_RECTANGLE_IN,    // effect to apply when painting the transition 
      4,                               // graining size 
      10,                              // delay between graining steps 
      0,                               // speed of the wave 
      0,                               // number of cycles or repetitions 
      1,                               // step number for the pattern brush 
      3,                               // maximum steps for the pattern brush 
      FALSE,                           // do not use transparency 
      0,                               // no transparent color 
      0,                               // wand width 
      0,                               // no wand color 
      SRCCOPY);                        // Windows raster operation code 
   if (nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_EfxPaintTransition(hdc,    // device context 
      EFX_TRANS_GRADIENT_LINE_R_TO_L,  // transition effect to paint 
      RGB(255, 0, 0),                  // background color, red 
      RGB(0, 0, 255),                  // foreground color, blue 
      12,                              // gradient color steps 
      pDest,                           // destination rectangle 
      EFX_EFFECT_WIPE_RECTANGLE_OUT,   // effect to apply when painting the transition 
      4,                               // graining size 
      10,                              // delay between graining steps 
      0,                               // speed of the wave 
      0,                               // number of cycles or repetitions 
      2,                               // step number for the pattern brush 
      3,                               // maximum steps for the pattern brush 
      FALSE,                           // do not use transparency 
      0,                               // no transparent color 
      0,                               // wand width 
      0,                               // no wand color 
      SRCCOPY);                        // Windows raster operation code 
   if (nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_EfxPaintTransition(hdc,       // device context 
      EFX_TRANS_GRADIENT_LINE_R_TO_L,     // transition effect to paint 
      RGB(255, 0, 0),                     // background color, red 
      RGB(0, 0, 255),                     // foreground color, blue 
      12,                                 // gradient color steps 
      pDest,                              // destination rectangle 
      EFX_EFFECT_WIPE_CIRCLE_C_CW_FROM_L, // effect to apply when painting the transition 
      4,                                  // graining size 
      10,                                 // delay between graining steps 
      0,                                  // speed of the wave 
      0,                                  // number of cycles or repetitions 
      3,                                  // step number for the pattern brush 
      3,                                  // maximum steps for the pattern brush 
      FALSE,                              // do not use transparency 
      0,                                  // no transparent color 
      0,                                  // wand width 
      0,                                  // no wand color 
      SRCCOPY);                           // Windows raster operation code 
   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 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 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.