#include "ltwrappr.h"
virtual L_INT LBitmap::Pixelate(uCellWidth, uCellHeight, uOpacity, CenterPt, uFlags)
L_UINT uCellWidth; |
cell width |
L_UINT uCellHeight; |
cell height |
L_UINT uOpacity; |
transparency percent |
POINT CenterPt; |
effect center |
L_UINT uFlags; |
flags |
Divides the bitmap into rectangular or circular cells and then recreates the image by filling those cells with the minimum, maximum, or average pixel value, depending upon the effect that was selected.
Parameter |
Description |
uCellWidth |
Value that represents the width of a rectangular cell, the number of rectangular cells present across the width of the bitmap, the number of cells around the center point of a circular cell, or the length in degrees of each cell around the center point of a circular cell, based on the flags set in uFlags. |
If uFlags contains: |
then, uCellWidth contains: |
and the range of possible values for uCellWidth is: |
PIX_RAD | PIX_WFRQ |
the number of cells around the CenterPt. That is, the circle around the CenterPt is divided into uCellWidth equal parts, as shown below:
|
1 to 360. The circle can be divided into anywhere from 1 to 360 equal parts. |
PIX_RAD | PIX_WPER |
the size, in degrees of the cells around the CenterPt. That is, the circle around the CenterPt is divided into cells of uCellWidth degrees, as shown below:
|
1 to 360. The circle can be divided into cells of 1 degree to 360 degrees. |
PIX_RECT | PIX_WFRQ |
the number of cells present across the width of the bitmap |
1 to the image width, if there is no region. If there is a region, then the range of values is just the region width. |
PIX_RECT | PIX_WPER |
the width of each rectangular cell, in pixels |
1 to the image width, if there is no region. If there is a region, then the range of values is just the region width. |
uCellHeight |
Value that represents the height of a rectangular cell, the number of rectangular cells present across the height of the bitmap, the number of cells along the radius of a circular cell, or the length of each cell along the radius of a circular cell, based on the flags set in uFlags. |
If uFlags contains: |
then, uCellHeight contains: |
and the range of possible values for uCellHeight is: |
PIX_RAD | PIX_HFRQ |
the number of cells present along the radius of the circular cell. |
1 to the diagonal of the image, if there is no region. If there is a region, then the range of values is just the diagonal of the region rectangle. |
PIX_RAD | PIX_HPER |
the radial length of each circular cell, in pixels |
1 to the diagonal of the image, if there is no region. If there is a region, then the range of values is just the diagonal of the region rectangle. |
PIX_RECT | PIX_HFRQ |
the number of cells present across the height of the bitmap |
1 to the image height, if there is no region. If there is a region, then the range of values is just the region height. |
PIX_RECT | PIX_HPER |
the height of each rectangular cell, in pixels |
1 to the image height, if there is no region. If there is a region, then the range of values is just the region height. |
uOpacity | Value that represents how transparent the cells are, compared to the original pixels. This is a percentage. Possible values are 0 100. (0 is total opacity and 100 is total transparency.) | |
CenterPt | Point that represents the center of revolution when circular cells are used. This parameter will be ignored if PIX_RECT is set in uFlags. | |
uFlags | Flags that indicate the values used to fill the cells, the shape of the cells, and what type of data is in the uCellWidth and uCellHeight parameters. You can use a bitwise OR (|) to specify one flag from each group. | |
The following are the flags indicate what values will be used to fill the cells: | ||
Value | Meaning | |
PIX_MAX | [0x0000] Fill the cell with its maximum pixel value. | |
PIX_MIN | [0x0001] Fill the cell with its minimum pixel value. | |
PIX_AVR | [0x0002] Fill the cell with its average pixel value. | |
The following are the flags that indicate the shape of the cells: | ||
Value | Meaning | |
PIX_RECT | [0x0000] Divide the image into rectangular cells. If this flag used, the uCellWidth value contains the cell width in pixels or the number of cells across the width of the bitmap. uCellHeight contains the cell height in pixels or the number of cells across the height of the bitmap. | |
PIX_RAD | [0x0010] Divide the image into circular cells, centered around CenterPt. If this flag is used, the uCellWidth value determines the angular component of the cell, and uCellHeight determines the radial component of the cell. Please note that PIX_RAD must be OR-ed with PIX_WPER or PIX_WFRQ | |
The following are the flags the indicate what information is contained in the uCellWidth and uCellHeight parameters: | ||
Value | Meaning | |
PIX_WFRQ | [0x0100] Indicates the number of cells along the width of the bitmap if rectangular cells are used. If circular cells are used, this indicates the number of cells present around the center of the circle. | |
PIX_WPER | [0x0200] Indicates the width, in pixels of a cell, if rectangular cells are used. If circular cells are used, this indicates the number of degrees in each cell around the center point. | |
PIX_HFRQ | [0x0400] Indicates the number of cells along the height of the bitmap if rectangular cells are used. If circular cells are used, this indicates the number of cells present along the radius of the circle. | |
PIX_HPER | [0x0800] Indicates the height, in pixels of a cell, if rectangular cells are used. If circular cells are used, this indicates the radial length of each cell along the radius. |
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
This function will divide the image into rectangular or circular cells.
The uFlags parameter indicates whether to use rectangular or circular cells and indicates the type of information in the other parameters.
If the image is divided into circular cells by setting PIX_RAD in the uFlags parameter, the cells will be centered around the specified CenterPt. This center point must be defined inside the bitmap or inside the region, if the bitmap has a region. If the bitmap has a region, the effect will be applied on the region only.
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 only in the Document/Medical toolkits.
An Example of circular cell division can be seen below:
This is the original image:
The image below is the result of the following settings:
uFlags = PIX_RAD | PIX_WPER | PIX_HPER | PIX_AVR
uCellWidth = 90, uCellHeight = 40
This indicates the circular cells are divided into 90 degree cell divisions and each cell has a radial length of 40 pixels. Each cell division is filled with the average value for that cell division.
The image below is the result of the following settings:
PIX_RAD|PIX_WFRQ|PIX_HFRQ|PIX_AVR
uCellWidth = 90, uCellHeight = 40
This indicates the circular cells are divided into 90 separate cell divisions around the center point and there are 40 cell divisions along the radius. Each cell division is filled with the average value for that cell division.
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. |
Win32, x64.
L_INT LBitmap__PixelateExample(LAnimationWindow * LAniWnd)
{
POINT CenterPt;
CenterPt.x = (LAniWnd->GetHandle())->Width/2;
CenterPt.y = (LAniWnd->GetHandle ())->Height/2;
return LAniWnd->Pixelate(5, 10, 100, CenterPt, PIX_AVR | PIX_RAD | PIX_WPER | PIX_HPER);
}
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