L_PerspectiveBitmap

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_PerspectiveBitmap(pBitmap, pPoints, crBkgColor, uFlag)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

POINT L_FAR * pPoints;

/* pointer to an array of points */

COLORREF crBkgColor;

/* background color */

L_UINT uFlag;

/* flag */

Gives a bitmap a 3-D effect, as if it exists on a flat plane and has been skewed into a different shape. This function is available in the Raster Pro and above toolkits.

Parameter

Description

pBitmap

Pointer to the bitmap handle referencing the bitmap to be changed.

pPoints

Pointer to an array of points that determine the new locations of image corners. It should contain four points; points at indices 0, 1, 2 and 3 determine the new locations of left-top, right-top, left-bottom and right-bottom image corners respectively.

crBkgColor

Background color.

uFlag

Flag that indicates how to create the background. Possible values are:

 

Value

Meaning

 

PERSPECTIVE_IMAGE

[0x0001] Use the same image as the background.

 

PERSPECTIVE_COLOR

[0x0002] Fill the back ground with crBkgColor.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The new locations for the image corners should keep the relative relation between corners. For example, the point at index 1 should be to the right of point at index 0 and above the point at index 3. Also, the point at index 2 should be to the left of the point at index 3 and below the point at index 0 and so on. All new locations should remain inside the image.

To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

If the bitmap has a region, this function works only on the region. If the bitmap does not have a region, this function works on the entire bitmap.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

Required DLLs and Libraries

LTIMG

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.

See Also

Functions:

L_CombineBitmapWarp, L_AddBitmapNoise, L_EmbossBitmap, L_MosaicBitmap, L_MotionBlurBitmap, L_OilifyBitmap, L_PosterizeBitmap, L_RemoveRedeyeBitmap, L_SolarizeBitmap, L_UnderlayBitmap, L_BendingBitmap, L_CylindricalBitmap, L_FreeHandShearBitmap, L_FreeHandWaveBitmap, L_PixelateBitmap, L_ImpressionistBitmap, L_PolarBitmap, L_PunchBitmap, L_RadialBlurBitmap, L_RadWaveBitmap, L_RippleBitmap, L_SwirlBitmap, L_WaveBitmap, L_WindBitmap, L_ZoomBlurBitmap, L_ZoomWaveBitmap, L_BumpMapBitmap, L_CubismBitmap, L_DrawStarBitmap, L_DryBitmap, L_FreePlaneBendBitmap, L_FreeRadBendBitmap, L_GlassEffectBitmap, L_GlowFilterBitmap, L_LensFlareBitmap, L_LightBitmap, L_OceanBitmap, L_PlaneBendBitmap, L_PlaneBitmap, L_SampleTargetBitmap, L_TunnelBitmap, L_SpherizeBitmap

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Processing an Image

 

Applying Artistic Effects

 

Raster Image Functions: Filtering Images

 

Raster Image Functions: Processing an Image

Example

/* The following example loads a bitmap, and applies the 3D perspective effect*/
BITMAPHANDLE LeadBitmap;
POINT pNewLocations [4];
/* Load the bitmap, keeping the bits per pixel of the file */
L_LoadBitmap (TEXT("Sample1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
pNewLocations [0].x=LeadBitmap.Width*3/9;
pNewLocations [0].y=LeadBitmap.Height*1/12;
pNewLocations [1].x=LeadBitmap.Width*3/4;
pNewLocations [1].y=LeadBitmap.Height*2/12;
pNewLocations [2].x=LeadBitmap.Width*2/10;
pNewLocations [2].y=LeadBitmap.Height*8/10;
pNewLocations [3].x=LeadBitmap.Width*10/11;
pNewLocations [3].y=LeadBitmap.Height*7/10;

/*Apply the filter*/
L_PerspectiveBitmap
(&LeadBitmap, pNewLocations,RGB(255,255,255), PERSPECTIVE_IMAGE);