| <!-- |
| Documentation/_templates/layout.html |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. The |
| ASF licenses this file to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance with the |
| License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| License for the specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en" > |
| <head> |
| <meta charset="utf-8"> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <title>NX Graphics Library (NXGL) — NuttX latest documentation</title> |
| |
| |
| |
| <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/sphinx_tabs/semantic-ui-2.4.1/segment.min.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/sphinx_tabs/semantic-ui-2.4.1/menu.min.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/sphinx_tabs/semantic-ui-2.4.1/tab.min.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/sphinx_tabs/tabs.css" type="text/css" /> |
| <link rel="stylesheet" href="../../_static/custom.css" type="text/css" /> |
| |
| |
| |
| <link rel="shortcut icon" href="../../_static/favicon.ico"/> |
| |
| |
| |
| |
| |
| <!--[if lt IE 9]> |
| <script src="../../_static/js/html5shiv.min.js"></script> |
| <![endif]--> |
| |
| |
| <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script> |
| <script src="../../_static/jquery.js"></script> |
| <script src="../../_static/underscore.js"></script> |
| <script src="../../_static/doctools.js"></script> |
| <script src="../../_static/language_data.js"></script> |
| |
| <script type="text/javascript" src="../../_static/js/theme.js"></script> |
| |
| |
| <link rel="index" title="Index" href="../../genindex.html" /> |
| <link rel="search" title="Search" href="../../search.html" /> |
| <link rel="next" title="NX" href="nx.html" /> |
| <link rel="prev" title="NX Graphics Subsystem" href="index.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| |
| |
| <div class="wy-grid-for-nav"> |
| |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| |
| <a href="../../index.html" class="icon icon-home"> NuttX |
| |
| |
| |
| |
| <img src="../../_static/NuttX.png" class="logo" alt="Logo"/> |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../../latest" selected="selected">latest</option> |
| |
| <option value="../../../10.0.0" >10.0.0</option> |
| |
| <option value="../../../10.0.1" >10.0.1</option> |
| |
| <option value="../../../10.1.0" >10.1.0</option> |
| |
| <option value="../../../10.2.0" >10.2.0</option> |
| |
| <option value="../../../10.3.0" >10.3.0</option> |
| |
| <option value="../../../11.0.0" >11.0.0</option> |
| |
| <option value="../../../12.0.0" >12.0.0</option> |
| |
| <option value="../../../12.1.0" >12.1.0</option> |
| |
| <option value="../../../12.2.0" >12.2.0</option> |
| |
| <option value="../../../12.2.1" >12.2.1</option> |
| |
| <option value="../../../12.3.0" >12.3.0</option> |
| |
| <option value="../../../12.4.0" >12.4.0</option> |
| |
| <option value="../../../12.5.0" >12.5.0</option> |
| |
| <option value="../../../12.5.1" >12.5.1</option> |
| |
| <option value="../../../12.6.0" >12.6.0</option> |
| |
| <option value="../../../12.7.0" >12.7.0</option> |
| |
| <option value="../../../12.8.0" >12.8.0</option> |
| |
| <option value="../../../12.9.0" >12.9.0</option> |
| |
| <option value="../../../12.10.0" >12.10.0</option> |
| |
| <option value="../../../12.11.0" >12.11.0</option> |
| |
| </select> |
| </div> |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| </div> |
| |
| |
| <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
| |
| |
| |
| |
| |
| |
| <p class="caption"><span class="caption-text">Table of Contents</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../index.html">Home</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../introduction/index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../quickstart/index.html">Getting Started</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../index.html">OS Components</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../nsh/index.html">NuttShell (NSH)</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../power.html">Power Management</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../socketcan.html">SocketCAN Device Drivers</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../syslog.html">SYSLOG</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../binfmt.html">Binary Loader</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../drivers/index.html">Device Drivers</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../filesystem.html">NuttX File System</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxflat.html">NXFLAT</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="index.html">NX Graphics Subsystem</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="index.html#objectives">Objectives</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="index.html#organization">Organization</a></li> |
| <li class="toctree-l3 current"><a class="reference internal" href="index.html#nx-header-files">NX Header Files</a><ul class="current"> |
| <li class="toctree-l4 current"><a class="current reference internal" href="#">NX Graphics Library (<code class="docutils literal notranslate"><span class="pre">NXGL</span></code>)</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="nx.html">NX</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="nxtk.html">NX Tool Kit (<code class="docutils literal notranslate"><span class="pre">NXTK</span></code>)</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="nxfonts.html">NX Fonts Support (<code class="docutils literal notranslate"><span class="pre">NXFONTS</span></code>)</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="nxcursor.html">NX Cursor Support (<code class="docutils literal notranslate"><span class="pre">NXCURSOR</span></code>)</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="sample.html">Sample Code</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="appendix.html">Appendix</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../nxwidgets.html">NxWidgets</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../paging.html">On-Demand Paging</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../applications/index.html">Applications</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../boards/index.html">Supported Boards</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../reference/index.html">API Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../guides/index.html">Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../releases/index.html">Releases</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../contributing/index.html">Contributing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li> |
| </ul> |
| |
| |
| |
| </div> |
| |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
| |
| |
| <nav class="wy-nav-top" aria-label="top navigation"> |
| |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../../index.html">NuttX</a> |
| |
| </nav> |
| |
| |
| <div class="wy-nav-content"> |
| |
| <div class="rst-content"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <div role="navigation" aria-label="breadcrumbs navigation"> |
| |
| <ul class="wy-breadcrumbs"> |
| |
| <li><a href="../../index.html" class="icon icon-home"></a> »</li> |
| |
| <li><a href="../index.html">OS Components</a> »</li> |
| |
| <li><a href="index.html">NX Graphics Subsystem</a> »</li> |
| |
| <li>NX Graphics Library (<code class="docutils literal notranslate"><span class="pre">NXGL</span></code>)</li> |
| |
| |
| <li class="wy-breadcrumbs-aside"> |
| |
| |
| <a href="../../_sources/components/nxgraphics/nxgl.rst.txt" rel="nofollow"> View page source</a> |
| |
| |
| </li> |
| |
| </ul> |
| |
| |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <div class="section" id="nx-graphics-library-nxgl"> |
| <span id="nx-graphics-library-nxgl-1"></span><h1>NX Graphics Library (<code class="docutils literal notranslate"><span class="pre">NXGL</span></code>)<a class="headerlink" href="#nx-graphics-library-nxgl" title="Permalink to this headline">¶</a></h1> |
| <p>NXGL provides many APIs, some available for use internally by NX and |
| others for use by applications as well. Only those APIs intended for |
| application usage are documented here See <code class="docutils literal notranslate"><span class="pre">include/nuttx/nx/nxglib.h</span></code> |
| for the full set of APIs; those APIs might be of interest if you are |
| rendering directly into framebuffer or LCD memory.</p> |
| <div class="section" id="nxgl-types"> |
| <h2>NXGL Types<a class="headerlink" href="#nxgl-types" title="Permalink to this headline">¶</a></h2> |
| <dl class="c type"> |
| <dt id="c.nxgl_mxpixel_t"> |
| <em class="property">type </em><code class="sig-name descname">nxgl_mxpixel_t</code><a class="headerlink" href="#c.nxgl_mxpixel_t" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Holds one device pixel. NXGLIB will select the |
| smallest size for the <code class="docutils literal notranslate"><span class="pre">nxgl_mxpixel_t</span></code> that just contains the pixel: |
| <code class="docutils literal notranslate"><span class="pre">byte</span></code> if 16, 24, and 32 resolution support is disabled, <code class="docutils literal notranslate"><span class="pre">uint16_t</span></code> |
| if 24, and 32 resolution support is disabled, or <code class="docutils literal notranslate"><span class="pre">uint32_t</span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c type"> |
| <dt id="c.nxgl_coord_t"> |
| <em class="property">type </em><code class="sig-name descname">nxgl_coord_t</code><a class="headerlink" href="#c.nxgl_coord_t" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>A given coordinate is limited to the screen height an |
| width. If either of those values exceed 32,767 pixels, then the |
| following will have to need to change:</p> |
| </dd></dl> |
| |
| <dl class="c struct"> |
| <dt id="c.nxgl_point_s"> |
| <em class="property">struct </em><code class="sig-name descname">nxgl_point_s</code><a class="headerlink" href="#c.nxgl_point_s" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Describes a point on the display:</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">nxgl_point_s</span> |
| <span class="p">{</span> |
| <span class="n">nxgl_coord_t</span> <span class="n">x</span><span class="p">;</span> <span class="cm">/* X position, range: 0 to screen width - 1 */</span> |
| <span class="n">nxgl_coord_t</span> <span class="n">y</span><span class="p">;</span> <span class="cm">/* Y position, range: 0 to screen height - 1 */</span> |
| <span class="p">};</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="c struct"> |
| <dt id="c.nxgl_size_s"> |
| <em class="property">struct </em><code class="sig-name descname">nxgl_size_s</code><a class="headerlink" href="#c.nxgl_size_s" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Describes the size of a rectangular region.</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">nxgl_size_s</span> |
| <span class="p">{</span> |
| <span class="n">nxgl_coord_t</span> <span class="n">w</span><span class="p">;</span> <span class="cm">/* Width in pixels */</span> |
| <span class="n">nxgl_coord_t</span> <span class="n">h</span><span class="p">;</span> <span class="cm">/* Height in rows */</span> |
| <span class="p">};</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="c struct"> |
| <dt id="c.nxgl_rect_s"> |
| <em class="property">struct </em><code class="sig-name descname">nxgl_rect_s</code><a class="headerlink" href="#c.nxgl_rect_s" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Describes a positioned rectangle on the display.</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">nxgl_rect_s</span> |
| <span class="p">{</span> |
| <span class="k">struct</span> <span class="n">nxgl_point_s</span> <span class="n">pt1</span><span class="p">;</span> <span class="cm">/* Upper, left-hand corner */</span> |
| <span class="k">struct</span> <span class="n">nxgl_point_s</span> <span class="n">pt2</span><span class="p">;</span> <span class="cm">/* Lower, right-hand corner */</span> |
| <span class="p">};</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="c struct"> |
| <dt id="c.nxgl_run_s"> |
| <em class="property">struct </em><code class="sig-name descname">nxgl_run_s</code><a class="headerlink" href="#c.nxgl_run_s" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Describes a run, i.e., a horizontal line. Note |
| that the start/end positions have fractional precision. This is |
| necessary for good joining of trapezoids when a more complex shape is |
| decomposed into trapezoids.</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">nxgl_run_s</span> |
| <span class="p">{</span> |
| <span class="n">b16_t</span> <span class="n">x1</span><span class="p">;</span> <span class="cm">/* Left X position, range: 0 to x2 */</span> |
| <span class="n">b16_t</span> <span class="n">x2</span><span class="p">;</span> <span class="cm">/* Right X position, range: x1 to screen width - 1 */</span> |
| <span class="n">nxgl_coord_t</span> <span class="n">y</span><span class="p">;</span> <span class="cm">/* Top Y position, range: 0 to screen height - 1 */</span> |
| <span class="p">};</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="c struct"> |
| <dt id="c.nxgl_trapezoid_s"> |
| <em class="property">struct </em><code class="sig-name descname">nxgl_trapezoid_s</code><a class="headerlink" href="#c.nxgl_trapezoid_s" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Describes a horizontal trapezoid on the |
| display in terms the run at the top of the trapezoid and the run at the |
| bottom.</p> |
| <div class="highlight-c notranslate"><div class="highlight"><pre><span></span><span class="k">struct</span> <span class="n">nxgl_trapezoid_s</span> |
| <span class="p">{</span> |
| <span class="k">struct</span> <span class="n">nxgl_run_s</span> <span class="n">top</span><span class="p">;</span> <span class="cm">/* Top run */</span> |
| <span class="k">struct</span> <span class="n">nxgl_run_s</span> <span class="n">bot</span><span class="p">;</span> <span class="cm">/* bottom run */</span> |
| <span class="p">};</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rgb2yuv"> |
| void <code class="sig-name descname">nxgl_rgb2yuv</code><span class="sig-paren">(</span>uint8_t <em>r</em>, uint8_t <em>g</em>, uint8_t <em>b</em>, uint8_t *<em>y</em>, uint8_t *<em>u</em>, uint8_t *<em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#c.nxgl_rgb2yuv" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Convert 8-bit RGB triplet to 8-bit YUV triplet.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_yuv2rgb"> |
| void <code class="sig-name descname">nxgl_yuv2rgb</code><span class="sig-paren">(</span>uint8_t <em>y</em>, uint8_t <em>u</em>, uint8_t <em>v</em>, uint8_t *<em>r</em>, uint8_t *<em>g</em>, uint8_t *<em>b</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_yuv2rgb" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Convert 8-bit YUV triplet to 8-bit RGB triplet.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rectcopy"> |
| void <code class="sig-name descname">nxgl_rectcopy</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>src</em><span class="sig-paren">)</span><a class="headerlink" href="#c.nxgl_rectcopy" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This is essentially <code class="docutils literal notranslate"><span class="pre">memcpy()</span></code>for rectangles. We |
| don’t do structure assignments because some compilers are not good at |
| that.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rectoffset"> |
| void <code class="sig-name descname">nxgl_rectoffset</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>src</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>dx</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>dy</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_rectoffset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Offset the rectangle position by the specified dx, dy |
| values.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_vectoradd"> |
| void <code class="sig-name descname">nxgl_vectoradd</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>v1</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>v2</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_vectoradd" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Add two 2x1 vectors and save the result to a third.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_vectsubtract"> |
| void <code class="sig-name descname">nxgl_vectsubtract</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>v1</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>v2</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_vectsubtract" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Add subtract vector <code class="docutils literal notranslate"><span class="pre">v2</span></code> from vector <code class="docutils literal notranslate"><span class="pre">v1</span></code> and |
| return the result in vector dest.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rectintersect"> |
| void <code class="sig-name descname">nxgl_rectintersect</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>src1</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>src2</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_rectintersect" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Return the rectangle representing the intersection of |
| the two rectangles.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rectunion"> |
| void <code class="sig-name descname">nxgl_rectunion</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>src1</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>src2</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_rectunion" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Given two rectangles, <code class="docutils literal notranslate"><span class="pre">src1</span></code> and <code class="docutils literal notranslate"><span class="pre">src2</span></code>, return the |
| larger rectangle that contains both, <code class="docutils literal notranslate"><span class="pre">dest</span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_nonintersecting"> |
| void <code class="sig-name descname">nxgl_nonintersecting</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> <em>result</em>[4], FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect1</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect2</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_nonintersecting" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Return the regions of rectangle <code class="docutils literal notranslate"><span class="pre">rect1</span></code> that do not |
| intersect with <code class="docutils literal notranslate"><span class="pre">rect2</span></code>. This will four rectangles, some of which may |
| be degenerate (and can be picked off with <a class="reference internal" href="#c.nxgl_nullrect" title="nxgl_nullrect"><code class="xref c c-func docutils literal notranslate"><span class="pre">nxgl_nullrect()</span></code></a>).</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rectoverlap"> |
| bool <code class="sig-name descname">nxgl_rectoverlap</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect1</em>, FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect2</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_rectoverlap" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Return true if the two rectangles overlap.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rectinside"> |
| bool <code class="sig-name descname">nxgl_rectinside</code><span class="sig-paren">(</span>FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>pt</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_rectinside" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Return true if the point <code class="docutils literal notranslate"><span class="pre">pt</span></code> lies within <code class="docutils literal notranslate"><span class="pre">rect</span></code>.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_rectsize"> |
| void <code class="sig-name descname">nxgl_rectsize</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_size_s" title="nxgl_size_s">nxgl_size_s</a> *<em>size</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_rectsize" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Return the size of the specified rectangle.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_nullrect"> |
| bool <code class="sig-name descname">nxgl_nullrect</code><span class="sig-paren">(</span>FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_nullrect" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Return true if the area of the retangle is <= 0.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_runoffset"> |
| void <code class="sig-name descname">nxgl_runoffset</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_run_s" title="nxgl_run_s">nxgl_run_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_run_s" title="nxgl_run_s">nxgl_run_s</a> *<em>src</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>dx</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>dy</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_runoffset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Offset the run position by the specified <code class="docutils literal notranslate"><span class="pre">dx</span></code>, <code class="docutils literal notranslate"><span class="pre">dy</span></code> |
| values.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_runcopy"> |
| void <code class="sig-name descname">nxgl_runcopy</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_run_s" title="nxgl_run_s">nxgl_run_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_run_s" title="nxgl_run_s">nxgl_run_s</a> *<em>src</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_runcopy" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This is essentially <code class="docutils literal notranslate"><span class="pre">memcpy()</span></code>for runs. We don’t do |
| structure assignments because some compilers are not good at that.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_trapoffset"> |
| void <code class="sig-name descname">nxgl_trapoffset</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_trapezoid_s" title="nxgl_trapezoid_s">nxgl_trapezoid_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_trapezoid_s" title="nxgl_trapezoid_s">nxgl_trapezoid_s</a> *<em>src</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>dx</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>dy</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_trapoffset" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Offset the trapezoid position by the specified <code class="docutils literal notranslate"><span class="pre">dx</span></code>, |
| <code class="docutils literal notranslate"><span class="pre">dy</span></code> values.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_trapcopy"> |
| void <code class="sig-name descname">nxgl_trapcopy</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_trapezoid_s" title="nxgl_trapezoid_s">nxgl_trapezoid_s</a> *<em>dest</em>, FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_trapezoid_s" title="nxgl_trapezoid_s">nxgl_trapezoid_s</a> *<em>src</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_trapcopy" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This is essentially <code class="docutils literal notranslate"><span class="pre">memcpy()</span></code>for trapezoids. We |
| don’t do structure assignments because some compilers are not good at |
| that.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_colorcopy"> |
| void <code class="sig-name descname">nxgl_colorcopy</code><span class="sig-paren">(</span><a class="reference internal" href="#c.nxgl_mxpixel_t" title="nxgl_mxpixel_t">nxgl_mxpixel_t</a> <em>dest</em>[<em>CONFIG_NX_NPLANES</em>], <em class="property">const</em> <a class="reference internal" href="#c.nxgl_mxpixel_t" title="nxgl_mxpixel_t">nxgl_mxpixel_t</a> <em>src</em>[<em>CONFIG_NX_NPLANES</em>]<span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_colorcopy" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>This is essentially <code class="docutils literal notranslate"><span class="pre">memcpy()</span></code>for colors. This does |
| very little for us other than hide all of the conditional compilation |
| for planar colors in one place.</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_splitline"> |
| int <code class="sig-name descname">nxgl_splitline</code><span class="sig-paren">(</span>FAR <em class="property">struct</em> nxgl_vector_s *<em>vector</em>, FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_trapezoid_s" title="nxgl_trapezoid_s">nxgl_trapezoid_s</a> *<em>traps</em>, FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_rect_s" title="nxgl_rect_s">nxgl_rect_s</a> *<em>rect</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>linewidth</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_splitline" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>In the general case, a line with width can be |
| represented as a parallelogram with a triangle at the top and bottom. |
| Triangles and parallelograms are both degenerate versions of a |
| trapezoid. This function breaks a wide line into triangles and |
| trapezoids. This function also detects other degenerate cases:</p> |
| <ol class="arabic simple"> |
| <li><p>If <code class="docutils literal notranslate"><span class="pre">y1</span> <span class="pre">==</span> <span class="pre">y2</span></code> then the line is horizontal and is better represented |
| as a rectangle.</p></li> |
| <li><p>If <code class="docutils literal notranslate"><span class="pre">x1</span> <span class="pre">==</span> <span class="pre">x2</span></code> then the line is vertical and also better represented |
| as a rectangle.</p></li> |
| <li><p>If the width of the line is 1, then there are no triangles at the top |
| and bottom (this may also be the case if the width is narrow and the |
| line is near vertical).</p></li> |
| <li><p>If the line is oriented is certain angles, it may consist only of the |
| upper and lower triangles with no trapezoid in between. In this case, |
| 3 trapezoids will be returned, but traps[1] will be degenerate.</p></li> |
| </ol> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>vector</strong> – A pointer to the vector described the line to be drawn.</p></li> |
| <li><p><strong>traps</strong> – A pointer to a array of trapezoids (size 3).</p></li> |
| <li><p><strong>rect</strong> – A pointer to a rectangle.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p>0: Line successfully broken up into three trapezoids. Values in traps[0], traps[1], and traps[2] are valid.</p></li> |
| <li><p>1: Line successfully represented by one trapezoid. Value in traps[1] is valid.</p></li> |
| <li><p>2: Line successfully represented by one rectangle. Value in rect is valid</p></li> |
| <li><p><0: On errors, a negated errno value is returned.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_circlepts"> |
| void <code class="sig-name descname">nxgl_circlepts</code><span class="sig-paren">(</span>FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>center</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>radius</em>, FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>circle</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_circlepts" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Given a description of a circle, return a set of 16 |
| points on the circumference of the circle. These points may then be used |
| by <a class="reference internal" href="nx.html#c.nx_drawcircle" title="nx_drawcircle"><code class="xref c c-func docutils literal notranslate"><span class="pre">nx_drawcircle()</span></code></a> or related APIs to draw a |
| circle outline.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>center</strong> – A pointer to the point that is the center of the circle.</p></li> |
| <li><p><strong>radius</strong> – The radius of the circle in pixels.</p></li> |
| <li><p><strong>circle</strong> – A pointer the first entry in an array of 16 points where the circle points will be returned.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt id="c.nxgl_circletraps"> |
| void <code class="sig-name descname">nxgl_circletraps</code><span class="sig-paren">(</span>FAR <em class="property">const</em> <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_point_s" title="nxgl_point_s">nxgl_point_s</a> *<em>center</em>, <a class="reference internal" href="#c.nxgl_coord_t" title="nxgl_coord_t">nxgl_coord_t</a> <em>radius</em>, FAR <em class="property">struct</em> <a class="reference internal" href="#c.nxgl_trapezoid_s" title="nxgl_trapezoid_s">nxgl_trapezoid_s</a> *<em>circle</em><span class="sig-paren">)</span>;<a class="headerlink" href="#c.nxgl_circletraps" title="Permalink to this definition">¶</a><br /></dt> |
| <dd><p>Given a description of a a circle, return 8 trapezoids |
| that can be used to fill the circle by |
| <a class="reference internal" href="nx.html#c.nx_fillcircle" title="nx_fillcircle"><code class="xref c c-func docutils literal notranslate"><span class="pre">nx_fillcircle()</span></code></a> and other interfaces.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>center</strong> – A pointer to the point that is the center of the circle.</p></li> |
| <li><p><strong>radius</strong> – The radius of the circle in pixels.</p></li> |
| <li><p><strong>circle</strong> – A pointer the first entry in an array of 8 trapezoids where the |
| circle description will be returned.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </div> |
| </div> |
| |
| |
| </div> |
| |
| </div> |
| <footer> |
| |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p> |
| |
| © Copyright 2020, The Apache Software Foundation |
| |
| </p> |
| </div> |
| |
| </footer> |
| |
| </div> |
| </div> |
| |
| </section> |
| |
| </div> |
| |
| |
| <script type="text/javascript"> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| |
| |
| |
| |
| |
| </body> |
| </html> |