L_MosaicTilesBitmap

#include "l_bitmap.h"

L_LTIMGSFX_API L_INT L_MosaicTilesBitmap(pBitmap, pMosaicTilesInfo, uFlags)

pBITMAPHANDLE pBitmap;

/* pointer to the bitmap handle */

pMOSAICTILESINFO pMosaicTilesInfo;

/* mosaic tiles effect parameters */

L_UINT32 uFlags;

/* flags*/

Creates a mosaic effect on an image by dividing an image into rectangular or arc-shaped cells with irregular boundaries and modifying the color of each cell.

Parameter

Description

pBitmap

Pointer to the bitmap handle that references the bitmap to which to apply the effect.

pMosaicTilesInfo

Pointer to the MOSAICTILESINFO structure that contains information about the required effect.

uFlags

Reserved for future use. Must be 0.

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 makes an image look like a mosaic made from tiles. Tiles can be rectangular or arc-shaped, depending upon the coordinate system used to draw the tiles. The function's many parameters control factors like the border color, tile color, pen width, tile width and height, etc.

For an example, click here

Use the L_MosaicBitmap function to impose a mosaic effect on a bitmap by dividing the bitmap into square blocks of a specified size and changing the color of all pixels in each block to the average color of pixels within the block.

Use the L_PixelateBitmap function to divide the bitmap into rectangular or arc-shaped cells and then recreate the image by filling those cells with the minimum, maximum, or average pixel value, depending upon the effect that was selected.

Use the L_RomanMosaicBitmap function to divide the bitmap into rectangular or arc-shaped cells and then fill them with a color chosen randomly from the colors of the tiles pixels.

Use the L_PointillistBitmap function to convert image colors into randomly placed dots to create a pointillist painting, using a background color to fill the area between dots.

This function can process the whole image or a region of the image. If a bitmap has a region, the effect is applied only to the region.

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.

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_BendingBitmap, L_CylindricalBitmap, L_FreeHandShearBitmap, L_FreeHandWaveBitmap, L_ImpressionistBitmap, L_PolarBitmap, L_PunchBitmap, L_RadialBlurBitmap, L_RadWaveBitmap, L_RippleBitmap, L_SpherizeBitmap, 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_PixelateBitmap, L_PointillistBitmap, L_MosaicTilesBitmap, L_RomanMosaicBitmap, L_DiceEffectBitmap, L_PuzzleEffectBitmap, L_RingEffectBitmap, L_CanvasBitmap, L_BricksTextureBitmap, 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

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Processing an Image

 

Applying Artistic Effects

Example

#if defined (LEADTOOLS_V16_OR_LATER)
 L_INT MosaicTilesBitmapExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;      /* Bitmap handle for the image */
   MOSAICTILESINFO MosaicInfo;   /* Structure which stores the required parameters*/
   /* Load a bitmap at its own bits per pixel */
   nRet = L_LoadBitmap (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Image1.cmp"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL);
   if(nRet !=SUCCESS)
      return nRet;
   /*Fill the structure with the required parameters. The effect is applied using rectangular tiles with black border color*/
   MosaicInfo.uStructSize = sizeof(MOSAICTILESINFO);
   MosaicInfo.crBorderColor = RGB(0, 0, 0);
   MosaicInfo.crTilesColor = RGB(255, 255, 255);
   MosaicInfo.uFlags = MSCT_CART | MSCT_SHADOWGRAY;
   MosaicInfo.uTileHeight = LeadBitmap.Height/5;
   MosaicInfo.uTileWidth = LeadBitmap.Width/5;
   MosaicInfo.uOpacity = 50;
   MosaicInfo.uShadowThreshold = 0;
   MosaicInfo.uShadowAngle = SHADOW_SE;
   MosaicInfo.uPenWidth = 7;
      
   nRet = L_MosaicTilesBitmap(&LeadBitmap, &MosaicInfo, 0);
   if(nRet !=SUCCESS)
      return nRet;
   //free Bitmap
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);
   return SUCCESS;
}
#else
 L_INT MosaicTilesBitmapExample(L_VOID)
{
   L_INT nRet;
   BITMAPHANDLE LeadBitmap;      /* Bitmap handle for the image */
   MOSAICTILESINFO MosaicInfo;   /* Structure which stores the required parameters*/
   /* Load a bitmap at its own bits per pixel */
   nRet = L_LoadBitmap (TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Image1.cmp"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGRORGRAY, NULL, NULL);
   if(nRet !=SUCCESS)
      return nRet;
   /*Fill the structure with the required parameters. The effect is applied using rectangular tiles with black border color*/
   MosaicInfo.uStructSize = sizeof(MOSAICTILESINFO);
   MosaicInfo.crBorderColor = RGB(0, 0, 0);
   MosaicInfo.crTilesColor = RGB(255, 255, 255);
   MosaicInfo.uFlags = MSCT_CART | MSCT_SHADOWGRAY;
   MosaicInfo.uTileHeight = LeadBitmap.Height/5;
   MosaicInfo.uTileWidth = LeadBitmap.Width/5;
   MosaicInfo.uOpacity = 50;
   MosaicInfo.uShadowThreshold = 0;
   MosaicInfo.uShadowAngle = SHADOW_SE;
   MosaicInfo.uPenWidth = 7;
      
   nRet = L_MosaicTilesBitmap(&LeadBitmap, &MosaicInfo);
   if(nRet !=SUCCESS)
      return nRet;
   //free Bitmap
   if(LeadBitmap.Flags.Allocated)  
      L_FreeBitmap(&LeadBitmap);
   return SUCCESS;
}
#endif // LEADTOOLS_V16_OR_LATER