# C1.Util.DX.WIC.BitmapFrameEncode.WritePixels

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels*">WritePixels Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels*"></a>
<h4 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_System_Int32_C1_Util_DX_DataRectangle_System_Int32_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels(System.Int32,C1.Util.DX.DataRectangle,System.Int32)">WritePixels(int, DataRectangle, int)</h4>
<div class="markdown level1 summary"><p>Encodes the frame scanlines.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WritePixels(int lineCount, DataRectangle buffer, int totalSizeInBytes = 0)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WritePixels(lineCount As Integer, buffer As DataRectangle, Optional totalSizeInBytes As Integer = 0)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">lineCount</span></td>
      <td><dd>  <p>The number of lines to encode.</p> </dd>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DataRectangle.html">DataRectangle</a></td>
      <td><span class="parametername">buffer</span></td>
      <td><p>A data buffer containing the pixels to copy from.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">totalSizeInBytes</span></td>
      <td><p>Total size in bytes of pixels to write. If == 0, size is calculated with lineCount * rowStride.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_System_Int32_C1_Util_DX_DataRectangle_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Successive <strong>WritePixels</strong> calls are assumed to be sequential scanline access in the output image.</p>
</div>


<a id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels*"></a>
<h4 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_System_Int32_System_IntPtr_System_Int32_System_Int32_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels(System.Int32,System.IntPtr,System.Int32,System.Int32)">WritePixels(int, nint, int, int)</h4>
<div class="markdown level1 summary"><p>Encodes the frame scanlines.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WritePixels(int lineCount, nint buffer, int rowStride, int totalSizeInBytes = 0)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WritePixels(lineCount As Integer, buffer As IntPtr, rowStride As Integer, Optional totalSizeInBytes As Integer = 0)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">lineCount</span></td>
      <td><dd>  <p>The number of lines to encode.</p> </dd>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">nint</a></td>
      <td><span class="parametername">buffer</span></td>
      <td><p>A data buffer containing the pixels to copy from.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowStride</span></td>
      <td><p>The stride of one row.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">totalSizeInBytes</span></td>
      <td><p>Total size in bytes of pixels to write. If == 0, size is calculated with lineCount * rowStride.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_System_Int32_System_IntPtr_System_Int32_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Successive <strong>WritePixels</strong> calls are assumed to be sequential scanline access in the output image.</p>
</div>


<a id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels*"></a>
<h4 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels__1_System_Int32_System_Int32___0___" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels``1(System.Int32,System.Int32,``0[])">WritePixels&lt;T&gt;(int, int, T[])</h4>
<div class="markdown level1 summary"><p>Encodes the frame scanlines.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WritePixels&lt;T&gt;(int lineCount, int stride, T[] pixelBuffer) where T : struct</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WritePixels(Of T As Structure)(lineCount As Integer, stride As Integer, pixelBuffer As T())</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">lineCount</span></td>
      <td><dd>  <p>The number of lines to encode.</p> </dd>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">stride</span></td>
      <td><dd>  <p>The <em>stride</em> of the image pixels.</p> </dd>
</td>
    </tr>
    <tr>
      <td>T[]</td>
      <td><span class="parametername">pixelBuffer</span></td>
      <td><dd>  <p>A reference to the pixel buffer.</p> </dd>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels__1_System_Int32_System_Int32___0____remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>Successive <strong>WritePixels</strong> calls are assumed to be sequential scanline access in the output image.</p>
</div>


<a id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels*"></a>
<h4 id="C1_Util_DX_WIC_BitmapFrameEncode_WritePixels_System_Int32_System_Int32_System_Int32_System_IntPtr_" data-uid="C1.Util.DX.WIC.BitmapFrameEncode.WritePixels(System.Int32,System.Int32,System.Int32,System.IntPtr)">WritePixels(int, int, int, nint)</h4>
<div class="markdown level1 summary"><p>HRESULT IWICBitmapFrameEncode::WritePixels([In] unsigned int lineCount,[In] unsigned int cbStride,[In] unsigned int cbBufferSize,[In, Buffer] void* pbPixels)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void WritePixels(int lineCount, int stride, int bufferSize, nint pixelsRef)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub WritePixels(lineCount As Integer, stride As Integer, bufferSize As Integer, pixelsRef As IntPtr)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">lineCount</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">stride</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">bufferSize</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">nint</a></td>
      <td><span class="parametername">pixelsRef</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
