this 라이브러리를 사용하여 이미지를 흐리게하고 쓸 수 있습니다.
아마 다음과 같을 것이다 :
// Blit a bitmap using the additive blend mode at P1(10, 10)
writeableBmp.Blit(new Point(10, 10), bitmap, sourceRect, Colors.White, WriteableBitmapExtensions.BlendMode.Additive);
다른 방법으로는, 당신은 단지 this 유사한 직접 작성 (또는 코드 사람을 사용하여 다른 쓴) 수 :
private static Bitmap Blur(Bitmap image, Rectangle rectangle, Int32 blurSize)
{
Bitmap blurred = new Bitmap(image.Width, image.Height);
// make an exact copy of the bitmap provided
using(Graphics graphics = Graphics.FromImage(blurred))
graphics.DrawImage(image, new Rectangle(0, 0, image.Width, image.Height),
new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
// look at every pixel in the blur rectangle
for (Int32 xx = rectangle.X; xx < rectangle.X + rectangle.Width; xx++)
{
for (Int32 yy = rectangle.Y; yy < rectangle.Y + rectangle.Height; yy++)
{
Int32 avgR = 0, avgG = 0, avgB = 0;
Int32 blurPixelCount = 0;
// average the color of the red, green and blue for each pixel in the
// blur size while making sure you don't go outside the image bounds
for (Int32 x = xx; (x < xx + blurSize && x < image.Width); x++)
{
for (Int32 y = yy; (y < yy + blurSize && y < image.Height); y++)
{
Color pixel = blurred.GetPixel(x, y);
avgR += pixel.R;
avgG += pixel.G;
avgB += pixel.B;
blurPixelCount++;
}
}
avgR = avgR/blurPixelCount;
avgG = avgG/blurPixelCount;
avgB = avgB/blurPixelCount;
// now that we know the average for the blur size, set each pixel to that color
for (Int32 x = xx; x < xx + blurSize && x < image.Width && x < rectangle.Width; x++)
for (Int32 y = yy; y < yy + blurSize && y < image.Height && y < rectangle.Height; y++)
blurred.SetPixel(x, y, Color.FromArgb(avgR, avgG, avgB));
}
}
return blurred;
}
을 개인을 얻으려면 픽셀 두 번째 방법에 대한 참조 here :
BitmapImage iSrc
var array = new int[iSrc.PixelWidth * iSrc.PixelHeight]
var rect = new Int32Rect(0, 0, iSrc.PixelWidth, iSrc.PixelHeight)
iSrc.CopyPixels(rect, array, iSrc.PixelWidth * 4, 0)
'비트 맵 '을 가지고 있습니까? 전체 화면에서 60fps로 실행하면 어떤 성능이 있습니까? –
오 ... 애니메이션을하려고하십니까? 나는 DirectX 사용을 제안 할 것이다. 아마도 컨트롤을 사용하여 원하는 성능을 얻지 못할 것입니다. http://msdn.microsoft.com/en-us/library/windows/apps/br229580.aspx를 참조하십시오. – mydogisbox
아마 애니메이션을 적용 할 것입니다. 그렇지만 아마 DirectX를 사용하지 않고도 간단하게 처리 할 수 있습니다. 우리가 편안함을 느끼는 것보다 훨씬 더 많은 일이 필요하기 때문입니다. –