public class BricksTextureCommand : RasterCommand
Public Class BricksTextureCommand
Inherits RasterCommand
public ref class BricksTextureCommand : public RasterCommand
As an example, suppose you were to start with a gray image, like the following figure:
Now suppose you call the BricksTextureCommand command. The following settings apply to all of the following figures:
Parameter | Value |
OffsetX | 0 |
OffsetY | 0 |
RowDifference | 35 |
BricksWidth | 60 |
BricksHeight | 20 |
If you were to use the following additional settings:
Parameter | Value |
MortarRoughness | 0 |
MortarRoughnessEvenness | 0 |
BricksRoughness | 0 |
BricksRoughnessEvenness | 0 |
Flags | BricksTextureCommandFlags.SmoothedOutEdges |
The following figure results:
Note how smooth the surface of both the mortar and the bricks is. In the following figure, the only change from the previous settings is the value of BricksRoughness, which is set to 196:
In the following figure, BricksRoughness remains set to 196 and in addition, BricksRoughnessEvenness is set to 4:
The next two figures show the difference between the BricksTextureCommandFlags.SmoothedOutEdges flag and the BricksTextureCommandFlags.SmoothedInEdges flag. For these figures the following settings are used:
Parameter | Value |
MortarRoughness | 0 |
MortarRoughnessEvenness | 0 |
BricksRoughness | 250 |
BricksRoughnessEvenness | 0 |
EdgeWidth | 7 |
MortarWidth | 4 |
In the following figure the BricksTextureCommandFlags.SmoothedOutEdges flag is set:
In the following figure the BricksTextureCommandFlags.SmoothedInEdges flag is set:
This command supports 12-bit and 16-bit grayscale and 48-bit and 64-bit color images. Support for 12-bit and 16-bit grayscale and 48-bit and 64-bit color images is available only in the Document/Medical toolkits.
For more information Refer to Applying Artistic Effects.
Run the BricksTextureCommand on an empty gray image.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.SpecialEffects;
public void BricksCommandExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\\Image3.cmp"));
// Prepare the command
FillCommand cmd = new FillCommand(new RasterColor(128, 128, 128));
cmd.Run(image);
BricksTextureCommand command = new BricksTextureCommand();
command.BricksWidth = 60;
command.BricksHeight = 20;
command.OffsetX = 0;
command.OffsetY = 0;
command.EdgeWidth = 3;
command.MortarWidth = 4;
command.ShadeAngle = 315;
command.RowDifference = 33;
command.MortarRoughness = 20;
command.MortarRoughnessEvenness = 0;
command.BricksRoughness = 10;
command.BricksRoughnessEvenness = 0;
command.MortarColor = new RasterColor(0, 0, 0);
command.Flags = BricksTextureCommandFlags.SmoothedOutEdges | BricksTextureCommandFlags.TransparentMortar;
//Apply Bricks Texture on the 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:\LEADTOOLS21\Resources\Images";
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.SpecialEffects
Public Sub BricksCommandExample()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "ImageProcessingDemo\\Image3.cmp"))
' Prepare the command
Dim cmd As New FillCommand(New RasterColor(128, 128, 128))
cmd.Run(leadImage)
Dim command As BricksTextureCommand = New BricksTextureCommand
command.BricksWidth = 60
command.BricksHeight = 20
command.OffsetX = 0
command.OffsetY = 0
command.EdgeWidth = 3
command.MortarWidth = 4
command.ShadeAngle = 315
command.RowDifference = 33
command.MortarRoughness = 20
command.MortarRoughnessEvenness = 0
command.BricksRoughness = 10
command.BricksRoughnessEvenness = 0
command.MortarColor = New RasterColor(0, 0, 0)
command.Flags = BricksTextureCommandFlags.SmoothedOutEdges Or BricksTextureCommandFlags.TransparentMortar
'Apply Bricks Texture on the 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:\LEADTOOLS21\Resources\Images"
End Class
Leadtools.ImageProcessing.SpecialEffects Namespace
Leadtools.ImageProcessing.Effects.EmbossCommand
Leadtools.ImageProcessing.Color.ChangeHueSaturationIntensityCommand
ColoredPencilExtendedCommand Class
Leadtools.ImageProcessing.Color.ColorReplaceCommand
Leadtools.ImageProcessing.Color.ColorThresholdCommand
Leadtools.ImageProcessing.Core.DiscreteFourierTransformCommand
Leadtools.ImageProcessing.Effects.DirectionEdgeStatisticalCommand
Leadtools.ImageProcessing.Core.FastFourierTransformCommand
Leadtools.ImageProcessing.Core.FrequencyFilterCommand
Leadtools.ImageProcessing.Core.FrequencyFilterMaskCommand
Leadtools.ImageProcessing.Core.FourierTransformDisplayCommand
Leadtools.ImageProcessing.Effects.StatisticsInformationCommand
Leadtools.ImageProcessing.Effects.FeretsDiameterCommand
Leadtools.ImageProcessing.Effects.ObjectInformationCommand
Leadtools.ImageProcessing.Effects.RegionContourPointsCommand
Leadtools.ImageProcessing.Color.MathematicalFunctionCommand
Leadtools.ImageProcessing.Color.SegmentCommand
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document