Leadtools.ImageProcessing.SpecialEffects Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
PixelateCommand Constructor(Int32,Int32,Int32,Point,PixelateCommandFlags)
See Also  Example
Leadtools.ImageProcessing.SpecialEffects Namespace > PixelateCommand Class > PixelateCommand Constructor : PixelateCommand Constructor(Int32,Int32,Int32,Point,PixelateCommandFlags)



cellWidth
Value that represents the width of a rectangular cell, the number of rectangular cells present across the width of the image, 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.

If these flags are set: Then, the CellWidth property (or the cellWidth parameter) contains: And the range of possible values is:
PixelateCommandFlags.Radial |
PixelateCommandFlags.WidthFrequency
the number of cells around the center point. That is, the circle around the center point is divided into equal parts, based on the value in the CellWidth property (or the cellWidth parameter if you are using the Constructor) as shown below:
1 to 360. The circle can be divided into anywhere from 1 to 360 equal parts.
PixelateCommandFlags.Radial |
PixelateCommandFlags.WidthPeriod
the size, in degrees of the cells around the center point That is, the circle around the center point is divided into cells based on the number of degrees set in the CellWidth property (or the cellWidth parameter if you are using the Constructor), as shown below:
1 to 360. The circle can be divided into cells of 1 degree to 360 degrees.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.WidthFrequency
the number of cells present across the width of the image. 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.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.WidthPeriod |
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.

cellHeight
Value that represents the height of a rectangular cell, the number of rectangular cells present across the height of the image, 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.
If the following flag is set: Then, the CellHeight property (or the cellHeight parameter if you are using the Constructor) contains: And the range of possible values is:
PixelateCommandFlags.Radial |
PixelateCommandFlags.HeightFrequency
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.
PixelateCommandFlags.Radial |
PixelateCommandFlags.HeightPeriod
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.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.HeightFrequency
the number of cells present across the height of the image. 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.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.HeightPeriod |
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.
opacity
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.)
centerPoint
Represents the center of revoLookupTableion when circular cells are used. This parameter will be ignored if the PixelateCommandFlags.Rectangle flag is set.
flags
Flags that indicate the values used to fill the cells, the shape of the cells, and what type of data is in the CellWidth and CellHeight properties.
Initializes a new PixelateCommand class object with explicit parameters.

Syntax

Visual Basic (Declaration)  
Public Function New( _
   ByVal cellWidth As Integer, _
   ByVal cellHeight As Integer, _
   ByVal opacity As Integer, _
   ByVal centerPoint As Point, _
   ByVal flags As PixelateCommandFlags _
)
Visual Basic (Usage) Copy Code
Dim cellWidth As Integer
Dim cellHeight As Integer
Dim opacity As Integer
Dim centerPoint As Point
Dim flags As PixelateCommandFlags
 
Dim instance As PixelateCommand(cellWidth, cellHeight, opacity, centerPoint, flags)
C#  
public PixelateCommand( 
   int cellWidth,
   int cellHeight,
   int opacity,
   Point centerPoint,
   PixelateCommandFlags flags
)
C++/CLI  
public:
PixelateCommand( 
   int cellWidth,
   int cellHeight,
   int opacity,
   Point centerPoint,
   PixelateCommandFlags flags
)

Parameters

cellWidth
Value that represents the width of a rectangular cell, the number of rectangular cells present across the width of the image, 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.

If these flags are set: Then, the CellWidth property (or the cellWidth parameter) contains: And the range of possible values is:
PixelateCommandFlags.Radial |
PixelateCommandFlags.WidthFrequency
the number of cells around the center point. That is, the circle around the center point is divided into equal parts, based on the value in the CellWidth property (or the cellWidth parameter if you are using the Constructor) as shown below:
1 to 360. The circle can be divided into anywhere from 1 to 360 equal parts.
PixelateCommandFlags.Radial |
PixelateCommandFlags.WidthPeriod
the size, in degrees of the cells around the center point That is, the circle around the center point is divided into cells based on the number of degrees set in the CellWidth property (or the cellWidth parameter if you are using the Constructor), as shown below:
1 to 360. The circle can be divided into cells of 1 degree to 360 degrees.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.WidthFrequency
the number of cells present across the width of the image. 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.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.WidthPeriod |
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.

cellHeight
Value that represents the height of a rectangular cell, the number of rectangular cells present across the height of the image, 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.
If the following flag is set: Then, the CellHeight property (or the cellHeight parameter if you are using the Constructor) contains: And the range of possible values is:
PixelateCommandFlags.Radial |
PixelateCommandFlags.HeightFrequency
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.
PixelateCommandFlags.Radial |
PixelateCommandFlags.HeightPeriod
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.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.HeightFrequency
the number of cells present across the height of the image. 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.
PixelateCommandFlags.Rectangle |
PixelateCommandFlags.HeightPeriod |
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.
opacity
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.)
centerPoint
Represents the center of revoLookupTableion when circular cells are used. This parameter will be ignored if the PixelateCommandFlags.Rectangle flag is set.
flags
Flags that indicate the values used to fill the cells, the shape of the cells, and what type of data is in the CellWidth and CellHeight properties.

Example

Run the PixelateCommand on an image. by dividing it into circular cells with angle length = 5, and radius = 10.

Visual Basic Copy Code
Public Sub PixelateConstructorExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")

   ' Prepare the command
   Dim command As PixelateCommand = New PixelateCommand(5, 10, 100, New Point(CType((leadImage.Width \ 2), Integer), CType((leadImage.Height \ 2), Integer)), PixelateCommandFlags.Radial Or PixelateCommandFlags.WidthPeriod Or PixelateCommandFlags.HeightPeriod Or PixelateCommandFlags.Average)
   command.Run(leadImage)
   codecs.Save(leadImage, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24)

   RasterCodecs.Shutdown()
End Sub
C# Copy Code
public void PixelateConstructorExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); 
 
   // Prepare the command 
   PixelateCommand command = new PixelateCommand(5, 10, 100, new Point((image.Width / 2), (image.Height / 2)), PixelateCommandFlags.Radial | PixelateCommandFlags.WidthPeriod | PixelateCommandFlags.HeightPeriod | PixelateCommandFlags.Average); 
   command.Run(image); 
   codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24); 
 
   RasterCodecs.Shutdown(); 
}

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also