#include "l_bitmap.h"
L_LTIMGSFX_API L_INT L_BricksTextureBitmap(pBitmap, uBricksWidth, uBricksHeight, uOffsetX, uOffsetY, uEdgeWidth, uMortarWidth, uShadeAngle, uRowDifference, uMortarRoughness, uMortarRoughnessEevenness, uBricksRoughness, uBricksRoughnessEevenness, crMortarColor, uFlags)
Creates a brick texture that makes the image look like it has been drawn on a brick wall.
Pointer to the bitmap handle that references the bitmap on which to apply the effect.
Flat area of the brick width, in pixels. Valid range is from 0 to the bitmap width.
Flat area of the brick height, in pixels. Valid range is from 0 to the bitmap height.
The X distance between the bitmap origin and the first brick origin, in pixels.
The Y distance between the bitmap origin and the first brick origin, in pixels.
Perceived edge width, in pixels, which represents the brick edge width when the brick is viewed from the perpendicular to the front of the brick. Minimum value is 1. See the following figure:
Mortar width, or the space between two adjacent bricks.
Angle, in degrees, that identifies from which side the light will hit the brick edges, resulting in a brightening of the opposite angle edges, and the darkening of the other edges. Valid range is from 0 to 360.
Horizontal distance between the first brick of the first row and the first brick on the next row, in pixels. Setting this value to zero will make a grid-like wall. Valid range is from 0 to bitmap width.
Mortar roughness. Valid range is from 0 to 300. At 0, the mortar looks completely smooth. Use higher values to increase the roughness.
Weathering factor for the mortar. Valid range is from 0 to 10. The higher the value the more weathered the mortar looks.
Brick roughness. Valid range is from 0 to 300. At 0, the brick looks completely smooth. Use higher values to increase the roughness of the brick surface.
Weathering factor for the bricks. Valid range is from 0 to 10. The higher the value the more weathered the bricks look.
The COLORREF value that specifies the mortar color. 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.
Flags that determine which type of brick edge to use, and which mortar style to use. You can specify no flags, one flag, or combine one flag from each group of flags by using a bitwise OR ( | ). Possible values are:
Value | Meaning |
---|---|
Type of shading to use on the brick edges: | |
BRICKS_SOLID | [0x0000] Use bricks with solid edges. |
BRICKS_SMOOTHEDOUT | [0x0001] Use bricks with edges that fade from in to out. |
BRICKS_SMOOTHEDIN | [0x0002] Use bricks with edges that fade from out to in. |
Type of mortar to use: | |
BRICKS_TRANSPARENTMORTAR | [0x0000] Use transparent mortar. |
BRICKS_COLOREDMORTAR | [0x0010] Use crMortarColor mortar. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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 creates a brick-like texture. Edges that are in the angle of the light source are brightened and the others are darkened. Apply this texture to a bitmap by using pBitmap
as the source image. You can obtain the best result by applying this function on a medium brightness image.
Using the shading option of BRICKS_SMOOTHEDOUT results in bricks that have a more chiseled look than the same settings with a shading option of BRICKS_SMOOTHEDIN.
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
Win32, x64.
L_INT BricksTextureBitmapExample(L_VOID)
{
L_INT nRet;
BITMAPHANDLE LeadBitmap; /* Bitmap handle for the image */
/* Load a bitmap at its own bits per pixel */
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), &LeadBitmap, sizeof (BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if(nRet !=SUCCESS)
return nRet;
/* Apply the Bricks Texture effect to the image*/
nRet = L_BricksTextureBitmap(&LeadBitmap, 60, 20, 0, 0, 3, 4, 315, 33, 20, 0, 10, 0, 0, BRICKS_SMOOTHEDOUT);
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 Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document