L_PlaneBendBitmap

#include "l_bitmap.h"

L_LTIMGSFX_API L_INT L_PlaneBendBitmap(pBitmap, ptCenterPoint, uZValue, nDistance, uPlaneOffset, nRepeat, nPydAngle, uStretch, uBendFactor, uStartBright, uEndBright, uBrightLength, crBright, crFill, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

POINT ptCenterPoint;

/* point at which the viewer is looking */

L_UINT uZValue;

/* viewing screen offset on the Z-axis */

L_INT nDistance;

/* camera distance from the viewing screen */

L_UINT uPlaneOffset;

/* distance between planes */

L_INT nRepeat;

/* number of repeats */

L_INT nPydAngle;

/* view angle */

L_UINT uStretch;

/* compression factor */

L_UINT uBendFactor;

/* bending factor */

L_UINT uStartBright;

/* brightness of an external light source on the first bitmap displayed */

L_UINT uEndBright;

/* brightness of an external light source on the last bitmap displayed */

L_UINT uBrightLength;

/* changes in brightness along the Z axis */

COLORREF crBright;

/* color of an external light source that is shined on the bitmaps */

COLORREF crFill;

/* background color */

L_UINT uFlags;

/* flags */

Places the bitmap on parallel planes along the Z-axis, and bends the planes toward the center point.

Parameter

Description

pBitmap

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

ptCenterPoint

POINT structure that contains the point at which the camera or viewer is looking. This is also the point toward which the bitmaps will be bent. It may be outside the bitmap borders.

uZValue

Viewing screen offset on the Z-axis, in pixels.

nDistance

Camera distance from the viewing screen, in pixels.

uPlaneOffset

Distance between the parallel planes.

nRepeat

Number of times the bitmap repeats along the Z-axis. If nRepeat equals 1 the bitmap will be infinitely repeated. Its range starts from 1.

nPydAngle

The view angle, off the Z-axis. This value is given in hundredths of a degree (+/-). This can be a number from 0 to 36,000.

uStretch

Value that indicates whether to expand or compress the bitmap, and by how much. If uStretch < 100 bitmap will be expanded. If uStretch > 100 the bitmap will be compressed. Use 100 to maintain the bitmap's dimensions. The value of this parameter is internally divided by 100.

uBendFactor

Determines the planes bending value. The range starts at 100 and increases indefinitely. If uBendFactor equals 100 the planes will not be bent.If uBendFactor > 100 planes will be bent. The value of this parameter is internally divided by 100.

uStartBright

Value that indicates the brightness of an external light source on the first bitmap displayed. Possible values range from 0 to 100. A value of 0 indicates no external light displayed on the bitmap. A value of 100 indicates an external light source with full brightness is displayed on the bitmap.

uEndBright

Value that indicates the brightness of an external light source on the last bitmap displayed. Possible values range from 0 to 100. A value of 0 indicates no external light displayed on the bitmap. A value of 100 indicates an external light source with full brightness is displayed on the bitmap.

uBrightLength

Value that indicates how much the brightness changes as you move along the Z axis. This parameter is internally multiplied by 50.

crBright

The COLORREF value that specifies the color of an external light source that shines on the displayed bitmaps.

crFill

The COLORREF value that specifies the background color.

uFlags

Flags that indicate the background color and the planes to be shown. You can use a bit wise OR (|) to specify one flag from each group.

 

The following are the flags that indicate the background color:

 

Value

Meaning

 

PLANE_FILL_CLR

[0x0001] Use the crFill as a background color.

 

PLANE_NO_CHG

[0x0002] Use the image itself as a background

 

The following are the flags that indicate which planes (with respect to the Z-axis) will be shown. You can use a bit wise OR (|) to specify more than one plane. However, you can only combine PLANE_LEFT with PLANE_RIGHT or PLANE_UP with PLANE_DOWN.

 

Value

Meaning

 

PLANE_LEFT

[0x0010] The plane will be displayed to the left of the Z-axis.

 

PLANE_RIGHT

[0x0020] The plane will be displayed to the right of the Z-axis.

 

PLANE_UP

[0x0040] The plane will be displayed above the Z-axis.

 

PLANE_DOWN

[0x0080] The plane will be displayed below the Z-axis.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

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.

This function shows the effect of placing bitmaps on planes along the Z-axis and bending them toward a specific point. These bitmaps may be placed above, below, to the left or to the right of the Z-axis. An external light source of the specified color and brightness may be shined on the bitmaps. The brightness may vary along the z-axis according to the uBrightLength value. The line of bitmaps may be bent toward a specified point by setting a bending value in the uBendFactor parameter.

By changing ptCenterPoint and the viewing screen Z-offset, you can simulate moving along the axis.

If the bitmap has a region, the effect will be applied on the region dimensions only.

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 in the Document and Medical Imaging toolkits.

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

For an example, click here

To obtain this effect, the following settings were used with the function:

CenterPoint(x,y)= (640,256)
uZValue = 0
nDistance= 256
uPlaneOffset= 256
nRepeat= -1
nPydAngle= 0
uStretch= 100
uBendFactor= 500
uStartBright= 0
uEndBright= 0
uBrightLength= 50
crBright= RGB(255,255,255)
crFill= RGB(0,0,0)
uFlags= PLANE_FILL_CLR|PLANE_DOWN

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

Required DLLs and Libraries

LTIMGSFX

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 2000 / XP/Vista.

See Also

Functions:

L_AddBitmapNoise, L_EmbossBitmap, L_MosaicBitmap, L_MotionBlurBitmap, L_OilifyBitmap, L_PosterizeBitmap, L_RemoveRedeyeBitmap, L_SolarizeBitmap, L_UnderlayBitmap, L_BumpMapBitmap, L_CubismBitmap, L_DrawStarBitmap, L_GlowFilterBitmap, L_FreePlaneBendBitmap, L_DryBitmap, L_OceanBitmap, L_GlassEffectBitmap, L_LensFlareBitmap, L_LightBitmap, L_FreeRadBendBitmap, L_PlaneBitmap, L_SampleTargetBitmap, L_TunnelBitmap, L_BendingBitmap, L_CylindricalBitmap, L_FreeHandShearBitmap, L_FreeHandWaveBitmap, L_ImpressionistBitmap, L_PixelateBitmap, L_PolarBitmap, L_PunchBitmap, L_RadialBlurBitmap, L_RadWaveBitmap, L_RippleBitmap, L_SpherizeBitmap, L_SwirlBitmap, L_WaveBitmap, L_WindBitmap, L_ZoomBlurBitmap, L_ZoomWaveBitmap, L_BricksTextureBitmap, L_CanvasBitmap, L_CloudsBitmap, L_ColoredBallsBitmap, L_DiffuseGlowBitmap, L_DisplaceMapBitmap, L_FragmentBitmap, L_HalfTonePatternBitmap, L_MaskConvolutionBitmap, L_MosaicTilesBitmap, L_OffsetBitmap, L_PerspectiveBitmap, L_PlasmaFilterBitmap, L_PointillistBitmap, L_RomanMosaicBitmap, L_VignetteBitmap, L_ZigZagBitmap, L_AdjustBitmapTint, L_ColorHalfToneBitmap

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Raster Image Functions: Artisitic Effects

 

Applying Artistic Effects

 

Using Color Values in LEADTOOLS

 

Raster Image Functions: Correcting Colors

Example

 L_INT PlaneBendBitmapExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */
   POINT CenterPt; 

   /* Load a bitmap at its own bits per pixel  */
   nRet = L_LoadBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE3.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
   if(nRet !=SUCCESS)
      return nRet;

   /* put the image on upper and lower parallel planes bended toward the center point*/
   CenterPt.x  =  LeadBitmap.Width;
   CenterPt.y  =  LeadBitmap. Height/2;

   nRet = L_PlaneBendBitmap(&LeadBitmap, CenterPt, 0, LeadBitmap.Height, LeadBitmap.Width/2, -1, 0, 100,400,0,100, 20000, RGB(255,0,0), RGB(0,0,0), PLANE_DOWN | PLANE_UP | PLANE_FILL_CLR);
   if(nRet !=SUCCESS)
      return nRet;
   nRet = L_SaveBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Result.BMP"), &LeadBitmap, FILE_BMP, 24, 0, NULL);
   if(nRet !=SUCCESS)
      return nRet;
   //free bitmap 
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);  
   return SUCCESS;
}