# GrapeCity.Documents.Imaging.GcBitmap.-ctor

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*">GcBitmap Constructor
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor">GcBitmap()</h4>
<div class="markdown level1 summary"><p>Initializes an empty instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New()</code></pre>
</div>


<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_System_Int32_System_Int32_System_Boolean_System_Single_System_Single_System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor(System.Int32,System.Int32,System.Boolean,System.Single,System.Single,System.Boolean)">GcBitmap(int, int, bool, float, float, bool)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class and creates the image.</p>
<p>The image content is not initialized and can contain any random data.</p>
<p>If subsequent rendering is going to cover the whole surface of the
bitmap, or if <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.CreateGraphics.html#GrapeCity_Documents_Imaging_GcBitmap_CreateGraphics_System_Nullable_System_Drawing_Color__">CreateGraphics(Color?)</a> will be called on the bitmap with a non-null
background color, clearing it (which is a lengthy operation for large bitmaps) is not
needed. If some areas of the bitmap are going to be left untouched, they
must be cleared to avoid the possibility of random artifacts showing.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap(int pixelWidth, int pixelHeight, bool opaque, float dpiX = 96, float dpiY = 96, bool storeInTempFile = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(pixelWidth As Integer, pixelHeight As Integer, opaque As Boolean, Optional dpiX As Single = 96, Optional dpiY As Single = 96, Optional storeInTempFile As Boolean = False)</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">pixelWidth</span></td>
      <td><p>The width of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelHeight</span></td>
      <td><p>The height of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">opaque</span></td>
      <td><p>Indicates whether the alpha channel should be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiX</span></td>
      <td><p>The horizontal dpi of the image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiY</span></td>
      <td><p>The vertical dpi of the image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">storeInTempFile</span></td>
      <td><p>Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_System_UInt32___System_Int32_System_Int32_System_Boolean_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor(System.UInt32[],System.Int32,System.Int32,System.Boolean,System.Boolean,System.Single,System.Single)">GcBitmap(uint[], int, int, bool, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class and sets the existing pixel data to be read/modified in-place.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap(uint[] pixelData, int pixelWidth, int pixelHeight, bool opaque, bool premultiplied = false, float dpiX = 96, float dpiY = 96)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(pixelData As UInteger(), pixelWidth As Integer, pixelHeight As Integer, opaque As Boolean, Optional premultiplied As Boolean = False, Optional dpiX As Single = 96, Optional dpiY As Single = 96)</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.uint32">uint</a>[]</td>
      <td><span class="parametername">pixelData</span></td>
      <td><p>The pixel data to be attached to a <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelWidth</span></td>
      <td><p>The width of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelHeight</span></td>
      <td><p>The height of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">opaque</span></td>
      <td><p>Indicates whether the alpha channel should be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">premultiplied</span></td>
      <td><p>Indicates whether the color channels are premultiplied by the alpha channel.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiX</span></td>
      <td><p>The horizontal dpi of the image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiY</span></td>
      <td><p>The vertical dpi of the image.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_System_IntPtr_System_Int32_System_Int32_System_Boolean_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor(System.IntPtr,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Single,System.Single)">GcBitmap(IntPtr, int, int, bool, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class and sets the existing pixel data to be read/modified in-place.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap(IntPtr pixelData, int pixelWidth, int pixelHeight, bool opaque, bool premultiplied = false, float dpiX = 96, float dpiY = 96)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(pixelData As IntPtr, pixelWidth As Integer, pixelHeight As Integer, opaque As Boolean, Optional premultiplied As Boolean = False, Optional dpiX As Single = 96, Optional dpiY As Single = 96)</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.intptr">IntPtr</a></td>
      <td><span class="parametername">pixelData</span></td>
      <td><p>The pixel data to be attached to a <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelWidth</span></td>
      <td><p>The width of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelHeight</span></td>
      <td><p>The height of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">opaque</span></td>
      <td><p>Indicates whether the alpha channel should be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">premultiplied</span></td>
      <td><p>Indicates if the color channels are premultiplied by the alpha channel.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiX</span></td>
      <td><p>The horizontal dpi of the image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiY</span></td>
      <td><p>The vertical dpi of the image.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_System_IO_Stream_System_Int32_System_Nullable_System_Drawing_Rectangle__System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor(System.IO.Stream,System.Int32,System.Nullable{System.Drawing.Rectangle},System.Boolean)">GcBitmap(Stream, int, Rectangle?, bool)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap(Stream stream, int frameIndex = 0, Rectangle? imageRect = null, bool storeInTempFile = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(stream As Stream, Optional frameIndex As Integer = 0, Optional imageRect As Rectangle? = Nothing, Optional storeInTempFile As Boolean = False)</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.io.stream">Stream</a></td>
      <td><span class="parametername">stream</span></td>
      <td><p>The source stream. JPEG, PNG, WEBP, GIF, BMP, TIFF, ICO, JPEG 2000 formats are supported.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">frameIndex</span></td>
      <td><p>Index of an image frame to read, pass 0 for image formats not supporting multiple frames.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">storeInTempFile</span></td>
      <td><p>Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_System_String_System_Int32_System_Nullable_System_Drawing_Rectangle__System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor(System.String,System.Int32,System.Nullable{System.Drawing.Rectangle},System.Boolean)">GcBitmap(string, int, Rectangle?, bool)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap(string path, int frameIndex = 0, Rectangle? imageRect = null, bool storeInTempFile = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(path As String, Optional frameIndex As Integer = 0, Optional imageRect As Rectangle? = Nothing, Optional storeInTempFile As Boolean = False)</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.string">string</a></td>
      <td><span class="parametername">path</span></td>
      <td><p>The file path to the image. JPEG, PNG, WEBP, GIF, BMP, TIFF, ICO, JPEG 2000 formats are supported.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">frameIndex</span></td>
      <td><p>Index of an image frame to read, pass 0 for image formats not supporting multiple frames.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">storeInTempFile</span></td>
      <td><p>Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_System_Byte___System_Int32_System_Nullable_System_Drawing_Rectangle__System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor(System.Byte[],System.Int32,System.Nullable{System.Drawing.Rectangle},System.Boolean)">GcBitmap(byte[], int, Rectangle?, bool)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap(byte[] bytes, int frameIndex = 0, Rectangle? imageRect = null, bool storeInTempFile = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(bytes As Byte(), Optional frameIndex As Integer = 0, Optional imageRect As Rectangle? = Nothing, Optional storeInTempFile As Boolean = False)</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.byte">byte</a>[]</td>
      <td><span class="parametername">bytes</span></td>
      <td><p>The image data. JPEG, PNG, WEBP, GIF, BMP, TIFF, ICO, JPEG 2000 formats are supported.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">frameIndex</span></td>
      <td><p>Index of an image frame to read, pass 0 for image formats not supporting multiple frames.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">storeInTempFile</span></td>
      <td><p>Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap__ctor_GrapeCity_Documents_Drawing_Image_System_Nullable_System_Drawing_Rectangle__System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.#ctor(GrapeCity.Documents.Drawing.Image,System.Nullable{System.Drawing.Rectangle},System.Boolean)">GcBitmap(Image, Rectangle?, bool)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcBitmap(Image image, Rectangle? imageRect = null, bool storeInTempFile = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(image As Image, Optional imageRect As Rectangle? = Nothing, Optional storeInTempFile As Boolean = False)</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="GrapeCity.Documents.Drawing.Image.html">Image</a></td>
      <td><span class="parametername">image</span></td>
      <td><p><a class="xref" href="GrapeCity.Documents.Drawing.Image.html">Image</a> used as the source of image data.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">storeInTempFile</span></td>
      <td><p>Indicates whether pixel data should be dynamically mapped to a temporary file rather than kept fully in memory.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
