|
[C#]
angGoGo.PhotoController.Controller pc =
new Controller(pic.Image);
angGoGo.PhotoController.FeatherBuilder builder = new FeatherBuilder(pic.Image.Width,pic.Image.Height);
// tell builder to use bitmap as background
builder.BackgroundStyle = angGoGo.PhotoController.FeatherBackgroundStyle.UseBitmap;
string currentfolder = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
// because I use tile bitmap, I need to
call this function to load a tile bitmap. Otherwise, BuildXXXMask
method will throw exception
builder.LoadTileBitmap(currentfolder + "\\BackgroundTexture1.bmp");
// IMPORTANT
// 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
angGoGo.PhotoController.Borders border =
new Borders(PhotoBorderStyle.Customize);
border.Brush = new SolidBrush(Color.Gray);
// 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. Here I set 27, just
2 larger than 25
border.Length = 27;
// write border firstly to have a shadow
feeling
pc.SetBorder(border);
// after writing a border, then feather
myself to have a similar frame feeling
pic.Image = pc.Feather(builder);
|