WriteableBitmap.WritePixels メソッド

定義

書き込み可能なビットマップのピクセルを更新します。

オーバーロード

WritePixels(Int32Rect, Array, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

WritePixels(Int32Rect, IntPtr, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

WritePixels(Int32Rect, Array, Int32, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

WritePixels(Int32Rect, IntPtr, Int32, Int32, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

WritePixels(Int32Rect, Array, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

public:
 void WritePixels(System::Windows::Int32Rect sourceRect, Array ^ pixels, int stride, int offset);
[System.Security.SecurityCritical]
public void WritePixels (System.Windows.Int32Rect sourceRect, Array pixels, int stride, int offset);
public void WritePixels (System.Windows.Int32Rect sourceRect, Array pixels, int stride, int offset);
[<System.Security.SecurityCritical>]
member this.WritePixels : System.Windows.Int32Rect * Array * int * int -> unit
member this.WritePixels : System.Windows.Int32Rect * Array * int * int -> unit
Public Sub WritePixels (sourceRect As Int32Rect, pixels As Array, stride As Integer, offset As Integer)

パラメーター

sourceRect
Int32Rect

更新する WriteableBitmap の四角形。

pixels
Array

ビットマップの更新に使用するピクセル配列。

stride
Int32

pixels 内の更新領域のストライド。

offset
Int32

入力バッファーのオフセット。

属性

例外

次の条件の 1 つ以上が true であること。

sourceRectWriteableBitmap の境界の外側にあります。

stride< 1

offset< 0

pixelsnullです。

pixels のランクが 1 または 2 以外であるか、その長さが 0 未満です。

次のコード例は、 メソッドを使用してバック バッファー内のピクセルを更新する方法を WritePixels 示しています。

static void ErasePixel(MouseEventArgs e)
{
    byte[] ColorData = { 0, 0, 0, 0 }; // B G R

    Int32Rect rect = new Int32Rect(
            (int)(e.GetPosition(i).X), 
            (int)(e.GetPosition(i).Y), 
            1, 
            1);

    writeableBitmap.WritePixels( rect, ColorData, 4, 0);
}

注釈

WritePixels(Int32Rect, Array, Int32, Int32, Int32)オーバーロードと WritePixels(Int32Rect, IntPtr, Int32, Int32, Int32, Int32) オーバーロードは、このメソッドを使用するよりも優先されます。

注意

部分信頼では、 オーバーロードを使用します WritePixels(Int32Rect, Array, Int32, Int32, Int32)

適用対象

WritePixels(Int32Rect, IntPtr, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

public:
 void WritePixels(System::Windows::Int32Rect sourceRect, IntPtr buffer, int bufferSize, int stride);
[System.Security.SecurityCritical]
public void WritePixels (System.Windows.Int32Rect sourceRect, IntPtr buffer, int bufferSize, int stride);
public void WritePixels (System.Windows.Int32Rect sourceRect, IntPtr buffer, int bufferSize, int stride);
[<System.Security.SecurityCritical>]
member this.WritePixels : System.Windows.Int32Rect * nativeint * int * int -> unit
member this.WritePixels : System.Windows.Int32Rect * nativeint * int * int -> unit
Public Sub WritePixels (sourceRect As Int32Rect, buffer As IntPtr, bufferSize As Integer, stride As Integer)

パラメーター

sourceRect
Int32Rect

更新する WriteableBitmap の四角形。

buffer
IntPtr

nativeint

ビットマップの更新に使用する入力バッファー。

bufferSize
Int32

入力バッファーのサイズ。

stride
Int32

buffer 内の更新領域のストライド。

属性

例外

次の条件の 1 つ以上が true であること。

sourceRectWriteableBitmap の境界の外側にあります。

bufferSize< 1

stride< 1

buffernullです。

注釈

WritePixels(Int32Rect, Array, Int32, Int32, Int32)オーバーロードと WritePixels(Int32Rect, IntPtr, Int32, Int32, Int32, Int32) オーバーロードは、このメソッドを使用するよりも優先されます。

注意

部分信頼では、 オーバーロードを使用します WritePixels(Int32Rect, Array, Int32, Int32, Int32)

適用対象

WritePixels(Int32Rect, Array, Int32, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

public:
 void WritePixels(System::Windows::Int32Rect sourceRect, Array ^ sourceBuffer, int sourceBufferStride, int destinationX, int destinationY);
[System.Security.SecurityCritical]
public void WritePixels (System.Windows.Int32Rect sourceRect, Array sourceBuffer, int sourceBufferStride, int destinationX, int destinationY);
public void WritePixels (System.Windows.Int32Rect sourceRect, Array sourceBuffer, int sourceBufferStride, int destinationX, int destinationY);
[<System.Security.SecurityCritical>]
member this.WritePixels : System.Windows.Int32Rect * Array * int * int * int -> unit
member this.WritePixels : System.Windows.Int32Rect * Array * int * int * int -> unit
Public Sub WritePixels (sourceRect As Int32Rect, sourceBuffer As Array, sourceBufferStride As Integer, destinationX As Integer, destinationY As Integer)

パラメーター

sourceRect
Int32Rect

コピーする sourceBuffer 内の四角形。

sourceBuffer
Array

ビットマップの更新に使用する入力バッファー。

sourceBufferStride
Int32

入力バッファー内のストライド (バイト単位)。

destinationX
Int32

バック バッファー内の左端のピクセルの描画先の x 座標。

destinationY
Int32

バック バッファー内の上端のピクセルの描画先の y 座標。

属性

例外

次の条件の 1 つ以上が true であること。

sourceRectWriteableBitmap の境界の外側にあります。

destinationX または destinationYWriteableBitmap の境界の外側にあります。

sourceBufferStride< 1

sourceBuffernullです。

sourceBuffer のランクが 1 または 2 以外であるか、その長さが 0 未満です。

注釈

メソッドをWritePixels呼び出して、 のWriteableBitmapsourceBuffer内容を使用して を自動的に更新します。 このメソッドの呼び出しは、クラスの解説で説明されている および ワークフローを使用LockするのWriteableBitmapUnlock同じです。

注意

部分信頼でこのオーバーロードを使用します。

こちらもご覧ください

適用対象

WritePixels(Int32Rect, IntPtr, Int32, Int32, Int32, Int32)

ビットマップの指定した領域内のピクセルを更新します。

public:
 void WritePixels(System::Windows::Int32Rect sourceRect, IntPtr sourceBuffer, int sourceBufferSize, int sourceBufferStride, int destinationX, int destinationY);
[System.Security.SecurityCritical]
public void WritePixels (System.Windows.Int32Rect sourceRect, IntPtr sourceBuffer, int sourceBufferSize, int sourceBufferStride, int destinationX, int destinationY);
public void WritePixels (System.Windows.Int32Rect sourceRect, IntPtr sourceBuffer, int sourceBufferSize, int sourceBufferStride, int destinationX, int destinationY);
[<System.Security.SecurityCritical>]
member this.WritePixels : System.Windows.Int32Rect * nativeint * int * int * int * int -> unit
member this.WritePixels : System.Windows.Int32Rect * nativeint * int * int * int * int -> unit
Public Sub WritePixels (sourceRect As Int32Rect, sourceBuffer As IntPtr, sourceBufferSize As Integer, sourceBufferStride As Integer, destinationX As Integer, destinationY As Integer)

パラメーター

sourceRect
Int32Rect

コピーする sourceBuffer 内の四角形。

sourceBuffer
IntPtr

nativeint

ビットマップの更新に使用する入力バッファー。

sourceBufferSize
Int32

入力バッファーのサイズ。

sourceBufferStride
Int32

入力バッファー内のストライド (バイト単位)。

destinationX
Int32

バック バッファー内の左端のピクセルの描画先の x 座標。

destinationY
Int32

バック バッファー内の上端のピクセルの描画先の y 座標。

属性

例外

次の条件の 1 つ以上が true であること。

sourceRectWriteableBitmap の境界の外側にあります。

destinationX または destinationYWriteableBitmap の境界の外側にあります。

sourceBufferSize< 1

sourceBufferStride< 1

sourceBuffernullです。

注釈

メソッドをWritePixels呼び出して、 のWriteableBitmapsourceBuffer内容を使用して を自動的に更新します。 このメソッドの呼び出しは、クラスの解説で説明されている および ワークフローを使用LockするのWriteableBitmapUnlock同じです。

注意

部分信頼では、 オーバーロードを使用します WritePixels(Int32Rect, Array, Int32, Int32, Int32)

こちらもご覧ください

適用対象