adr*_*rin 3 wpf writeablebitmap
你知道任何库提供使用WPF WriteableBitmap和理想的BackBuffer绘制简单形状(线条和可选的其他形状)的方法吗?我知道有一个适用于Silverlight的WriteableBitmapEx项目,但WPF是否等效?
我猜这里是我的问题的答案:)
_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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6356 次 |
| 最近记录: |