3

WPF WriteableBitmap と理想的には BackBuffer を使用して単純な図形 (線とオプションで他の図形) を描画するメソッドを提供するライブラリを知っていますか? Silverlight 用の WriteableBitmapEx プロジェクトがあることは知っていますが、WPF に相当するものはありますか?

4

2 に答える 2

7

ここに私の質問への答えがあると思います:)

_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();
于 2010-06-08T19:46:46.217 に答える