Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.10.30
|
Leadtools.ImageProcessing.SpecialEffects Namespace > RingEffectCommand Class > RingEffectCommand Constructor : RingEffectCommand Constructor(LeadPoint,Int32,Int32,Int32,RasterColor,Int32,RingEffectCommandFlags) |
public RingEffectCommand( LeadPoint origin, int radius, int ringCount, int randomize, RasterColor color, int angle, RingEffectCommandFlags flags )
'Declaration Public Function New( _ ByVal origin As LeadPoint, _ ByVal radius As Integer, _ ByVal ringCount As Integer, _ ByVal randomize As Integer, _ ByVal color As RasterColor, _ ByVal angle As Integer, _ ByVal flags As RingEffectCommandFlags _ )
'Usage Dim origin As LeadPoint Dim radius As Integer Dim ringCount As Integer Dim randomize As Integer Dim color As RasterColor Dim angle As Integer Dim flags As RingEffectCommandFlags Dim instance As New RingEffectCommand(origin, radius, ringCount, randomize, color, angle, flags)
public RingEffectCommand( LeadPoint origin, int radius, int ringCount, int randomize, RasterColor color, int angle, RingEffectCommandFlags flags )
Run the RingEffectCommand on an image.
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.ImageProcessing.SpecialEffects <TestMethod()> _ Public Sub RingEffectConstructorExample() Dim codecs As New RasterCodecs() codecs.ThrowExceptionsOnInvalidImages = True Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\\Image2.jpg")) ' Prepare the command Dim origin As LeadPoint = New LeadPoint(CType((leadImage.Width \ 2), Integer), CType((leadImage.Height \ 2), Integer)) Dim command As RingEffectCommand = New RingEffectCommand(origin, origin.X, 10, 0, New RasterColor(0, 0, 0), 100, RingEffectCommandFlags.Color Or RingEffectCommandFlags.FixedAngle Or RingEffectCommandFlags.MaxRadius) ' Apply a ring effect to this image with origin (Origin). The maximum ring radius is equal to half of the image's width. Draw 10 rings, fill the undefined areas with the Black color and the shift angle is equal to 1 degrees. Note that _ 'you will have undefined areas only if the image width is greater than the image height. 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
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing.SpecialEffects; [TestMethod] public void RingEffectConstructorExample() { // Load an image RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image2.jpg")); // Prepare the command LeadPoint origin = new LeadPoint((image.Width / 2), (image.Height / 2)); RingEffectCommand command = new RingEffectCommand(origin, origin.X, 10, 0, new RasterColor(0,0,0), 100, RingEffectCommandFlags.Color | RingEffectCommandFlags.FixedAngle | RingEffectCommandFlags.MaxRadius); // Apply a ring effect to this image with origin (Origin). The maximum ring radius is equal to half of the image's width. Draw 10 rings, fill the undefined areas with the Black color and the shift angle is equal to 1 degrees. // Note that you will have undefined areas only if the image width is greater than the image height. 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"; }
using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing.SpecialEffects; [TestMethod] public async Task RingEffectConstructorExample() { // 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 LeadPoint origin = LeadPointHelper.Create((image.Width / 2), (image.Height / 2)); RingEffectCommand command = new RingEffectCommand(origin, origin.X, 10, 0, RasterColorHelper.Create(0,0,0), 100, RingEffectCommandFlags.Color | RingEffectCommandFlags.FixedAngle | RingEffectCommandFlags.MaxRadius); // Apply a ring effect to this image with origin (Origin). The maximum ring radius is equal to half of the image's width. Draw 10 rings, fill the undefined areas with the Black color and the shift angle is equal to 1 degrees. Note that you will have undefined areas only if the image width is greater than the image height. command.Run(image); string destFileName = @"result.bmp"; StorageFile saveFile = await Tools.AppLocalFolder.CreateFileAsync(destFileName); await codecs.SaveAsync(image, LeadStreamFactory.Create(saveFile), RasterImageFormat.Bmp, 24); }