LBitmap::MosaicTiles

#include "ltwrappr.h"

L_INT LBitmap::MosaicTiles(pMosaicTilesInfo, uFlags = 0)

pMOSAICTILESINFO pMosaicTilesInfo;

/* pointer to structure containing 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

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 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 LBitmap::Mosaic 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 LBitmap::Pixelate 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 LBitmap::RomanMosaic 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 LBitmap::Pointillist 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 only in the Document/Medical toolkits.

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

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 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:

LBitmap::AddNoise, LBitmap::Emboss, LBitmap::Mosaic, LBitmap::MotionBlur, LBitmap::Oilify, LBitmap::Posterize, LBitmap::RemoveRedeye, LBitmap::Solarize, LBitmapBase::Underlay, LBitmap::Bending, LBitmap::Cylindrical, LBitmap::FreeHandShear, LBitmap::FreeHandWave, LBitmap::Impressionist, LBitmap::Polar, LBitmap::Punch, LBitmap::RadialBlur, LBitmap::RadWave, LBitmap::Ripple, LBitmap::Spherize, LBitmap::Swirl, LBitmap::Wave, LBitmap::Wind, LBitmap::ZoomBlur, LBitmap::ZoomWave, LBitmap::BumpMap, LBitmap::Cubism, LBitmap::DrawStar, LBitmap::Dry, LBitmap::FreePlaneBend, LBitmap::FreeRadBend, LBitmap::GlassEffect, LBitmap::GlowFilter, LBitmap::LensFlare, LBitmap::Light, LBitmap::Ocean, LBitmap::PlaneBend, LBitmap::Plane, LBitmap::SampleTarget, LBitmap::Tunnel, LBitmap::Pixelate, LBitmap::Pointillist, LBitmap::RomanMosaic, LBitmap::DiceEffect, LBitmap::PuzzleEffect, LBitmap::RingEffect, LBitmap::Canvas, LBitmap::BricksTexture

Topics:

Raster Image Functions: Doing Geometric Transformations

 

Applying Artistic Effects

 

Raster Image Functions: Functions Where the Region Preempts the Bitmap

 

Raster Image Functions: Artistic Effects

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LBitmap__MosaicTilesExample(LBitmapWindow m_LBitmapWnd)
{
   L_INT nRet;
   MOSAICTILESINFO MosaicInfo;   /* Structure which store the required parameters*/
   LBitmap LeadBitmap;
   nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), 0,ORDER_BGR);
   if(nRet !=SUCCESS)
      return nRet;
   /*Fill the structures with the required parameters, the effect is applied using rectangular tiles,   with black border color*/
   memset(&MosaicInfo,0,sizeof(MOSAICTILESINFO));
   MosaicInfo.uStructSize = sizeof(MOSAICTILESINFO);
   MosaicInfo.crBorderColor = RGB(0, 0, 0);
   MosaicInfo.crTilesColor = RGB(255, 255, 255);
   MosaicInfo.uFlags = MSCT_CART | MSCT_SHADOWGRAY;
   MosaicInfo.uTileHeight = m_LBitmapWnd.GetHeight()/5;
   MosaicInfo.uTileWidth = m_LBitmapWnd.GetWidth()/5;
   MosaicInfo.uOpacity = 50;
   MosaicInfo.uShadowThreshold= 0;
   MosaicInfo.uPenWidth = 7;
   
   nRet =LeadBitmap.MosaicTiles(&MosaicInfo);
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}