图像处理高手请进-高分求带羽化功能的图像拷贝

YZUSUN 2006-08-13 09:47:03
希望拷贝是边缘是带羽化功能的。
...全文
141 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Knight94 2006-08-13
  • 打赏
  • 举报
回复
想到一个方法,可能不是最好的,处理起来比较麻烦。

1、首先,把拷贝过来的多边形临时存放到tmp1图像对象中,此图像的背景用白色先做铺底;
2、几乎用同样的方法,形成tmp2图像,只不过最后用alpha混合在多边形增加一个白边;
3、循环整个图,来对比每个像素,判断相同位置中在两个图像中的颜色是否相同,如果不同的话,用tmp2获得颜色的alpha值修改tmp1的颜色的alpha值。

对于2的做法可以如下:
GraphicsPath path = new GraphicsPath();
Point[] ptPolygon = new Point[]{ new Point(0,0),
new Point( 50,50 ),
new Point( 60, 70 ),
new Point( 20, 40 ) };

path.AddPolygon( ptPolygon );

// Use the path to construct a brush.
PathGradientBrush pthGrBrush = new PathGradientBrush(path);
// Set the color at the center of the path to blue.
pthGrBrush.CenterColor = Color.FromArgb(255, 255, 255, 255);
// Set the color along the entire boundary
// of the path to aqua.
Color[] colors = {Color.FromArgb(0, 255, 255, 255)};
pthGrBrush.SurroundColors = colors;

Pen pen = new Pen( pthGrBrush, 4 );//Set pen width here

//Add write edges on polygon
g.DrawPolygon( pen,
ptPolygon );

pen.Dispose();
pthGrBrush.Dispose();

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧