imageComponent.NET - image processing .NET assemblies
Write Watermark Text with Effects

CoolWatermark SDK provides an Effect structure, which defines the effect of the watermark text you want to use. The usage of it is very straightforward as the below code snippet shows:

VB.NET

   1:  Dim bitmap As New System.Drawing.Bitmap(320, 240)
   2:  Dim image As System.Drawing.Image = bitmap
   3:  Dim writer As New IC.CoolWatermark.Writer(image)
   4:  writer.PositionStyle = PositionStyle.MiddleCenter
   5:  writer.FontFamily = New FontFamily("Arial")
   6:  writer.FontSize = 48
   7:   
   8:  Dim effect As New IC.CoolWatermark.Effect()
   9:  effect.EffectStyle = EffectStyle.BlockTopLeft
  10:  effect.Distance = 5
  11:   
  12:  writer.Effect = effect
  13:   
  14:  image = writer.WriteText("Watermark")
  15:  writer.Dispose()

C#

   1:  Bitmap bitmap = new Bitmap(320, 240);
   2:  System.Drawing.Image image = bitmap;
   3:   
   4:  IC.CoolWatermark.Writer writer = new IC.CoolWatermark.Writer(image);
   5:  writer.PositionStyle = IC.CoolWatermark.PositionStyle.MiddleCenter;
   6:  writer.FontFamily = new FontFamily("Arial");
   7:  writer.FontSize = 48;
   8:   
   9:  IC.CoolWatermark.Effect effect = new IC.CoolWatermark.Effect();
  10:  effect.EffectStyle = IC.CoolWatermark.EffectStyle.BlockTopLeft;
  11:  effect.Distance = 5;
  12:   
  13:  writer.Effect = effect;
  14:   
  15:  image = writer.WriteText("Watermark");
  16:  writer.Dispose();

The above code will apply a top-left block effect to the text, which is similar to the following figure:

top-left block watermark text effect

If you want to use a different block color, you only need to specify the Colors property in the Writer. The default foreground color is black and background color is white.

There are some other effects you can use, for example:

bottom-right block watermark text effect

The above is a Bottom-Right block watermark text effect.

reflect watermark text effect

The above is a reflect watermark text effect.

title shadow watermark text effect

The above is a title shadow watermark text effect.

Halo Effect

Halo is an interesting effect. It looks like a light growing from the text edges. Halo effect doesn't work with Gradient brush and Border property. But it always have an alternative, we will talk about that later.

First, we will see some sample figures. I won't bother posting code here, which is the same to using other effects.

Halo watermark text effect

This uses a black foreground color and white background color.

Halo watermark text effect, similar to burning text

This uses #C0C0C0 foreground color and #FF8080 background color. It looks like a burning text, doesn't it?

Halo and squeeze watermark text

This sample demonstrates a squeeze and a halo watermark text.

Now you might wonder how to use Gradient brush to redner a text with halo effect. The trick is, you can render a text with halo effect first, then write the exact same text at the same position by using Gradient brush. It will look like the following:

Halo and gradient color watermark text
[Back to Top]
Comments

If you feel this page can be improved or has any mistake, please enter your valuable opinion here. Or if you cannot find the information you are after, feel free to suggest a subject too. I appreciate any voice.

Your Name:
  
Your Email Address:
  
Comments: