Pixelate method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int Pixelate(unsigned uCellWidth, unsigned uCellHeight, unsigned uOpacity, const TPoint &ptCenter, unsigned uFlags);

Delphi Syntax

Function Pixelate (uCellWidth: L_UINT; uCellHeight: L_UINT; uOpacity: L_UINT; ptCenter: TPoint; uFlags: L_UINT): L_INT;

Overview

Refer to Applying Artistic Effects

Remarks

(Raster Pro and above toolkits only) 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.

This method 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 ptCenter. 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.

 

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 ptCenter. That is, the circle around the ptCenter 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 ptCenter. That is, the circle around the ptCenter 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.

 

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.

 

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

image\CircularCellOrig.gif

The image below is the result of the following settings:

uFlags = PIX_RAD Or PIX_WPER Or PIX_HPER Or 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.

image\CircularCellPer.gif

The image below is the result of the following settings:

PIX_RAD Or PIX_WFRQ Or PIX_HFRQ Or 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.

image\CircularCellFrq.gif

This method 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 method.

See Also

Elements:

AddNoise method, Bending method, Emboss method, Mosaic method, MotionBlur method, Oilify method, Posterize method, RemoveRedeye method, Solarize method, Underlay method, Cylindrical method, FreeHandShear method, FreeHandWave method, Impressionist method, Polar method, Punch method, RadialBlur method, RadWave method, Ripple method, Spherize method, Swirl method, Wave method, Wind method, ZoomBlur method, ZoomWave method, AddWeightedBitmaps method, ShowPixelateDlg method.

Topics:

Raster Images: Artistic Effects

 

Raster Images: Where the Region Preempts the Bitmap