LBitmap::RomanMosaic

#include "ltwrappr.h"

L_INT LBitmap::RomanMosaic(uTileWidth, uTileHeight, uBorder, uShadowAngle, uShadowThresh, crColor, uFlags)

L_UINT uTileWidth;

/* tile width */

L_UINT uTileHeight;

/* tile height */

L_UINT uBorder;

/* tile border */

L_UINT uShadowAngle;

/* shadow angle */

L_UINT uShadowThresh;

/* shadow threshold */

COLORREF crColor;

/* background color */

L_UINT uFlags;

/* flags */

Segments the image into rectangular or rounded rectangular tiles and fills them with a color chosen randomly from the colors of the tiles pixels.

Parameter

Description

uTileWidth

Value that indicates the width of the tile, in pixels. The meaning of the uTileWidth parameter differs according to the flags that are set in the uFlags member. Possible values are:

 

If uFlags contains

uTileWidth represents

Valid Range

 

RMN_RECT

The width of each rectangular tile, in pixels.

1 to the image width / 2, if there is no region. If there is a region, then the range of values is just the region width/2.

 

RMN_CIRC or

RMN_BOTH

The radial length of each rounded rectangular tile, in pixels

1 to the half of the diagonal of the image, if there is no region. If there is a region, then the range of values is just the half of the diagonal of the region rectangle.

uTileHeight

Value that indicates the height of the tile. The meaning of the uTileHeight parameter differs according to the flags that are set in the uFlags member. Possible values are:

 

If uFlags contains

uTileHeight represents

Valid Range

 

RMN_RECT or

RMN_BOTH

The height of each rectangular tile, in pixels.

1 to the image height / 2, if there is no region. If there is a region, then the range of values is just the region height/2.

 

RMN_CIRC

Will be ignored.

Will be ignored.

 

uBorder

Value that indicates the border width (space between the tiles), in pixels. The valid range is from 1 to 15.

uShadowAngle

Angle value indicating the direction of the light source that produces the shadow. This member can be used if the RMN_SHADOWRGB flag or the RMN_SHADOWGRAY flag is set. Possible values are:

 

Value

Meaning

 

SHADOW_E

[0x0000] East.

 

SHADOW_NE

[0x0001] Northeast.

 

SHADOW_N

[0x0002] North.

 

SHADOW_NW

[0x0003] Northwest.

 

SHADOW_W

[0x0004] West.

 

SHADOW_SW

[0x0005] Southwest.

 

SHADOW_S

[0x0006] South.

 

SHADOW_SE

[0x0007] Southeast.

uShadowThresh

Value that is used to determine which pixels will be affected by the shadow. Valid values range from 0 through 255. This member will be used if the MSCT_SHADOWRGB flag or the MSCT_SHADOWGRAY flag is set. Pixels with values above this threshold will be affected.

crColor

The COLORREF value that specifies the fill color to be used in between the tiles. You can specify a COLORREF value, such as the return value of the Windows RGB macro, or you can use the PALETTEINDEX macro to specify a palette color.

uFlags

Flags that indicate which type of tiles to draw, whether to apply shadows, and how to apply the shadows when shadowing is used. You can use a bit wise OR (|) to specify one flag from each group.

 

The following flags indicate which type of tiles to draw:

 

Value

Meaning

 

RMN_RECT

[0x0000] Draw rectangular tiles in a grid. When this flag is used uTileWidth contains the tile width in pixels, and uTileHeight contains the tile height in pixels.

 

RMN_CIRC

[0x0001] Draw rounded rectangular tiles in rings around the center of the bitmap. When this flag is used uTileWidth contains the radial component of the tile in pixels.

 

RMN_BOTH

[0x0002] Draw both rounded rectangular and rectangular tiles. Draw the largest circle that will fit inside the bitmap and fill that with rings of rounded rectangular tiles. Any part of the bitmap that is not covered by the rounded rectangular tiles gets covered with a grid of rectangular tiles.

 

The following flags indicate how to apply the shadow on the tiles, and whether to use shadowing:

 

Value

Meaning

 

RMN_FLAT

[0x0000] Do not apply shadows.

 

RMN_SHADOWRGB

[0x0010] Apply colored shadows.

 

RMN_SHADOWGRAY

[0x0020] Apply grayscale shadows.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function to divide the bitmap into rectangular or rounded rectangular tiles and then fill each tile with a color chosen randomly from the colors of each tiles pixels.

Use the LBitmap::Mosaic function to impose a mosaic effect on a bitmap by dividing the bitmap into tiles of a specified size and changing the color of all pixels in each tile to the average color of pixels within the tile.

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::MosaicTiles function to make 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.

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.

For an example, click here

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.

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::Pixelate, LBitmap::Impressionist, LBitmap::Polar, LBitmap::Punch, LBitmap::RadialBlur, LBitmap::RadWave, LBitmap::Ripple, 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::Spherize, LBitmap::MosaicTiles, LBitmap::Pointillist

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

L_INT LBitmap__RomanMosaicExample()
{
   L_INT nRet;
   LBitmap LeadBitmap;
   nRet =LeadBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE4.CMP"),  0,ORDER_BGR);
   if(nRet !=SUCCESS)
      return nRet;
   nRet =LeadBitmap.RomanMosaic(15, 15, 5, SHADOW_E, 0, RGB(0,0,0), RMN_RECT | RMN_SHADOWGRAY);
   if(nRet !=SUCCESS)
      return nRet;
   return SUCCESS;
}