L_ColoredBallsBitmap

#include "l_bitmap.h"

L_LTIMGSFX_API L_INT L_ColoredBallsBitmap(pBitmap, uNumBalls, uSize, uSizeVariation, nHighLightAng, crHighLight, crBkgColor, crShadingColor, pBallColors, uNumOfBallColors, uAvrBallClrOpacity, uBallClrOpacityVariation, uRipple, uFlags)

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

L_UINT uNumBalls;

number of balls

L_UINT uSize;

average ball size

L_UINT uSizeVariation;

ball size variation

L_INT nHighLightAng;

light source direction of the highlight on the ball

COLORREF crHighLight;

highlight color on the ball

COLORREF crBkgColor;

background color

COLORREF crShadingColor;

gradient color of the background

COLORREF *pBallColors;

pointer to an array of ball colors

L_UINT uNumOfBallColors;

size of the ball color array

L_UINT uAvrBallClrOpacity;

ball color opacity

L_UINT uBallClrOpacityVariation;

ball color opacity variation

L_UINT uRipple;

gradient frequency

L_UINT uFlags;

flags

This function adds colored balls to the bitmap. Various parameters control the color and appearance of the balls.

Parameter Description
pBitmap Pointer to the bitmap handle referencing the bitmap to be changed.
uNumBalls Number of balls that will be drawn in the image.
uSize Average ball size, in pixels.
uSizeVariation Ball size variation. Valid values range from 0 to 100. Use 0 to have all balls the same size. Use 100 to have the size vary from 0 to 2 X uSize.
nHighLightAng Light source direction of the highlight color on the ball. This value is in hundredths of degrees (+/-). A positive value will rotate the highlight color clockwise, while a negative value will rotate the highlight color counter-clockwise. Possible values range from 36000 to + 36000.
crHighLight Highlight color.
crBkgColor Background color.
crShadingColor Shade (or gradient) color.
pBallColors Pointer to an array of ball colors.
uNumOfBallColors The number of ball colors.
uAvrBallClrOpacity Average ball color opacity. Valid values range from 0 to 255 for 8-bit , 0 to 4095 for 12-bit and 0 to 65535 for 16-bit.
uBallClrOpacityVariation Ball color opacity variation. Valid values range from 0 to 100. Use 0 to have all pixels assigned the same opacity. Use 100 to have the opacity vary from 0 to 2 X uAvrBallClrOpacity.
uRipple The number of shades that are used to produce the background. This value is divided internally by 100. For example, if uRipple = 200 the actual frequency is 2. This value is ignored if the CLRBALLS_SHADING_SINGLE flag is set.
uFlags Flags that indicate which background color, shade (or gradient) type, ball type and ball color type to use. You can use a bit wise OR (|) to specify one flag from each group.

The following flags indicate how to draw the shading:

  Value Meaning
  CLRBALLS_SHADING_SINGLE [0x0001] Use only the background color (i.e. no shading).
  CLRBALLS_SHADING_LEFTRIGHT [0x0002] Draw shading as vertical lines that move from left to right.
  CLRBALLS_SHADING_TOPBOTTOM [0x0003] Draw shading as horizontal lines that move from top to bottom.
  CLRBALLS_SHADING_CIRCULAR [0x0004] Draw shading as concentric circles.
  CLRBALLS_SHADING_ELLIPTICAL [0x0005] Draw shading as concentric ellipses.
  The following flags indicate which type of ball to use:
  Value Meaning
  CLRBALLS_STICKER [0x0010] Use Balls that will overlap like stickers.
  CLRBALLS_BALL [0x0020] Use Balls that will adjust like bubbles.
  The following flags indicate how to treat the background:
  Value Meaning
  CLRBALLS_IMAGE [0x0100] Make the background the same as the image.
  CLRBALLS_COLOR [0x0200] Make the background using crBkgColor and crShadingColor with the specified shade type.
  The following flags indicate which type of ball coloring to use:
  Value Meaning
  CLRBALLS_BALLCLR_MASK [0x1000] Have the Ball color block image colors.
  CLRBALLS_ BALLCLR_OPACITY [0x2000] Use the opacity value when combining image colors with ball colors.

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.

The CLRBALLS_STICKER flag produces balls with more distinct edges than the CLRBALLS_BALL option.

For an example, click here

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

Win32, x64.

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_DryBitmap, L_FreePlaneBendBitmap, L_FreeRadBendBitmap, L_GlassEffectBitmap, L_GlowFilterBitmap, L_LensFlareBitmap, L_LightBitmap, L_OceanBitmap, L_PlaneBendBitmap, 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_DrawStarBitmap

Topics:

Raster Image Functions: Artistic Effects

 

Applying Artistic Effects

Example

The following example loads a bitmap, and applies the colored ball effect:

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
L_INT ColoredBallsBitmapExample(L_VOID) 
{ 
   L_INT nRet; 
   BITMAPHANDLE LeadBitmap; 
   COLORREF       pBallColors[7]; 
   pBallColors[0] = RGB(230,50,50); 
   pBallColors[1] = RGB(230,200,160); 
   pBallColors[2] = RGB(255,255,128); 
   pBallColors[3] = RGB(240,50,100); 
   pBallColors[4] = RGB(255,255,180); 
   pBallColors[5] = RGB(170,240,100); 
   pBallColors[6] = RGB(255,255,255); 
   /* Load the bitmap, keeping the bits per pixel of the file */ 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("cannon.jpg")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR,NULL,NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   /*Apply the effect*/ 
   nRet = L_ColoredBallsBitmap(&LeadBitmap, 1000, 25, 15, 31500, RGB(255,255,255), 
   RGB(255,0,0), RGB(255,255,0), pBallColors, 7, 64, 10, 100, 
   CLRBALLS_SHADING_CIRCULAR|CLRBALLS_STICKER| 
   CLRBALLS_IMAGE|CLRBALLS_BALLCLR_OPACITY); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); 
   if(nRet !=SUCCESS) 
      return nRet; 
   //free bitmap 
   if(LeadBitmap.Flags.Allocated) 
      L_FreeBitmap(&LeadBitmap); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help