LEADTOOLS Image Processing (Leadtools.ImageProcessing.SpecialEffects assembly)
LEAD Technologies, Inc

PerlinCommand Constructor(Int32,Int32,Int32,Int32,RasterColor,RasterColor,Int32,Int32,Int32,Int32,NoiseLayoutType)

Example 





Value that represents the initial seeding value for the pseudo-randomization process. Use 0 for automatic seeding. If other parameters are kept the same, each seed value always produces the same effect. Each seed value produces an effect different from all of the other seed values. Possible values are 0 or greater.
Value that represents the frequency component for both the x and y axis. Possible values range from 0 to 16. No noise is created if the value is 0. Increasing this value increases the noise.
Value that represents the number of iterations that will be calculated. Possible values range from 0 to 8. No noise is created if the value is 0. Increasing this value increases the detail in the noise, as well as computation time.
Value that represents the percentage to be used when combining the original image with the noise. Possible values range from 0 through 100. A value of 0 indicates that no noise is being used and a value of 100 represents a mix of noise and image.
The RasterColor value that represents the background color.
The RasterColor value that represents the Perlin noise color.
The x coordinate, in pixels and in image coordinates, for the center point of the concentric circles. Possible values range from 0 to the height of the image. This parameter is only used if the PF_Circle flag is set.
The y coordinate, in pixels and in image coordinates, for the center point of the concentric circles. Possible values range from 0 to the height of the image. This parameter is only used if the PF_Circle flag is set.
Value used to control the frequency of the circles or lines to be created for the noise image. Valid values range from 0 to 100. Increase this value to increase the number of circles or lines drawn.
Value that represents the density of the layout for the produced noise. Possible values range from 0 through 100. When using a low denLayout value, the noise will appear with light color.
Flags that indicate how to apply the effect, and which layout pattern to use for the noise.
Initializes a new PerlinCommand class object with explicit parameters. .NET support WinRT support
Syntax
public PerlinCommand( 
   int seed,
   int frequency,
   int iteration,
   int opacity,
   RasterColor backColor,
   RasterColor perlinColor,
   int xCircle,
   int yCircle,
   int freqLayout,
   int denLayout,
   NoiseLayoutType perlinFlags
)
'Declaration
 
Public Function New( _
   ByVal seed As Integer, _
   ByVal frequency As Integer, _
   ByVal iteration As Integer, _
   ByVal opacity As Integer, _
   ByVal backColor As RasterColor, _
   ByVal perlinColor As RasterColor, _
   ByVal xCircle As Integer, _
   ByVal yCircle As Integer, _
   ByVal freqLayout As Integer, _
   ByVal denLayout As Integer, _
   ByVal perlinFlags As NoiseLayoutType _
)
'Usage
 
Dim seed As Integer
Dim frequency As Integer
Dim iteration As Integer
Dim opacity As Integer
Dim backColor As RasterColor
Dim perlinColor As RasterColor
Dim xCircle As Integer
Dim yCircle As Integer
Dim freqLayout As Integer
Dim denLayout As Integer
Dim perlinFlags As NoiseLayoutType
 
Dim instance As New PerlinCommand(seed, frequency, iteration, opacity, backColor, perlinColor, xCircle, yCircle, freqLayout, denLayout, perlinFlags)
public PerlinCommand( 
   int seed,
   int frequency,
   int iteration,
   int opacity,
   RasterColor backColor,
   RasterColor perlinColor,
   int xCircle,
   int yCircle,
   int freqLayout,
   int denLayout,
   NoiseLayoutType perlinFlags
)
function PerlinCommand( 
   seed ,
   frequency ,
   iteration ,
   opacity ,
   backColor ,
   perlinColor ,
   xCircle ,
   yCircle ,
   freqLayout ,
   denLayout ,
   perlinFlags 
)
public:
PerlinCommand( 
   int seed,
   int frequency,
   int iteration,
   int opacity,
   RasterColor backColor,
   RasterColor perlinColor,
   int xCircle,
   int yCircle,
   int freqLayout,
   int denLayout,
   NoiseLayoutType perlinFlags
)

Parameters

seed
Value that represents the initial seeding value for the pseudo-randomization process. Use 0 for automatic seeding. If other parameters are kept the same, each seed value always produces the same effect. Each seed value produces an effect different from all of the other seed values. Possible values are 0 or greater.
frequency
Value that represents the frequency component for both the x and y axis. Possible values range from 0 to 16. No noise is created if the value is 0. Increasing this value increases the noise.
iteration
Value that represents the number of iterations that will be calculated. Possible values range from 0 to 8. No noise is created if the value is 0. Increasing this value increases the detail in the noise, as well as computation time.
opacity
Value that represents the percentage to be used when combining the original image with the noise. Possible values range from 0 through 100. A value of 0 indicates that no noise is being used and a value of 100 represents a mix of noise and image.
backColor
The RasterColor value that represents the background color.
perlinColor
The RasterColor value that represents the Perlin noise color.
xCircle
The x coordinate, in pixels and in image coordinates, for the center point of the concentric circles. Possible values range from 0 to the height of the image. This parameter is only used if the PF_Circle flag is set.
yCircle
The y coordinate, in pixels and in image coordinates, for the center point of the concentric circles. Possible values range from 0 to the height of the image. This parameter is only used if the PF_Circle flag is set.
freqLayout
Value used to control the frequency of the circles or lines to be created for the noise image. Valid values range from 0 to 100. Increase this value to increase the number of circles or lines drawn.
denLayout
Value that represents the density of the layout for the produced noise. Possible values range from 0 through 100. When using a low denLayout value, the noise will appear with light color.
perlinFlags
Flags that indicate how to apply the effect, and which layout pattern to use for the noise.
Example
 
Public Sub PerlinConstructorExample()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"))

   ' Prepare the command
   Dim backColor As New RasterColor(0, 0, 0)
   Dim perlinColor As New RasterColor(0, 255, 0)
   Dim command As New PerlinCommand(0, 16, 8, 75, backColor, perlinColor, CInt(leadImage.Width / 2), CInt(leadImage.Height / 2), 50, 1, NoiseLayoutType.PF_Combine Or NoiseLayoutType.PF_Circle)
   command.Run(leadImage)
   codecs.Save(leadImage, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24)

End Sub

Public NotInheritable Class LEAD_VARS
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
public void PerlinConstructorExample()
   {
      // Load an image
      RasterCodecs codecs = new RasterCodecs();
      codecs.ThrowExceptionsOnInvalidImages = true;

      RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"));

      // Prepare the command
      RasterColor backColor   = new RasterColor (0, 0, 0);
      RasterColor perlinColor = new RasterColor (0, 255, 0);
      PerlinCommand command = new PerlinCommand(0, 16, 8, 75, backColor, perlinColor, image.Width / 2, image.Height / 2, 50, 1, NoiseLayoutType.PF_Combine | NoiseLayoutType.PF_Circle);

      command.Run(image);
      codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24);

   }

static class LEAD_VARS
{
   public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
[TestMethod]
public async Task PerlinConstructorExample()
{
   // Load an image
   RasterCodecs codecs = new RasterCodecs();
   codecs.ThrowExceptionsOnInvalidImages = true;
   string srcFileName = @"Assets\Image1.cmp";
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));

   // Prepare the command
   RasterColor backColor   = RasterColorHelper.Create(0, 0, 0);
   RasterColor perlinColor = RasterColorHelper.Create(0, 255, 0);
   PerlinCommand command = new PerlinCommand(0, 16, 8, 75, backColor, perlinColor, image.Width / 2, image.Height / 2, 50, 1, NoiseLayoutType.PF_Combine | NoiseLayoutType.PF_Circle);

   command.Run(image);

   string destFileName = @"result.bmp";
   StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(destFileName);
   await codecs.SaveAsync(image, LeadStreamFactory.Create(saveFile), RasterImageFormat.Bmp, 24);
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

PerlinCommand Class
PerlinCommand Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.