Leadtools.ImageProcessing.SpecialEffects Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.11
BricksTextureCommand Class
See Also  Members   Example 
Leadtools.ImageProcessing.SpecialEffects Namespace : BricksTextureCommand Class




Creates a brick texture that makes the image look like it has been drawn on a brick wall. This command is available in the Raster Pro and above toolkits.

Syntax

Visual Basic (Declaration) 
Public Class BricksTextureCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As BricksTextureCommand
C# 
public class BricksTextureCommand : RasterCommand, IRasterCommand  
Managed Extensions for C++ 
public __gc class BricksTextureCommand : public RasterCommand, IRasterCommand  
C++/CLI 
public ref class BricksTextureCommand : public RasterCommand, IRasterCommand  

Example

Visual BasicCopy Code
ImageProcessing.SpecialEffects.BricksCommand
   Public Sub BricksCommandExample()
      RasterCodecs.Startup()
      Dim codecs As New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg")

      ' Prepare the command
      Dim cmd As New FillCommand(New RasterColor(Color.Gray))
      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(Color.Empty)
      command.Flags = BricksTextureCommandFlags.SmoothedOutEdges Or BricksTextureCommandFlags.TransparentMortar
      'Apply Bricks Texture on the Image.
      command.Run(leadImage)
      codecs.Save(leadImage, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24)

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.SpecialEffects.BricksCommand 
      public void BricksCommandExample() 
      { 
         // Load an image 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
 
         RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg"); 
 
         // 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, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

  • This command creates a brick-like texture. Edges that are in the angle of the light source are brightened and the others are darkened. Apply this texture to an image by using pimage as the source image. You can obtain the best result by applying this command on a medium brightness image.
  • Using the shading option of BricksTextureCommandFlags.SmoothedOutEdges results in bricks that have a more chiseled look than the same settings with a shading option of BricksTextureCommandFlags.SmoothedInEdges.
  • 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:
    ParameterValue
    OffsetX0
    OffsetY0
    RowDifference35
    BricksWidth60
    BricksHeight20
  • If you were to use the following additional settings:
    ParameterValue
    MortarRoughness0
    MortarRoughnessEvenness0
    BricksRoughness0
    BricksRoughnessEvenness0
    FlagsBricksTextureCommandFlags.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:
    ParameterValue
    MortarRoughness0
    MortarRoughnessEvenness0
    BricksRoughness250
    BricksRoughnessEvenness0
    EdgeWidth7
    MortarWidth4

    In the following figure the BricksTextureCommandFlags.SmoothedOutEdges flag is set:

    In the following figure the BricksTextureCommandFlags.SmoothedInEdges flag is set:
  • 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.
For more information Refer to Applying Artistic Effects.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.SpecialEffects.BricksTextureCommand

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