|
The Feather feature can be used in a creative way. With it, you can generate a good-looking frame. The following figure demonstrates the result of it.
To apply the above "frame" to your image, open the demo application, load an image, select menu - [Filter]->[Feather]->
[Frame with a Feather Way]. Then you will see.
Next is the source code of the above operation. Actually, the process is straightforward:
Controller pc = new Controller(pic.Image); FeatherBuilder builder = new FeatherBuilder(pic.Image.Width, pic.Image.Height); // tell builder to
use bitmap as background builder.BackgroundStyle = FeatherBackgroundStyle.UseBitmap; string currentfolder = Path.GetDirectoryName(Application.ExecutablePath); builder.LoadTileBitmap(currentfolder
+ "\\BackgroundTexture1.bmp"); // IMPORATNT // set band to be a
small value. // if you set this
too large, the picture will be feathered too much builder.Band = 2; // create a
rectangle that is 25 smaller than picture // the width 25
will be replaced by tile bitmap Rectangle rect = new Rectangle(25, 25, pic.Image.Width - 50,
pic.Image.Height - 50); builder.BuildRectangleMask(rect);
// this border
style might not be similar to a frame shadow, you could try others BorderBuilder borderBuilder = new BorderBuilder(); borderBuilder.Brush = new SolidBrush(Color.Gray); borderBuilder.Length = 27; // because the
feather background will occupy 25 width, the border width here must be larger
than 25 so that // it could be seen
and have a frame feeling // write border
firstly to have a shadow feeling pc.SetBorder(borderBuilder); // after writing a
border, then feather myself to have a similar frame feeling pic.Image = pc.Feather(builder);
|