This commit is contained in:
2025-09-06 21:25:33 +08:00
parent f6dd232ef8
commit 878475acf8
108 changed files with 5919 additions and 4961 deletions
@@ -90,8 +90,7 @@
<p>This guide provides detailed implementation information for creating your own <code>RenderingCanvas</code> using the <a class="xref" href="../../../../../api/Hi.Disp.DispEngine.html">DispEngine</a>. By understanding these implementation details, you can customize the rendering component for specific application needs or create implementations for other UI frameworks.</p>
<div class="NOTE">
<h5>Note</h5>
<p><strong>For Windows Applications</strong>: If you are developing for Windows systems, it is recommended to directly use the existing <code>RenderingCanvas</code> implementations in the <code>Hi.WinForm</code> or <code>Hi.Wpf</code> packages, rather than creating your own. These implementations are fully tested, optimized, and maintained.
<strong>For Webapi Applications</strong>: Using <code>Hi.Webapi</code>.</p>
<p><strong>For Windows Applications</strong>: If you are developing for Windows systems, it is recommended to directly use the existing <code>RenderingCanvas</code> implementations in the <code>Hi.WinForm</code> or <code>Hi.Wpf</code> packages, rather than creating your own. These implementations are fully tested, optimized, and maintained.</p>
<p>The implementation details provided in this document are primarily for educational purposes or for developers who need to port RenderingCanvas to other platforms/frameworks.</p>
</div>
<h2 id="basic-dispengine-usage">Basic DispEngine Usage</h2>
@@ -458,8 +457,7 @@ public RenderingCanvas()
Content = DisplayerPane;
}
</code></pre><h3 id="rendering-pipeline-1">Rendering Pipeline</h3>
<pre><code class="lang-csharp" name="RenderingCanvas">private byte[] PreImageBgra { get; set; }
/// &lt;summary&gt;
<pre><code class="lang-csharp" name="RenderingCanvas">/// &lt;summary&gt;
/// Handles the buffer swapped event from DispEngine
/// &lt;/summary&gt;
private unsafe void RenderingCanvas_BufferSwapped(byte* data, int w, int h)
@@ -467,12 +465,7 @@ private unsafe void RenderingCanvas_BufferSwapped(byte* data, int w, int h)
if (data == null)
return;
//since the treatment is different from Razor version,
//the image checking mechanism cannot be set in DispEngine.
Span&lt;byte&gt; bgra = new Span&lt;byte&gt;(data, w * h * 4);
if (PreImageBgra != null &amp;&amp; bgra.SequenceEqual(PreImageBgra))
return;
PreImageBgra = bgra.ToArray();
// Copy pixel data from DispEngine
int n = w * h * 4;