Home    PhotoController Online Documentation Prev Next
PhotoController
Welcome
Features
Installation
Release Notes
What's New
Requirements
Reference
Classes
Controller
Methods
Properties
FeatherBuilder
Methods
Properties
PhotoControllerException
Structure
Borders
Filters
Enumeration
AdjustType
AnchorType
CompressionType
FilterStyle
FeatherBackgroundStyle
FlipFlags
PhotoBorderStyle
PhotoFormat
Artical
Another Use with Feather
Effect with ColorAdjust
Effect with Filters
Effect with Borders
Feather Samples
Gif Compression Algorithm
Resize the uploaded image
Saving Comparison
Saving Gif
Why Using InterpolationMode
Work with ASP.NET
Write Customized Borders
License
Purchase
[Top]
PhotoController Component for .NET ImageComponent.NET Logo
Another Use with Feather


The new feature, Feather, is very powerful. It can also generate an effect that is similar to frame. Like the image below:

This image definitely is generated by PhotoController, you could try with PhotoGear. And you could also see the source code in there.

Here I am going to explain how to accomplish it.

[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);

 

 

 

2005-2007 © ImageComponent.NET. All rights reserved.

Valid HTML 4.01 Transitional