Leadtools.Windows.Media.Effects Send comments on this topic. | Back to Introduction - LEADTOOLS WPF | Help Version 16.5.9.25
BricksTextureCommandBitmapEffect Class
See Also  Members   Example 
Leadtools.Windows.Media.Effects.SpecialEffects Namespace : BricksTextureCommandBitmapEffect Class





Creates a brick texture that makes the image look like it has been drawn on a brick wall.

Syntax

Visual Basic (Declaration) 
Public Class BricksTextureCommandBitmapEffect 
   Inherits RasterCommandBitmapEffect
Visual Basic (Usage)Copy Code
Dim instance As BricksTextureCommandBitmapEffect
C# 
public class BricksTextureCommandBitmapEffect : RasterCommandBitmapEffect 
C++/CLI 
public ref class BricksTextureCommandBitmapEffect : public RasterCommandBitmapEffect 
XAML Property Element Usage 

BricksTextureCommandBitmapEffect ...

XAML Property Element Usage 

BricksTextureCommandBitmapEffect ...

Example

Visual BasicCopy Code
Public Sub BricksTextureCommandBitmapEffectExample(ByVal element As FrameworkElement)

   ' Initialize Effect
   Dim effect As BricksTextureCommandBitmapEffect = New BricksTextureCommandBitmapEffect()
   effect.OffsetX = 0
   effect.OffsetY = 0
   effect.EdgeWidth = 3
   effect.MortarWidth = 4
   effect.ShadeAngle = 315
   effect.RowDifference = 33
   effect.MortarRoughness = 20
   effect.MortarRoughnessEvenness = 0
   effect.BricksRoughness = 10
   effect.BricksRoughnessEvenness = 0
   effect.MortarColor = System.Windows.Media.Color.FromRgb(0, 0, 0)
   effect.Flags = BricksTextureCommandBitmapEffectsFlags.SmoothedOutEdges Or BricksTextureCommandBitmapEffectsFlags.TransparentMortar
   effect.BricksWidth = CInt(element.ActualWidth / 6)
   effect.BricksHeight = 5
   element.BitmapEffect = effect

   ' Initialize Animations
   Dim animation1 As Int32Animation = New Int32Animation()
   animation1.From = 1
   animation1.To = 20
   animation1.By = 1
   animation1.Duration = New Duration(TimeSpan.FromSeconds(5.0))
   animation1.AutoReverse = True
   animation1.RepeatBehavior = RepeatBehavior.Forever

   ' Initialize and run Storyboard
   Dim storyboard As Storyboard = New Storyboard()
   storyboard.SetTargetName(animation1, "AnimatedBitmapEffect")
   storyboard.SetTargetProperty(animation1, New PropertyPath(BricksTextureCommandBitmapEffect.BricksHeightProperty))
   element.RegisterName("AnimatedBitmapEffect", effect)
   storyboard.Children.Add(animation1)

   storyboard.Begin(element)
End Sub
C#Copy Code
public void BricksTextureCommandBitmapEffectExample(FrameworkElement element) 

 
   // Initialize Effect 
   BricksTextureCommandBitmapEffect effect = new BricksTextureCommandBitmapEffect(); 
 
   effect.OffsetX = 0; 
   effect.OffsetY = 0; 
   effect.EdgeWidth = 3; 
   effect.MortarWidth = 4; 
   effect.ShadeAngle = 315; 
   effect.RowDifference = 33; 
   effect.MortarRoughness = 20; 
   effect.MortarRoughnessEvenness = 0; 
   effect.BricksRoughness = 10; 
   effect.BricksRoughnessEvenness = 0; 
   effect.MortarColor = System.Windows.Media.Color.FromRgb(0, 0, 0); 
   effect.Flags = BricksTextureCommandBitmapEffectsFlags.SmoothedOutEdges | BricksTextureCommandBitmapEffectsFlags.TransparentMortar; 
 
   effect.BricksWidth = (int)element.ActualWidth / 6; 
   effect.BricksHeight = 5; 
   element.BitmapEffect = effect; 
 
   // Initialize Animations 
   Int32Animation animation1 = new Int32Animation(); 
   animation1.From = 1; 
   animation1.To = 20; 
   animation1.By = 1; 
   animation1.Duration = new Duration(TimeSpan.FromSeconds(5.0)); 
   animation1.AutoReverse = true; 
   animation1.RepeatBehavior = RepeatBehavior.Forever; 
 
   // Initialize and run Storyboard 
   Storyboard storyboard = new Storyboard(); 
   Storyboard.SetTargetName(animation1, "AnimatedBitmapEffect"); 
   Storyboard.SetTargetProperty(animation1, new PropertyPath(BricksTextureCommandBitmapEffect.BricksHeightProperty)); 
   element.RegisterName("AnimatedBitmapEffect", effect); 
   storyboard.Children.Add(animation1); 
 
   storyboard.Begin(element); 
}
XAMLCopy Code
<Page Title="CSAnimateEffect" Height="391" Width="300" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:lteffects="clr-namespace:Leadtools.Windows.Media.Effects.SpecialEffects;assembly=Leadtools.Windows.Media.Effects"> 
  <Grid> 
    <Image Margin="10,10,10,10" HorizontalAlignment="Center" VerticalAlignment="Center" Source="C:\Program Files\LEAD Technologies, Inc\LEADTOOLS 16\Images\slave.jpg"> 
      <Image.BitmapEffect> 
        <lteffects:BricksTextureCommandBitmapEffect x:Name="MyBitmapEffect" /> 
      </Image.BitmapEffect> 
      <Image.Triggers> 
        <EventTrigger RoutedEvent="Image.Loaded"> 
          <BeginStoryboard> 
            <Storyboard> 
              <Int32Animation Storyboard.TargetName="MyBitmapEffect" Storyboard.TargetProperty="BricksHeight" From="1" To="20" Duration="0:0:5" RepeatBehavior="Forever" AutoReverse="True" /> 
            </Storyboard> 
          </BeginStoryboard> 
        </EventTrigger> 
      </Image.Triggers> 
    </Image> 
  </Grid> 
</Page>

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 BricksTextureCommandBitmapEffectsFlags.SmoothedOutEdges results in bricks that have a more chiseled look than the same settings with a shading option of BricksTextureCommandBitmapEffectsFlags.SmoothedInEdges.
  • As an example, suppose you were to start with a gray image, like the following figure:

  • Now suppose you call the BricksTextureCommandBitmapEffect 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
    FlagsBricksTextureCommandBitmapEffectsFlags.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 BricksTextureCommandBitmapEffectsFlags.SmoothedOutEdges flag and the BricksTextureCommandBitmapEffectsFlags.SmoothedInEdges flag. For these figures the following settings are used:
    ParameterValue
    MortarRoughness0
    MortarRoughnessEvenness0
    BricksRoughness250
    BricksRoughnessEvenness0
    EdgeWidth7
    MortarWidth4

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

    In the following figure the BricksTextureCommandBitmapEffectsFlags.SmoothedInEdges flag is set:
  • This command does not support signed data images.

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Freezable
            System.Windows.Media.Animation.Animatable
               System.Windows.Media.Effects.BitmapEffect
                  Leadtools.Windows.Media.Effects.RasterCommandBitmapEffect
                     Leadtools.Windows.Media.Effects.SpecialEffects.BricksTextureCommandBitmapEffect

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Vista, Windows Server 2003 family, Windows Server 2008 family

See Also