Currently, I'm successfully using the Graphics
class to draw a non-rectangular clipped image (the turtle inside):
My code looks something like:
using (var g = Graphics.FromImage(image))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
using (var gfxPath = new GraphicsPath())
{
gfxPath.AddEllipse(r);
using (var region = new Region(r))
{
region.Exclude(gfxPath);
g.ExcludeClip(region);
g.DrawImage(turtleImage, r, r2, GraphicsUnit.Pixel);
}
}
}
This all works just as expected. What I do not know how to solve is to make the image border anti-aliased.
The image zoomed looks like:
I.e. the border where the image ends and the transparent "background" of the image starts is a rough cut, not a smooth alpha blending.
My question is:
Is it possible to clip a drawn image and having anti-aliasing active?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…