Visual Basic (Declaration) | |
---|---|
Public Class PuzzleEffectCommand Inherits Leadtools.ImageProcessing.RasterCommand Implements IRasterCommand |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As PuzzleEffectCommand |
C# | |
---|---|
public class PuzzleEffectCommand : Leadtools.ImageProcessing.RasterCommand, IRasterCommand |
C++/CLI | |
---|---|
public ref class PuzzleEffectCommand : public Leadtools.ImageProcessing.RasterCommand, IRasterCommand |
Run the Leadtools.ImageProcessing.SpecialEffects.PuzzleEffectCommand on an image.
Visual Basic | Copy Code |
---|---|
Public Sub PuzzleEffectCommandExample() 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 command As PuzzleEffectCommand = New PuzzleEffectCommand command.XBlock = 10 command.YBlock = 10 command.Randomize = 0 command.Flags = PuzzleEffectCommandFlags.Border Or PuzzleEffectCommandFlags.Shuffle Or PuzzleEffectCommandFlags.Count Or PuzzleEffectCommandFlags.Resize command.BorderColor = New RasterColor(0, 0, 0) ' Apply Puzzle Effect to this image. 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 |
C# | Copy Code |
---|---|
public void PuzzleEffectCommandExample() { // Load an image RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg")); // Prepare the command PuzzleEffectCommand command = new PuzzleEffectCommand(); command.XBlock = 10; command.YBlock = 10; command.Randomize = 0; command.Flags = PuzzleEffectCommandFlags.Border | PuzzleEffectCommandFlags.Shuffle | PuzzleEffectCommandFlags.Count | PuzzleEffectCommandFlags.Resize; command.BorderColor = new RasterColor(0,0,0); // Apply Puzzle Effect to this image. 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"; } |
- This command can process the whole image or a region of the image. If the image has a region, the effect is applied only to the region.
- Splits the image into a certain number of blocks according to the flags. If the PuzzleEffectCommandFlags.Size flag is set, then the image will be divided into blocks using the XBlock and YBlock properties (or the xblock and yblock parameters if you are using the appropriate Constructor) for the dimensions of the blocks. If the PuzzleEffectCommandFlags.Count flag is set, then the image will be divided into blocks using the xblock and ybBlock values for the number of blocks per row and number of blocks per column.
- If the PuzzleEffectCommandFlags.Resize flag is not set, the edge blocks might have a different size than the inner blocks. This means the edge blocks will be manipulated differently than the inner blocks. The inner blocks that have the same dimensions will be shuffled around. The right edge blocks will be shuffled together and the bottom edge blocks will be shuffled together.
- If the PuzzleEffectCommandFlags.Resize flag is set, the image will be resized to be sure that all blocks have the same dimensions. In this case, the edge blocks will not be treated differently than the inner blocks.
- If the PuzzleEffectCommandFlags.Border flag is set, borders will be drawn with the color set in the BorderColor property (or the borderColor parameter if you are using the appropriate Constructor). If the PuzzleEffectCommandFlags.Border flag is not set, no borders will be drawn.
- If the PuzzleEffectCommandFlags.Shuffle flag is not set, the blocks will appear in their original positions. If the PuzzleEffectCommandFlags.Shuffle flag is set then the blocks will appear randomized. The randomization process will be controlled by the Randomize property, or the randomize parameter if you are using the appropriate Constructor, as follows:
- If the randomize value is 0, the command will select the starting point for the randomize process. You will get a different result every time you call the command with the randomize value = 0.
- If the randomize value is greater than 0, the command will use this value as a starting point for the randomize process. You will get the same result every time you call the command with the same randomize value > 0.
- Edge blocks that have the same size as inner blocks might move into the middle of the resulting image. Edge blocks with a different size than inner blocks will remain on the edge.
- You must set the PuzzleEffectCommandFlags.Size flag or the Count flag (but not both) for the command to affect the image. If you set the flags to 0, the command leaves the image unchanged.
- This command supports all bits/pixel supported by LEADTOOLS.
- This command 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.
- This command does not support signed data images.
- This command does not support 32-bit grayscale images.
System.Object
Leadtools.ImageProcessing.RasterCommand
Leadtools.ImageProcessing.SpecialEffects.PuzzleEffectCommand
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7
Reference
PuzzleEffectCommand MembersLeadtools.ImageProcessing.SpecialEffects Namespace
Applying Artistic Effects
Leadtools.ImageProcessing.Effects.MosaicCommand
Leadtools.ImageProcessing.Effects.PicturizeListCommand
Leadtools.ImageProcessing.Effects.PicturizeSingleCommand
PixelateCommand Class
Leadtools.ImageProcessing.Effects.CubismCommand
DiceEffectCommand Class
RingEffectCommand Class
BricksTextureCommand Class
CanvasCommand Class
CloudsCommand Class
ColoredBallsCommand Class
DiffuseGlowCommand Class
Leadtools.ImageProcessing.Effects.DisplacementCommand
FragmentCommand Class
Leadtools.ImageProcessing.Core.HalfTonePatternCommand
Leadtools.ImageProcessing.Effects.MaskConvolutionCommand
MosaicTilesCommand Class
Leadtools.ImageProcessing.Effects.OffsetCommand
PerspectiveCommand Class
PlasmaCommand Class
PointillistCommand Class
RomanMosaicCommand Class
VignnetCommand Class
ZigZagCommand Class