L_EfxPaintBitmap
#include "l_bitmap.h"
L_INT EXT_FUNCTION L_EfxPaintBitmap(hDC, pBitmap, pSrc, pSrcClip, pDest, pDestClip, uEffect, uGrain, uDelay, nSpeed, nCycles, uPass, uMaxPass, fTransparency, crTransparency, uWandWidth, crWand, uROP)
HDC hDC; |
/* handle to the target device context */ |
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
RECT L_FAR * pSrc; |
/* pointer to the display source rectangle */ |
RECT L_FAR * pSrcClip; |
/* pointer to the display source clipping rectangle */ |
RECT L_FAR * pDest; |
/* pointer to the display rectangle */ |
RECT L_FAR * pDestClip; |
/* pointer to the display destination clipping rectangle */ |
L_UINT uEffect; |
/* effect to apply when painting */ |
L_UINT uGrain; |
/* graining size */ |
L_UINT uDelay; |
/* delay between graining steps */ |
L_INT nSpeed; |
/*speed of the wave */ |
L_INT nCycles; |
/* number of cycles or repetitions*/ |
L_UINT uPass; |
/* pass number when using a pattern brush */ |
L_UINT uMaxPass; |
/* maximum passes for a pattern brush */ |
L_BOOL fTransparency; |
/* transparency paint flag */ |
COLORREF crTransparency; |
/* transparency paint color */ |
L_UINT uWandWidth; |
/* wand width */ |
COLORREF crWand; |
/* wand color */ |
L_UINT32 uROP; |
/* Windows ROP code for display */ |
Applies an effect when painting a bitmap to a target device context. The effect, commonly used for slide show transitions, specifies how the image is painted, not how it looks when painting is finished.
Parameter |
Description |
hDC |
Handle to the target device context. |
pBitmap |
Pointer to the bitmap handle referencing the bitmap to paint. |
pSrc |
Pointer to the Windows RECT structure that specifies the part of the bitmap to use as the display source. |
|
The coordinates in the RECT structure are relative to the bitmap. You can pass NULL to use the default, which matches the bitmap. |
pSrcClip |
Pointer to the Windows RECT structure that specifies the portion of the display source to paint. Generally, this is used for updating the display when part of the source bitmap has changed. |
|
The coordinates in the RECT structure are relative to the bitmap. You can pass NULL to use the default, which matches the bitmap. |
pDest |
Pointer to the Windows RECT structure that determines how the source rectangle is scaled and how the image is positioned in the device context. |
|
The coordinates in the RECT structure are relative to the device context. There is no default for this parameter. You must specify the RECT structure. |
pDestClip |
Pointer to the Windows RECT structure that specifies the portion of the display rectangle to paint. Generally, this is used for updating changes in the display surface, such as when a user moves another window, uncovering a part of the image that had been covered up. |
|
The coordinates in the RECT structure are relative to the device context. You can pass NULL to use the default, which matches the device context. |
uEffect |
Effect to apply when painting. For valid values, refer to Effect Types. |
uGrain |
Graining size. 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. |
uDelay |
Delay between graining steps, in milliseconds. |
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. |
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. |
uPass |
Pass number when using a pattern brush. Use 1 for painting in one pass. |
uMaxPass |
Maximum passes for a pattern brush. Use 1 for painting in one pass. |
fTransparency |
TRUE to implement transparency by not painting pixels of the color specified in the crTransparency parameter; FALSE if transparency is not implemented. |
crTransparency |
COLORREF value that specifies the transparent color. |
uWandWidth |
Wand width, in pixels. |
crWand |
COLORREF value that specifies the wand color. |
uROP |
The Windows ROP code that determines how the destination rectangle is updated. This parameter takes the same codes as the Windows BitBlt function. For ordinary painting, use SRCCOPY. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.
Use this function instead of L_PaintDCEffect when more or different paint effects are desired.
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.
This function uses source and destination rectangles the same as L_PaintDC. For a complete explanation of the rectangles, refer to L_PaintDC.
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, Wave 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 have effect only if the uEffect parameter is from the Wave class.
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
Windows 95 / 98 / Me, Windows 2000 / XP, Windows CE.
See Also
Functions: |
L_EfxDraw3dShape, L_EfxDraw3dText, L_EfxDrawFrame, L_EfxDrawRotated3dText, L_EfxEffectBlt, L_EfxGradientFillRect, L_EfxPaintTransition, L_EfxPatternFillRect |
Topics: |
|
|
|
|
Example
/* This example shows the minimum requirements for using L_EfxPaintBitmap. */
void TestFunction ( HWND hWnd, RECT *pDest, BITMAPHANDLE * pBitmap )
{
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 = L_CreatePaintPalette ( hdc, pBitmap );
hSavedPalette = SelectPalette (hdc, hOurPalette, FALSE);
/* Realize our palette */
RealizePalette (hdc);
}
/* Paint the bitmap using 3 steps */
L_EfxPaintBitmap ( hdc, /* device context */
pBitmap, /* bitmap to paint */
NULL, /* source rectangle */
NULL, /* source clip rectangle */
pDest, /* destination rectangle */
NULL, /* destination clip rectangle */
EFX_EFFECT_WIPE4_L_R_T_B, /* effect to apply when painting the transition */
5, /* 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 */
L_EfxPaintBitmap ( hdc, /* device context */
pBitmap, /* bitmap to paint */
NULL, /* source rectangle */
NULL, /* source clip rectangle */
pDest, /* destination rectangle */
NULL, /* destination clip rectangle */
EFX_EFFECT_WIPE_RECTANGLE_IN, /* effect to apply when painting the transition */
5, /* 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 */
L_EfxPaintBitmap ( hdc, /* device context */
pBitmap, /* bitmap to paint */
NULL, /* source rectangle */
NULL, /* source clip rectangle */
pDest, /* destination rectangle */
NULL, /* destination clip rectangle */
EFX_EFFECT_WIPE_RECTANGLE_OUT, /* effect to apply when painting the transition */
5, /* 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 */
/* Restore the old palette */
if ( hOurPalette )
{
SelectPalette (hdc, hSavedPalette, FALSE);
DeleteObject (hOurPalette);
}
/* Release the device context */
ReleaseDC ( hWnd, hdc );
return;
}