Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_RomanMosaicBitmap
#include "l_bitmap.h"
L_LTIMGSFX_API L_INT L_RomanMosaicBitmap(pBitmap, uTileWidth, uTileHeight, uBorder, uShadowAngle, uShadowThresh, crColor, uFlags)
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
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 |
||
pBitmap |
Pointer to the bitmap handle that references the bitmap to which to apply the effect. |
||
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 arc-shaped 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
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.
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 L_MosaicBitmap 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 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_MosaicTilesBitmap 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 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.
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.
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
Example
Apply the Roman Mosaic effect using rectangular tiles, with gray shadows
L_INT RomanMosaicBitmapExample(L_VOID) { L_INT nRet; BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */ /* 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; nRet = L_RomanMosaicBitmap(&LeadBitmap, 15, 15, 5, SHADOW_E, 0, RGB(0,0,0), RMN_BOTH | RMN_SHADOWGRAY); 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; }