WPF WriteableBitmap 및 이상적인 BackBuffer를 사용하여 간단한 모양 (선 및 선택적으로 다른 모양)을 그리는 방법을 제공하는 라이브러리를 알고 계십니까? Silverlight 용 WriteableBitmapEx 프로젝트가 있지만 WPF와 동등한 프로젝트가 있습니까? 내가 여기 추측WPF WriteableBitmap.BackBuffer를 사용하여 선을 그립니다.
3
A
답변
7
당신은 비트 맵을 사용하지만, WriteableBitmap을 사용하여 솔루션을 요구하는 것으로 보인다 내 질문 :
_plotBitmap.Lock();
var b = new Bitmap(_plotBitmap.PixelWidth,
_plotBitmap.PixelHeight,
_plotBitmap.BackBufferStride,
System.Drawing.Imaging.PixelFormat.Format24bppRgb,
_plotBitmap.BackBuffer);
using(var bitmapGraphics = System.Drawing.Graphics.FromImage(b))
{
bitmapGraphics.SmoothingMode = SmoothingMode.HighSpeed;
bitmapGraphics.InterpolationMode = InterpolationMode.NearestNeighbor;
bitmapGraphics.CompositingMode = CompositingMode.SourceCopy;
bitmapGraphics.CompositingQuality = CompositingQuality.HighSpeed;
bitmapGraphics.DrawLine(Pens.Gold,2,2,222,222);
}
_plotBitmap.AddDirtyRect(new Int32Rect(0,0,_plotBitmap.PixelWidth,_plotBitmap.PixelHeight));
_plotBitmap.Unlock();
+4
명시 적으로 비트 맵을 Dispose()합니다. 이것이 바로 사용하기위한 것입니다. –
1
에 대한 대답입니다. WPF 용 WriteableBitmapEx가 있습니다.
+0
WriteableBitmapEx는 최적의 성능을 가지지 않으므로 텍스트를 그릴 수 없습니다. 필요한 경우 라인 전용 안티 앨리어싱 시스템이 있습니다. –
관련 항목 : [WriteableBitmap에 대한 DrawingContext를 얻는 방법] (http://stackoverflow.com/questions/88488/getting-a-drawingcontext-for-a-wpf-writeablebitmap) –