Add logic to read from graphics memory
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4057 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
6c6c0ba3d9
commit
dbf37c6315
24 changed files with 1354 additions and 79 deletions
|
|
@ -2167,4 +2167,7 @@
|
|||
support for the Sure Electronics PIC32MX board.
|
||||
* configs/ea3152: Add a configuration for the Embedded Artists LPC3152
|
||||
daughter board (with the same base-board used with configs/ea3131)
|
||||
* graphics/nxmu/nx_getrectangle.c, graphics/nxsu/nx_getrectangle.c,
|
||||
graphics/mxtk/nx_getwindow.c, graphics/nxmu/nx_gettoobar.c: New
|
||||
interfaces to read from graphics memory
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<h1><big><font color="#3c34ec">
|
||||
<i>NX Graphics Subsystem</i>
|
||||
</font></big></h1>
|
||||
<p>Last Updated: September 28, 2011</p>
|
||||
<p>Last Updated: October 22, 2011</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
@ -115,15 +115,16 @@
|
|||
<i>2.3.18 <a href="#nxraise"><code>nx_raise()</code></a></i><br>
|
||||
<i>2.3.19 <a href="#nxlower"><code>nx_lower()</code></a></i><br>
|
||||
<i>2.3.20 <a href="#nxfill"><code>nx_fill()</code></a></i><br>
|
||||
<i>2.3.21 <a href="#nxfilltrapezoid"><code>nx_filltrapezoid()</code></a></i><br>
|
||||
<i>2.3.22 <a href="#nxdrawline"><code>nx_drawline()</code></a></i><br>
|
||||
<i>2.3.23 <a href="#nxdrawcircle"><code>nx_drawcircle()</code></a></i><br>
|
||||
<i>2.3.24 <a href="#nxfillcircle"><code>nx_fillcircle()</code></a></i><br>
|
||||
<i>2.3.25 <a href="#nxglrgb2yuv"><code>nx_setbgcolor()</code></a></i><br>
|
||||
<i>2.3.26 <a href="#nxmove"><code>nx_move()</code></a></i><br>
|
||||
<i>2.3.27 <a href="#nxbitmap"><code>nx_bitmap()</code></a></i><br>
|
||||
<i>2.3.28 <a href="#nxkbdin"><code>nx_kbdin()</code></a></i><br>
|
||||
<i>2.3.29 <a href="#nxmousein"><code>nx_mousein()</code></a></i><br>
|
||||
<i>2.3.21 <a href="#nxgetrectangle"><code>nx_getrectangle()</code></a></i><br>
|
||||
<i>2.3.22 <a href="#nxfilltrapezoid"><code>nx_filltrapezoid()</code></a></i><br>
|
||||
<i>2.3.23 <a href="#nxdrawline"><code>nx_drawline()</code></a></i><br>
|
||||
<i>2.3.24 <a href="#nxdrawcircle"><code>nx_drawcircle()</code></a></i><br>
|
||||
<i>2.3.25 <a href="#nxfillcircle"><code>nx_fillcircle()</code></a></i><br>
|
||||
<i>2.3.26 <a href="#nxglrgb2yuv"><code>nx_setbgcolor()</code></a></i><br>
|
||||
<i>2.3.27 <a href="#nxmove"><code>nx_move()</code></a></i><br>
|
||||
<i>2.3.28 <a href="#nxbitmap"><code>nx_bitmap()</code></a></i><br>
|
||||
<i>2.3.29 <a href="#nxkbdin"><code>nx_kbdin()</code></a></i><br>
|
||||
<i>2.3.30 <a href="#nxmousein"><code>nx_mousein()</code></a></i><br>
|
||||
</ul>
|
||||
</p>
|
||||
</td>
|
||||
|
|
@ -142,21 +143,23 @@
|
|||
<i>2.4.7 <a href="#nxtkraise"><code>nxtk_raise()</code></a></i><br>
|
||||
<i>2.4.8 <a href="#nxtklower"><code>nxtk_lower()</code></a></i><br>
|
||||
<i>2.4.9 <a href="#nxtkfillwindow"><code>nxtk_fillwindow()</code></a></i><br>
|
||||
<i>2.4.10 <a href="#nxtkfilltrapwindow"><code>nxtk_filltrapwindow()</code></a></i><br>
|
||||
<i>2.4.11 <a href="#nxtkdrawlinewindow"><code>nxtk_drawlinewindow()</code></a></i><br>
|
||||
<i>2.4.12 <a href="#nxtkdrawcirclewindow"><code>nxtk_drawcirclewindow()</code></a></i><br>
|
||||
<i>2.4.13 <a href="#nxtkfillcirclewindow"><code>nxtk_fillcirclewindow()</code></a></i><br>
|
||||
<i>2.4.14 <a href="#nxtkmovewindow"><code>nxtk_movewindow()</code></a></i><br>
|
||||
<i>2.4.15 <a href="#nxtkbitmapwindow"><code>nxtk_bitmapwindow()</code></a></i><br>
|
||||
<i>2.4.16 <a href="#nxtkopentoolbar"><code>nxtk_opentoolbar()</code></a></i><br>
|
||||
<i>2.4.17 <a href="#nxtkclosetoolbar"><code>nxtk_closetoolbar()</code></a></i><br>
|
||||
<i>2.4.18 <a href="#nxtkfilltoolbar"><code>nxtk_filltoolbar()</code></a></i><br>
|
||||
<i>2.4.19 <a href="#nxtkfilltraptoolbar"><code>nxtk_filltraptoolbar()</code></a></i><br>
|
||||
<i>2.4.20 <a href="#nxtkdrawlinetoolbar"><code>nxtk_drawlinetoolbar()</code></a></i><br>
|
||||
<i>2.4.21 <a href="#nxtkdrawcircletoolbar"><code>nxtk_drawcircletoolbar()</code></a></i><br>
|
||||
<i>2.4.22 <a href="#nxtkfillcircletoolbar"><code>nxtk_fillcircletoolbar()</code></a></i><br>
|
||||
<i>2.4.23 <a href="#nxtkmovetoolbar"><code>nxtk_movetoolbar()</code></a></i><br>
|
||||
<i>2.4.24 <a href="#nxtkbitmaptoolbar"><code>nxtk_bitmaptoolbar()</code></a></i>
|
||||
<i>2.4.10 <a href="#nxtkgetwindow"><code>nxtk_getwindow()</code></a></i><br>
|
||||
<i>2.4.11 <a href="#nxtkfilltrapwindow"><code>nxtk_filltrapwindow()</code></a></i><br>
|
||||
<i>2.4.12 <a href="#nxtkdrawlinewindow"><code>nxtk_drawlinewindow()</code></a></i><br>
|
||||
<i>2.4.13 <a href="#nxtkdrawcirclewindow"><code>nxtk_drawcirclewindow()</code></a></i><br>
|
||||
<i>2.4.14 <a href="#nxtkfillcirclewindow"><code>nxtk_fillcirclewindow()</code></a></i><br>
|
||||
<i>2.4.15 <a href="#nxtkmovewindow"><code>nxtk_movewindow()</code></a></i><br>
|
||||
<i>2.4.16 <a href="#nxtkbitmapwindow"><code>nxtk_bitmapwindow()</code></a></i><br>
|
||||
<i>2.4.17 <a href="#nxtkopentoolbar"><code>nxtk_opentoolbar()</code></a></i><br>
|
||||
<i>2.4.18 <a href="#nxtkclosetoolbar"><code>nxtk_closetoolbar()</code></a></i><br>
|
||||
<i>2.4.19 <a href="#nxtkfilltoolbar"><code>nxtk_filltoolbar()</code></a></i><br>
|
||||
<i>2.4.20 <a href="#nxtkgettoolbar"><code>nxtk_gettoolbar()</code></a></i><br>
|
||||
<i>2.4.21 <a href="#nxtkfilltraptoolbar"><code>nxtk_filltraptoolbar()</code></a></i><br>
|
||||
<i>2.4.22 <a href="#nxtkdrawlinetoolbar"><code>nxtk_drawlinetoolbar()</code></a></i><br>
|
||||
<i>2.4.23 <a href="#nxtkdrawcircletoolbar"><code>nxtk_drawcircletoolbar()</code></a></i><br>
|
||||
<i>2.4.24 <a href="#nxtkfillcircletoolbar"><code>nxtk_fillcircletoolbar()</code></a></i><br>
|
||||
<i>2.4.25 <a href="#nxtkmovetoolbar"><code>nxtk_movetoolbar()</code></a></i><br>
|
||||
<i>2.4.26 <a href="#nxtkbitmaptoolbar"><code>nxtk_bitmaptoolbar()</code></a></i>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
|
|
@ -1674,7 +1677,47 @@ int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.21 <a name="nxfilltrapezoid"><code>nx_filltrapezoid()</code></a></h3>
|
||||
<h3>2.3.21 <a name="nxgetrectangle"><code>nx_getrectangle()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
void nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride);
|
||||
</pre></ul>
|
||||
<p>
|
||||
<b>Description:</b>
|
||||
Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
Since raw graphic memory is returned, the returned memory content may be
|
||||
the memory of windows above this one and may not necessarily belong to
|
||||
this window unless you assure that this is the top window.
|
||||
</p>
|
||||
<p>
|
||||
<b>Input Parameters:</b>
|
||||
<ul><dl>
|
||||
<dt><code>hwnd</code>
|
||||
<dd>The handle returned by <a href="#nxopenwindow"><code>nx_openwindow()</code></a>
|
||||
or <a href="#nxrequestbkgd"><code>nx_requestbkgd()</code></a>
|
||||
<dt><code>rect</code>
|
||||
<dd>The location to be copied
|
||||
|
||||
<dt><code>plane</code>
|
||||
<dd>Specifies the color plane to get from
|
||||
<dt><code>dest</code>
|
||||
<dd>The location to copy the memory region
|
||||
<dt><code>deststride</code>
|
||||
<dd>The width, in bytes, the the dest memory
|
||||
</dl></ul>
|
||||
</p>
|
||||
<p>
|
||||
<b>Returned Value:</b>
|
||||
<code>OK</code> on success;
|
||||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.22 <a name="nxfilltrapezoid"><code>nx_filltrapezoid()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1708,7 +1751,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.22 <a name="nxdrawline"><code>nx_drawline()</code></a></h3>
|
||||
<h3>2.3.23 <a name="nxdrawline"><code>nx_drawline()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1744,7 +1787,7 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.23 <a name="nxdrawcircle"><code>nx_drawcircle()</code></a></h3>
|
||||
<h3>2.3.24 <a name="nxdrawcircle"><code>nx_drawcircle()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1780,7 +1823,7 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.24 <a name="nxfillcircle"><code>nx_fillcircle()</code></a></h3>
|
||||
<h3>2.3.25 <a name="nxfillcircle"><code>nx_fillcircle()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1813,7 +1856,7 @@ int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.25 <a name="nxglrgb2yuv"><code>nx_setbgcolor()</code></a></h3>
|
||||
<h3>2.3.26 <a name="nxglrgb2yuv"><code>nx_setbgcolor()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1841,7 +1884,7 @@ int nx_setbgcolor(NXHANDLE handle,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.26 <a name="nxmove"><code>nx_move()</code></a></h3>
|
||||
<h3>2.3.27 <a name="nxmove"><code>nx_move()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1872,7 +1915,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.27 <a name="nxbitmap"><code>nx_bitmap()</code></a></h3>
|
||||
<h3>2.3.28 <a name="nxbitmap"><code>nx_bitmap()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1914,7 +1957,7 @@ int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.28 <a name="nxkbdin"><code>nx_kbdin()</code></a></h3>
|
||||
<h3>2.3.29 <a name="nxkbdin"><code>nx_kbdin()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -1937,7 +1980,7 @@ int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch);
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.3.29 <a name="nxmousein"><code>nx_mousein()</code></a></h3>
|
||||
<h3>2.3.30 <a name="nxmousein"><code>nx_mousein()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2260,7 +2303,47 @@ int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.10 <a name="nxtkfilltrapwindow"><code>nxtk_filltrapwindow()</code></a></h3>
|
||||
<h3>2.4.10 <a name="nxtkgetwindow"><code>nxtk_getwindow()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxtk.h>
|
||||
|
||||
void nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride);
|
||||
</pre></ul>
|
||||
<p>
|
||||
<b>Description:</b>
|
||||
Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
Since raw graphic memory is returned, the returned memory content may be
|
||||
the memory of windows above this one and may not necessarily belong to
|
||||
this window unless you assure that this is the top window.</p>
|
||||
<p>
|
||||
<b>Input Parameters:</b>
|
||||
<dl>
|
||||
<dt><code>hfwnd</code>
|
||||
<dd>A handle previously returned by
|
||||
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
|
||||
<dt><code>rect</code>
|
||||
<dd>The location within the client window to be retrieved.
|
||||
|
||||
<dt><code>plane</code>
|
||||
<dd>Specifies the color plane to get from.
|
||||
<dt><code>dest</code>
|
||||
<dd>The location to copy the memory region
|
||||
<dt><code>deststride</code>
|
||||
<dd>The width, in bytes, the the dest memory
|
||||
</dl>
|
||||
</p>
|
||||
<p>
|
||||
<b>Returned Value:</b>
|
||||
<code>OK</code> on success;
|
||||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.11 <a name="nxtkfilltrapwindow"><code>nxtk_filltrapwindow()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2293,7 +2376,7 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.11 <a name="nxtkdrawlinewindow"><code>nxtk_drawlinewindow()</code></a></h3>
|
||||
<h3>2.4.12 <a name="nxtkdrawlinewindow"><code>nxtk_drawlinewindow()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2330,7 +2413,7 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.12 <a name="nxtkdrawcirclewindow"><code>nxtk_drawcirclewindow()</code></a></h3>
|
||||
<h3>2.4.13 <a name="nxtkdrawcirclewindow"><code>nxtk_drawcirclewindow()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2366,7 +2449,7 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cente
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.13 <a name="nxtkfillcirclewindow"><code>nxtk_fillcirclewindow()</code></a></h3>
|
||||
<h3>2.4.14 <a name="nxtkfillcirclewindow"><code>nxtk_fillcirclewindow()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2399,7 +2482,7 @@ int nxtk_fillcirclewindow(NXWINDOW hfwnd, FAR const struct nxgl_point_s *center,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.14 <a name="nxtkmovewindow"><code>nxtk_movewindow()</code></a></h3>
|
||||
<h3>2.4.15 <a name="nxtkmovewindow"><code>nxtk_movewindow()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2432,7 +2515,7 @@ int nxtk_movewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.15 <a name="nxtkbitmapwindow"><code>nxtk_bitmapwindow()</code></a></h3>
|
||||
<h3>2.4.16 <a name="nxtkbitmapwindow"><code>nxtk_bitmapwindow()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2477,7 +2560,7 @@ int nxtk_bitmapwindow(NXTKWINDOW hfwnd,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.16 <a name="nxtkopentoolbar"><code>nxtk_opentoolbar()</code></a></h3>
|
||||
<h3>2.4.17 <a name="nxtkopentoolbar"><code>nxtk_opentoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2512,7 +2595,7 @@ int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.17 <a name="nxtkclosetoolbar"><code>nxtk_closetoolbar()</code></a></h3>
|
||||
<h3>2.4.18 <a name="nxtkclosetoolbar"><code>nxtk_closetoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2541,7 +2624,7 @@ int nxtk_closetoolbar(NXTKWINDOW hfwnd);
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.18 <a name="nxtkfilltoolbar"><code>nxtk_filltoolbar()</code></a></h3>
|
||||
<h3>2.4.19 <a name="nxtkfilltoolbar"><code>nxtk_filltoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2573,7 +2656,48 @@ int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.19 <a name="nxtkfilltraptoolbar"><code>nxtk_filltraptoolbar()</code></a></h3>
|
||||
<h3>2.4.19 <a name="nxtkgettoolbar"><code>nxtk_gettoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxtk.h>
|
||||
|
||||
int nxtk_gettoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride);
|
||||
</pre></ul>
|
||||
<p>
|
||||
<b>Description:</b>
|
||||
Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
Since raw graphic memory is returned, the returned memory content may be
|
||||
the memory of windows above this one and may not necessarily belong to
|
||||
this window unless you assure that this is the top window.
|
||||
</p>
|
||||
<p>
|
||||
<b>Input Parameters:</b>
|
||||
<dl>
|
||||
<dt><code>hfwnd</code>
|
||||
<dd>A handle previously returned by
|
||||
<a href="#nxtkopenwindow"><code>nxtk_openwindow()</code></a>.
|
||||
<dt><code>rect</code>
|
||||
<dd>The location within the toolbar window to be retrieved.
|
||||
|
||||
<dt><code>plane</code>
|
||||
<dd>TSpecifies the color plane to get from.
|
||||
<dt><code>dest</code>
|
||||
<dd>TThe location to copy the memory region.
|
||||
<dt><code>deststride</code>
|
||||
<dd>The width, in bytes, the the dest memory.
|
||||
</dl>
|
||||
</p>
|
||||
<p>
|
||||
<b>Returned Value:</b>
|
||||
<code>OK</code> on success;
|
||||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.21 <a name="nxtkfilltraptoolbar"><code>nxtk_filltraptoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2605,7 +2729,7 @@ int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *tr
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.20 <a name="nxtkdrawlinetoolbar"><code>nxtk_drawlinetoolbar()</code></a></h3>
|
||||
<h3>2.4.22 <a name="nxtkdrawlinetoolbar"><code>nxtk_drawlinetoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2642,7 +2766,7 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.21 <a name="nxtkdrawcircletoolbar"><code>nxtk_drawcircletoolbar()</code></a></h3>
|
||||
<h3>2.4.23 <a name="nxtkdrawcircletoolbar"><code>nxtk_drawcircletoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2678,7 +2802,7 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *cent
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.22 <a name="nxtkfillcircletoolbar"><code>nxtk_fillcircletoolbar()</code></a></h3>
|
||||
<h3>2.4.24 <a name="nxtkfillcircletoolbar"><code>nxtk_fillcircletoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2711,7 +2835,7 @@ int nxtk_fillcircletoolbar(NXWINDOW hfwnd, FAR const struct nxgl_point_s *center
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.23 <a name="nxtkmovetoolbar"><code>nxtk_movetoolbar()</code></a></h3>
|
||||
<h3>2.4.25 <a name="nxtkmovetoolbar"><code>nxtk_movetoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -2745,7 +2869,7 @@ int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
|||
<code>ERROR</code> on failure with <code>errno</code> set appropriately
|
||||
</p>
|
||||
|
||||
<h3>2.4.24 <a name="nxtkbitmaptoolbar"><code>nxtk_bitmaptoolbar()</code></a></h3>
|
||||
<h3>2.4.26 <a name="nxtkbitmaptoolbar"><code>nxtk_bitmaptoolbar()</code></a></h3>
|
||||
<p><b>Function Prototype:</b></p>
|
||||
<ul><pre>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
|
@ -3764,6 +3888,11 @@ sudo ln -s libXext.so.6.4.0 libXext.so
|
|||
<code><NuttX-Directory>/.config</code> file</td>
|
||||
<td align="center" bgcolor="skyblue">YES</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top"><a href="#nxgetrectangle"><code>nx_getrectangle()</code></a></td>
|
||||
<td><br></td>
|
||||
<td align="center" bgcolor="skyblue">YES</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top"><a href="#nxfilltrapezoid"><code>nx_filltrapezoid()</code></a></td>
|
||||
<td>
|
||||
|
|
@ -3869,6 +3998,11 @@ sudo ln -s libXext.so.6.4.0 libXext.so
|
|||
<td><br></td>
|
||||
<td align="center" bgcolor="skyblue">YES</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top"><a href="#nxtkgetwindow"><code>nxtk_getwindow()</code></a></td>
|
||||
<td><br></td>
|
||||
<td align="center" bgcolor="lightgrey">NO</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top"><a href="#nxtkfilltrapwindow"><code>nxtk_filltrapwindow()</code></a></td>
|
||||
<td><br></td>
|
||||
|
|
@ -3914,6 +4048,11 @@ sudo ln -s libXext.so.6.4.0 libXext.so
|
|||
<td><br></td>
|
||||
<td align="center" bgcolor="skyblue">YES</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top"><a href="#nxtkgettoolbar"><code>nxtk_gettoolbar()</code></a></td>
|
||||
<td><br></td>
|
||||
<td align="center" bgcolor="lightgrey">NO</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" valign="top"><a href="#nxtkfilltraptoolbar"><code>nxtk_filltraptoolbar()</code></a></td>
|
||||
<td><br></td>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
############################################################################
|
||||
# graphics/nxbe/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
|
|
@ -34,8 +34,8 @@
|
|||
############################################################################
|
||||
|
||||
NXBE_ASRCS =
|
||||
NXBE_CSRCS = nxbe_configure.c nxbe_colormap.c nxbe_clipper.c \
|
||||
nxbe_closewindow.c nxbe_setpixel.c \
|
||||
nxbe_setposition.c nxbe_setsize.c nxbe_raise.c nxbe_lower.c \
|
||||
nxbe_fill.c nxbe_filltrapezoid.c nxbe_move.c nxbe_bitmap.c \
|
||||
nxbe_redraw.c nxbe_redrawbelow.c nxbe_visible.c
|
||||
NXBE_CSRCS = nxbe_bitmap.c nxbe_configure.c nxbe_colormap.c nxbe_clipper.c \
|
||||
nxbe_closewindow.c nxbe_fill.c nxbe_filltrapezoid.c \
|
||||
nxbe_getrectangle.c nxbe_lower.c nxbe_move.c nxbe_raise.c \
|
||||
nxbe_redraw.c nxbe_redrawbelow.c nxbe_setpixel.c nxbe_setposition.c \
|
||||
nxbe_setsize.c nxbe_visible.c
|
||||
|
|
|
|||
|
|
@ -90,6 +90,9 @@ struct nxbe_plane_s
|
|||
void (*fillrectangle)(FAR NX_PLANEINFOTYPE *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
nxgl_mxpixel_t color);
|
||||
void (*getrectangle)(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
void (*filltrapezoid)(FAR NX_PLANEINFOTYPE *pinfo,
|
||||
FAR const struct nxgl_trapezoid_s *trap,
|
||||
FAR const struct nxgl_rect_s *bounds,
|
||||
|
|
@ -353,6 +356,32 @@ EXTERN void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
|
|||
FAR const struct nxgl_trapezoid_s *trap,
|
||||
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxbe_getrectangle
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane,
|
||||
FAR uint8_t *dest, unsigned int deststride);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxbe_move
|
||||
*
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
|
|||
{
|
||||
be->plane[i].setpixel = nxgl_setpixel_1bpp;
|
||||
be->plane[i].fillrectangle = nxgl_fillrectangle_1bpp;
|
||||
be->plane[i].getrectangle = nxgl_getrectangle_1bpp;
|
||||
be->plane[i].filltrapezoid = nxgl_filltrapezoid_1bpp;
|
||||
be->plane[i].moverectangle = nxgl_moverectangle_1bpp;
|
||||
be->plane[i].copyrectangle = nxgl_copyrectangle_1bpp;
|
||||
|
|
@ -142,6 +143,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
|
|||
{
|
||||
be->plane[i].setpixel = nxgl_setpixel_2bpp;
|
||||
be->plane[i].fillrectangle = nxgl_fillrectangle_2bpp;
|
||||
be->plane[i].getrectangle = nxgl_getrectangle_2bpp;
|
||||
be->plane[i].filltrapezoid = nxgl_filltrapezoid_2bpp;
|
||||
be->plane[i].moverectangle = nxgl_moverectangle_2bpp;
|
||||
be->plane[i].copyrectangle = nxgl_copyrectangle_2bpp;
|
||||
|
|
@ -153,6 +155,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
|
|||
{
|
||||
be->plane[i].setpixel = nxgl_setpixel_4bpp;
|
||||
be->plane[i].fillrectangle = nxgl_fillrectangle_4bpp;
|
||||
be->plane[i].getrectangle = nxgl_getrectangle_4bpp;
|
||||
be->plane[i].filltrapezoid = nxgl_filltrapezoid_4bpp;
|
||||
be->plane[i].moverectangle = nxgl_moverectangle_4bpp;
|
||||
be->plane[i].copyrectangle = nxgl_copyrectangle_4bpp;
|
||||
|
|
@ -164,6 +167,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
|
|||
{
|
||||
be->plane[i].setpixel = nxgl_setpixel_8bpp;
|
||||
be->plane[i].fillrectangle = nxgl_fillrectangle_8bpp;
|
||||
be->plane[i].getrectangle = nxgl_getrectangle_8bpp;
|
||||
be->plane[i].filltrapezoid = nxgl_filltrapezoid_8bpp;
|
||||
be->plane[i].moverectangle = nxgl_moverectangle_8bpp;
|
||||
be->plane[i].copyrectangle = nxgl_copyrectangle_8bpp;
|
||||
|
|
@ -175,6 +179,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
|
|||
{
|
||||
be->plane[i].setpixel = nxgl_setpixel_16bpp;
|
||||
be->plane[i].fillrectangle = nxgl_fillrectangle_16bpp;
|
||||
be->plane[i].getrectangle = nxgl_getrectangle_16bpp;
|
||||
be->plane[i].filltrapezoid = nxgl_filltrapezoid_16bpp;
|
||||
be->plane[i].moverectangle = nxgl_moverectangle_16bpp;
|
||||
be->plane[i].copyrectangle = nxgl_copyrectangle_16bpp;
|
||||
|
|
@ -186,6 +191,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
|
|||
{
|
||||
be->plane[i].setpixel = nxgl_setpixel_24bpp;
|
||||
be->plane[i].fillrectangle = nxgl_fillrectangle_24bpp;
|
||||
be->plane[i].getrectangle = nxgl_getrectangle_24bpp;
|
||||
be->plane[i].filltrapezoid = nxgl_filltrapezoid_24bpp;
|
||||
be->plane[i].moverectangle = nxgl_moverectangle_24bpp;
|
||||
be->plane[i].copyrectangle = nxgl_copyrectangle_24bpp;
|
||||
|
|
@ -197,6 +203,7 @@ int nxbe_configure(FAR NX_DRIVERTYPE *dev, FAR struct nxbe_state_s *be)
|
|||
{
|
||||
be->plane[i].setpixel = nxgl_setpixel_32bpp;
|
||||
be->plane[i].fillrectangle = nxgl_fillrectangle_32bpp;
|
||||
be->plane[i].getrectangle = nxgl_getrectangle_32bpp;
|
||||
be->plane[i].filltrapezoid = nxgl_filltrapezoid_32bpp;
|
||||
be->plane[i].moverectangle = nxgl_moverectangle_32bpp;
|
||||
be->plane[i].copyrectangle = nxgl_copyrectangle_32bpp;
|
||||
|
|
|
|||
149
graphics/nxbe/nxbe_getrectangle.c
Normal file
149
graphics/nxbe/nxbe_getrectangle.c
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxbe/nxbe_fill.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
||||
#include "nxbe.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct nxbe_fill_s
|
||||
{
|
||||
struct nxbe_clipops_s cops;
|
||||
nxgl_mxpixel_t color;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxbe_clipfill
|
||||
*
|
||||
* Description:
|
||||
* Called from nxbe_clipper() to performed the fill operation on visible portions
|
||||
* of the rectangle.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void nxbe_clipfill(FAR struct nxbe_clipops_s *cops,
|
||||
FAR struct nxbe_plane_s *plane,
|
||||
FAR const struct nxgl_rect_s *rect)
|
||||
{
|
||||
struct nxbe_fill_s *fillinfo = (struct nxbe_fill_s *)cops;
|
||||
plane->fillrectangle(&plane->pinfo, rect, fillinfo->color);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxbe_getrectangle
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxbe_getrectangle(FAR struct nxbe_window_s *wnd,
|
||||
FAR const struct nxgl_rect_s *rect, unsigned int plane,
|
||||
FAR uint8_t *dest, unsigned int deststride)
|
||||
{
|
||||
struct nxgl_rect_s remaining;
|
||||
int i;
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !rect || ! rect || plane >= wnd->be->vinfo.nplanes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Offset the rectangle by the window origin to convert it into a
|
||||
* bounding box
|
||||
*/
|
||||
|
||||
nxgl_rectoffset(&remaining, rect, wnd->bounds.pt1.x, wnd->bounds.pt1.y);
|
||||
|
||||
/* Clip to the bounding box to the limits of the window and of the
|
||||
* background screen
|
||||
*/
|
||||
|
||||
nxgl_rectintersect(&remaining, &remaining, &wnd->bounds);
|
||||
nxgl_rectintersect(&remaining, &remaining, &wnd->be->bkgd.bounds);
|
||||
|
||||
/* The return the graphics memory at this location. NOTE: Since raw
|
||||
* graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong
|
||||
* to this window.
|
||||
*/
|
||||
|
||||
FAR struct nxbe_plane_s *pplane = &wnd->be->plane[i];
|
||||
pplane->getrectangle(&pplane->pinfo, rect, dest, deststride);
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
############################################################################
|
||||
# graphics/nxglib/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
|
|
@ -47,6 +47,12 @@ RFILL1_CSRCS = nxglib_fillrectangle_1bpp.c nxglib_fillrectangle_2bpp.c \
|
|||
RFILL2_CSRCS = nxglib_fillrectangle_8bpp.c nxglib_fillrectangle_16bpp.c \
|
||||
nxglib_fillrectangle_24bpp.c nxglib_fillrectangle_32bpp.c
|
||||
|
||||
RGET1_CSRCS = nxglib_getrectangle_1bpp.c nxglib_getrectangle_2bpp.c \
|
||||
nxglib_getrectangle_4bpp.c
|
||||
|
||||
RGET2_CSRCS = nxglib_getrectangle_8bpp.c nxglib_getrectangle_16bpp.c \
|
||||
nxglib_getrectangle_24bpp.c nxglib_getrectangle_32bpp.c
|
||||
|
||||
TFILL1_CSRCS = nxglib_filltrapezoid_1bpp.c nxglib_filltrapezoid_2bpp.c \
|
||||
nxglib_filltrapezoid_4bpp.c
|
||||
|
||||
|
|
@ -81,7 +87,7 @@ LCD_CSRCS =
|
|||
|
||||
NXGLIB_CSRCS = \
|
||||
$(SETP1_CSRCS) $(SETP2_CSRCS) $(RFILL1_CSRCS) $(RFILL2_CSRCS) \
|
||||
$(TFILL1_CSRCS) $(TFILL2_CSRCS) $(RMOVE1_CSRCS) $(RMOVE2_CSRCS) \
|
||||
$(RCOPY1_CSRCS) $(RCOPY2_CSRCS) $(RECT_CSRCS) $(TRAP_CSRCS) \
|
||||
$(COLOR_CSRCS) $(DRAW_CSRCS) $(LCD_CSRCS)
|
||||
$(RGET1_CSRCS) $(RGET2_CSRCS) $(TFILL1_CSRCS) $(TFILL2_CSRCS) \
|
||||
$(RMOVE1_CSRCS) $(RMOVE2_CSRCS) $(RCOPY1_CSRCS) $(RCOPY2_CSRCS) \
|
||||
$(RECT_CSRCS) $(TRAP_CSRCS) $(COLOR_CSRCS) $(DRAW_CSRCS) $(LCD_CSRCS)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
############################################################################
|
||||
# graphics/nxglib/Makefile.sources
|
||||
#
|
||||
# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
|
|
@ -40,6 +40,7 @@ ifeq ($(NXGLIB_BITSPERPIXEL),1)
|
|||
NXGLIB_SUFFIX := _1bpp
|
||||
SETP_CSRC := nxglib_setpixel_1bpp.c
|
||||
RFILL_CSRC := nxglib_fillrectangle_1bpp.c
|
||||
RGET_CSRC := nxglib_getrectangle_1bpp.c
|
||||
TFILL_CSRC := nxglib_filltrapezoid_1bpp.c
|
||||
RMOVE_CSRC := nxglib_moverectangle_1bpp.c
|
||||
RCOPY_CSRC := nxglib_copyrectangle_1bpp.c
|
||||
|
|
@ -48,6 +49,7 @@ ifeq ($(NXGLIB_BITSPERPIXEL),2)
|
|||
NXGLIB_SUFFIX := _2bpp
|
||||
SETP_CSRC := nxglib_setpixel_2bpp.c
|
||||
RFILL_CSRC := nxglib_fillrectangle_2bpp.c
|
||||
RGET_CSRC := nxglib_getrectangle_2bpp.c
|
||||
TFILL_CSRC := nxglib_filltrapezoid_2bpp.c
|
||||
RMOVE_CSRC := nxglib_moverectangle_2bpp.c
|
||||
RCOPY_CSRC := nxglib_copyrectangle_2bpp.c
|
||||
|
|
@ -56,6 +58,7 @@ ifeq ($(NXGLIB_BITSPERPIXEL),4)
|
|||
NXGLIB_SUFFIX := _4bpp
|
||||
SETP_CSRC := nxglib_setpixel_4bpp.c
|
||||
RFILL_CSRC := nxglib_fillrectangle_4bpp.c
|
||||
RGET_CSRC := nxglib_getrectangle_4bpp.c
|
||||
TFILL_CSRC := nxglib_filltrapezoid_4bpp.c
|
||||
RMOVE_CSRC := nxglib_moverectangle_4bpp.c
|
||||
RCOPY_CSRC := nxglib_copyrectangle_4bpp.c
|
||||
|
|
@ -64,6 +67,7 @@ ifeq ($(NXGLIB_BITSPERPIXEL),8)
|
|||
NXGLIB_SUFFIX := _8bpp
|
||||
SETP_CSRC := nxglib_setpixel_8bpp.c
|
||||
RFILL_CSRC := nxglib_fillrectangle_8bpp.c
|
||||
RGET_CSRC := nxglib_getrectangle_8bpp.c
|
||||
TFILL_CSRC := nxglib_filltrapezoid_8bpp.c
|
||||
RMOVE_CSRC := nxglib_moverectangle_8bpp.c
|
||||
RCOPY_CSRC := nxglib_copyrectangle_8bpp.c
|
||||
|
|
@ -72,6 +76,7 @@ ifeq ($(NXGLIB_BITSPERPIXEL),16)
|
|||
NXGLIB_SUFFIX := _16bpp
|
||||
SETP_CSRC := nxglib_setpixel_16bpp.c
|
||||
RFILL_CSRC := nxglib_fillrectangle_16bpp.c
|
||||
RGET_CSRC := nxglib_getrectangle_16bpp.c
|
||||
TFILL_CSRC := nxglib_filltrapezoid_16bpp.c
|
||||
RMOVE_CSRC := nxglib_moverectangle_16bpp.c
|
||||
RCOPY_CSRC := nxglib_copyrectangle_16bpp.c
|
||||
|
|
@ -80,6 +85,7 @@ ifeq ($(NXGLIB_BITSPERPIXEL),24)
|
|||
NXGLIB_SUFFIX := _24bpp
|
||||
SETP_CSRC := nxglib_setpixel_24bpp.c
|
||||
RFILL_CSRC := nxglib_fillrectangle_24bpp.c
|
||||
RGET_CSRC := nxglib_getrectangle_24bpp.c
|
||||
TFILL_CSRC := nxglib_filltrapezoid_24bpp.c
|
||||
RMOVE_CSRC := nxglib_moverectangle_24bpp.c
|
||||
RCOPY_CSRC := nxglib_copyrectangle_24bpp.c
|
||||
|
|
@ -88,6 +94,7 @@ ifeq ($(NXGLIB_BITSPERPIXEL),32)
|
|||
NXGLIB_SUFFIX := _32bpp
|
||||
SETP_CSRC := nxglib_setpixel_32bpp.c
|
||||
RFILL_CSRC := nxglib_fillrectangle_32bpp.c
|
||||
RGET_CSRC := nxglib_getrectangle_32bpp.c
|
||||
TFILL_CSRC := nxglib_filltrapezoid_32bpp.c
|
||||
RMOVE_CSRC := nxglib_moverectangle_32bpp.c
|
||||
RCOPY_CSRC := nxglib_copyrectangle_32bpp.c
|
||||
|
|
@ -98,11 +105,12 @@ CPPFLAGS += -DNXGLIB_SUFFIX=$(NXGLIB_SUFFIX)
|
|||
|
||||
SETP_TMP = $(SETP_CSRC:.c=.i)
|
||||
RFILL_TMP = $(RFILL_CSRC:.c=.i)
|
||||
RGET_TMP = $(RGET_CSRC:.c=.i)
|
||||
TFILL_TMP = $(TFILL_CSRC:.c=.i)
|
||||
RMOVE_TMP = $(RMOVE_CSRC:.c=.i)
|
||||
RCOPY_TMP = $(RCOPY_CSRC:.c=.i)
|
||||
|
||||
GEN_CSRCS = $(SETP_CSRC) $(RFILL_CSRC) $(TFILL_CSRC) $(RMOVE_CSRC) $(RCOPY_CSRC)
|
||||
GEN_CSRCS = $(SETP_CSRC) $(RFILL_CSRC) $(RGET_CSRC) $(TFILL_CSRC) $(RMOVE_CSRC) $(RCOPY_CSRC)
|
||||
|
||||
ifeq ($(CONFIG_NX_LCDDRIVER),y)
|
||||
BLITDIR = lcd
|
||||
|
|
@ -127,6 +135,13 @@ ifneq ($(NXGLIB_BITSPERPIXEL),)
|
|||
@rm -f $(RFILL_TMP)
|
||||
endif
|
||||
|
||||
$(RGET_CSRC) : $(BLITDIR)/nxglib_getrectangle.c nxglib_bitblit.h
|
||||
ifneq ($(NXGLIB_BITSPERPIXEL),)
|
||||
@$(call PREPROCESS, $(BLITDIR)/nxglib_getrectangle.c, $(RGET_TMP))
|
||||
@cat $(RGET_TMP) | sed -e "/^#/d" >$@
|
||||
@rm -f $(RGET_TMP)
|
||||
endif
|
||||
|
||||
$(TFILL_CSRC) : $(BLITDIR)/nxglib_filltrapezoid.c nxglib_bitblit.h
|
||||
ifneq ($(NXGLIB_BITSPERPIXEL),)
|
||||
@$(call PREPROCESS, $(BLITDIR)/nxglib_filltrapezoid.c, $(TFILL_TMP))
|
||||
|
|
@ -154,7 +169,7 @@ clean:
|
|||
distclean: clean
|
||||
@rm -f nxglib_setpixel_*bpp.c
|
||||
@rm -f nxglib_fillrectangle_*bpp.c
|
||||
@rm -f nxglib_getrectangle_*bpp.c
|
||||
@rm -f nxglib_filltrapezoid_*bpp.c
|
||||
@rm -f nxglib_moverectangle_*bpp.c
|
||||
@rm -f nxglib_copyrectangle_*bpp.c
|
||||
|
||||
|
|
|
|||
201
graphics/nxglib/fb/nxglib_getrectangle.c
Normal file
201
graphics/nxglib/fb/nxglib_getrectangle.c
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxglib/fb/nxglib_getrectangle.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/fb.h>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
||||
#include "nxglib_bitblit.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxgl_lowresmemcpy
|
||||
****************************************************************************/
|
||||
|
||||
#if NXGLIB_BITSPERPIXEL < 8
|
||||
static inline void nxgl_lowresmemcpy(FAR uint8_t *dline, FAR const uint8_t *sline,
|
||||
unsigned int width,
|
||||
uint8_t leadmask, uint8_t tailmask)
|
||||
{
|
||||
FAR const uint8_t *sptr;
|
||||
FAR uint8_t *dptr;
|
||||
uint8_t mask;
|
||||
int lnlen;
|
||||
|
||||
/* Handle masking of the fractional initial byte */
|
||||
|
||||
mask = leadmask;
|
||||
sptr = sline;
|
||||
dptr = dline;
|
||||
lnlen = width;
|
||||
|
||||
if (lnlen > 1 && mask)
|
||||
{
|
||||
dptr[0] = (dptr[0] & ~mask) | (sptr[0] & mask);
|
||||
mask = 0xff;
|
||||
dptr++;
|
||||
sptr++;
|
||||
lnlen--;
|
||||
}
|
||||
|
||||
/* Handle masking of the fractional final byte */
|
||||
|
||||
mask &= tailmask;
|
||||
if (lnlen > 0 && mask)
|
||||
{
|
||||
dptr[lnlen-1] = (dptr[lnlen-1] & ~mask) | (sptr[lnlen-1] & mask);
|
||||
lnlen--;
|
||||
}
|
||||
|
||||
/* Handle all of the unmasked bytes in-between */
|
||||
|
||||
if (lnlen > 0)
|
||||
{
|
||||
NXGL_MEMCPY(dptr, sptr, lnlen);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxgl_getrectangle_*bpp
|
||||
*
|
||||
* Descripton:
|
||||
* Fetch a rectangular region from framebuffer memory. The source is
|
||||
* expressed as a rectangle.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void NXGL_FUNCNAME(nxgl_getrectangle,NXGLIB_SUFFIX)
|
||||
(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride)
|
||||
{
|
||||
FAR const uint8_t *sline;
|
||||
FAR uint8_t *dline;
|
||||
unsigned int width;
|
||||
unsigned int fbstride;
|
||||
unsigned int rows;
|
||||
|
||||
#if NXGLIB_BITSPERPIXEL < 8
|
||||
uint8_t leadmask;
|
||||
uint8_t tailmask;
|
||||
#endif
|
||||
|
||||
/* Get the width of the framebuffer in bytes */
|
||||
|
||||
fbstride = pinfo->stride;
|
||||
|
||||
/* Get the dimensions of the rectange to copy: width in pixels, height
|
||||
* in rows
|
||||
*/
|
||||
|
||||
width = rect->pt2.x - rect->pt1.x + 1;
|
||||
rows = rect->pt2.y - rect->pt1.y + 1;
|
||||
|
||||
#if NXGLIB_BITSPERPIXEL < 8
|
||||
# ifdef CONFIG_NX_PACKEDMSFIRST
|
||||
|
||||
/* Get the mask for pixels that are ordered so that they pack from the
|
||||
* MS byte down.
|
||||
*/
|
||||
|
||||
leadmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x)));
|
||||
tailmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt2.x-1)));
|
||||
# else
|
||||
/* Get the mask for pixels that are ordered so that they pack from the
|
||||
* LS byte up.
|
||||
*/
|
||||
|
||||
leadmask = (uint8_t)(0xff << (8 - NXGL_REMAINDERX(rect->pt1.x)));
|
||||
tailmask = (uint8_t)(0xff >> (8 - NXGL_REMAINDERX(rect->pt1.x-1)));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* sline = address of the first pixel in the top row of the source in
|
||||
* framebuffer memory
|
||||
*/
|
||||
|
||||
sline = pinfo->fbmem + rect->pt1.y * fbstride + NXGL_SCALEX(rect->pt1.x);
|
||||
|
||||
/* dline = address of the first row pixel */
|
||||
|
||||
dline = (FAR uint8_t *)dest;
|
||||
|
||||
/* Yes.. Copy the rectangle */
|
||||
|
||||
while (rows--)
|
||||
{
|
||||
/* Copy the row */
|
||||
|
||||
#if NXGLIB_BITSPERPIXEL < 8
|
||||
nxgl_lowresmemcpy(dline, sline, width, leadmask, tailmask);
|
||||
#else
|
||||
NXGL_MEMCPY(dline, sline, width);
|
||||
#endif
|
||||
/* Point to the next source/dest row below the current one */
|
||||
|
||||
dline += deststride;
|
||||
sline += fbstride;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* graphics/nxglib/fb/nxglib_setpixel.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
|
|||
105
graphics/nxglib/lcd/nxglib_getrectangle.c
Normal file
105
graphics/nxglib/lcd/nxglib_getrectangle.c
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxglib/lcd/nxglib_getrectangle.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nuttx/lcd/lcd.h>
|
||||
#include <nuttx/nx/nxglib.h>
|
||||
|
||||
#include "nxglib_bitblit.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxgl_moverectangle_*bpp
|
||||
*
|
||||
* Descripton:
|
||||
* Fetch a rectangular region from LCD GRAM memory. The source is
|
||||
* expressed as a rectangle.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void NXGL_FUNCNAME(nxgl_getrectangle,NXGLIB_SUFFIX)
|
||||
(FAR struct fb_planeinfo_s *pinfo, FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride)
|
||||
{
|
||||
FAR uint8_t *dline;
|
||||
unsigned int ncols;
|
||||
unsigned int srcrow;
|
||||
|
||||
/* Get the width of the rectange to move in pixels. */
|
||||
|
||||
ncols = rect->pt2.x - rect->pt1.x + 1;
|
||||
|
||||
/* dline = address of the first row pixel */
|
||||
|
||||
dline = (FAR uint8_t *)dest;
|
||||
|
||||
/* Copy the rectangle */
|
||||
|
||||
for (srcrow = rect->pt1.y; srcrow <= rect->pt2.y; srcrow++)
|
||||
{
|
||||
(void)pinfo->getrun(srcrow, rect->pt1.x, dline, ncols);
|
||||
dline += deststride;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* graphics/nxglib/lcd/nxglib_setpixel.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
NX_ASRCS =
|
||||
NXAPI_CSRCS = nx_bitmap.c nx_closewindow.c nx_connect.c nx_disconnect.c \
|
||||
nx_eventhandler.c nx_eventnotify.c nx_fill.c nx_filltrapezoid.c \
|
||||
nx_getposition.c nx_kbdchin.c nx_kbdin.c nx_lower.c \
|
||||
nx_getposition.nx_getrectanble.c nx_kbdchin.c nx_kbdin.c nx_lower.c \
|
||||
nx_mousein.c nx_move.c nx_openwindow.c nx_raise.c \
|
||||
nx_releasebkgd.c nx_requestbkgd.c nx_setpixel.c nx_setsize.c \
|
||||
nx_setbgcolor.c nx_setposition.c nx_drawcircle.c nx_drawline.c
|
||||
|
|
|
|||
137
graphics/nxmu/nx_getrectangle.c
Normal file
137
graphics/nxmu/nx_getrectangle.c
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxmu/nx_getrectangle.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_getrectangle
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride)
|
||||
{
|
||||
FAR struct nxbe_window_s *wnd = (FAR struct nxbe_window_s *)hwnd;
|
||||
struct nxsvrmsg_getrectangle_s outmsg;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!hwnd || !rect || !dest)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!wnd || !wnd->conn || !rect || !color)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Format the fill command */
|
||||
|
||||
outmsg.msgid = NX_SVRMSG_GETRECTANGLE;
|
||||
outmsg.wnd = wnd;
|
||||
outmsg.plane = plane;
|
||||
outmsg.dest = dest;
|
||||
outmsg.deststride = deststride;
|
||||
|
||||
nxgl_rectcopy(&outmsg.rect, rect);
|
||||
|
||||
/* Forward the fill command to the server */
|
||||
|
||||
ret = mq_send(wnd->conn->cwrmq, &outmsg, sizeof(struct nxsvrmsg_getrectangle_s), NX_SVRMSG_PRIO);
|
||||
if (ret < 0)
|
||||
{
|
||||
gdbg("mq_send failed: %d\n", errno);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -162,6 +162,7 @@ enum nxmsg_e
|
|||
NX_SVRMSG_LOWER, /* Move the window to the bottom */
|
||||
NX_SVRMSG_SETPIXEL, /* Set a single pixel in the window with a color */
|
||||
NX_SVRMSG_FILL, /* Fill a rectangle in the window with a color */
|
||||
NX_SVRMSG_GETRECTANGLE, /* Get a rectangular region in the window */
|
||||
NX_SVRMSG_FILLTRAP, /* Fill a trapezoidal region in the window with a color */
|
||||
NX_SVRMSG_MOVE, /* Move a rectangular region within the window */
|
||||
NX_SVRMSG_BITMAP, /* Copy a rectangular bitmap into the window */
|
||||
|
|
@ -355,6 +356,18 @@ struct nxsvrmsg_fill_s
|
|||
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]; /* Color to use in the fill */
|
||||
};
|
||||
|
||||
/* Get a rectangular region from the the window */
|
||||
|
||||
struct nxsvrmsg_getrectangle_s
|
||||
{
|
||||
uint32_t msgid; /* NX_SVRMSG_GETRECTANGLE */
|
||||
FAR struct nxbe_window_s *wnd; /* The window to get from */
|
||||
struct nxgl_rect_s rect; /* The rectangle in the window to get from */
|
||||
unsigned int plane; /* The plane number to read */
|
||||
FAR uint8_t *dest; /* Memory location in which to store the graphics data */
|
||||
unsigned int deststride; /* Width of the destination memory in bytes */
|
||||
};
|
||||
|
||||
/* Fill a trapezoidal region in the window with a color */
|
||||
|
||||
struct nxsvrmsg_filltrapezoid_s
|
||||
|
|
|
|||
|
|
@ -447,6 +447,13 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
|
|||
}
|
||||
break;
|
||||
|
||||
case NX_SVRMSG_GETRECTANGLE: /* Get a rectangular region from the window */
|
||||
{
|
||||
FAR struct nxsvrmsg_getrectangle_s *getmsg = (FAR struct nxsvrmsg_getrectangle_s *)buffer;
|
||||
nxbe_getrectangle(getmsg->wnd, &getmsg->rect, getmsg->plane, getmsg->dest, getmsg->deststride);
|
||||
}
|
||||
break;
|
||||
|
||||
case NX_SVRMSG_FILLTRAP: /* Fill a trapezoidal region in the window with a color */
|
||||
{
|
||||
FAR struct nxsvrmsg_filltrapezoid_s *trapmsg = (FAR struct nxsvrmsg_filltrapezoid_s *)buffer;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
NX_ASRCS =
|
||||
NXAPI_CSRCS = nx_bitmap.c nx_close.c nx_closewindow.c nx_fill.c \
|
||||
nx_filltrapezoid.c nx_getposition.c nx_kbdchin.c \
|
||||
nx_filltrapezoid.c nx_getposition.c nx_getrectangle.c nx_kbdchin.c \
|
||||
nx_kbdin.c nx_lower.c nx_mousein.c nx_move.c nx_open.c \
|
||||
nx_openwindow.c nx_raise.c nx_releasebkgd.c nx_requestbkgd.c \
|
||||
nx_setpixel.c nx_setsize.c nx_setbgcolor.c nx_setposition.c \
|
||||
|
|
|
|||
108
graphics/nxsu/nx_getrectangle.c
Normal file
108
graphics/nxsu/nx_getrectangle.c
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxsu/nx_getrectangle.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_getrectangle
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!hwnd || !rect || !dest)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
return nxbe_getrectangle((FAR struct nxbe_window_s *)hwnd, rect, plane, dest, deststride);
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# graphics/nxtk/Make.defs
|
||||
#
|
||||
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
|
|
@ -36,11 +36,13 @@
|
|||
NXTK_ASRCS =
|
||||
NXTKWIN_CSRCS = nxtk_openwindow.c nxtk_closewindow.c nxtk_getposition.c \
|
||||
nxtk_setposition.c nxtk_setsize.c nxtk_raise.c nxtk_lower.c \
|
||||
nxtk_fillwindow.c nxtk_filltrapwindow.c nxtk_movewindow.c \
|
||||
nxtk_bitmapwindow.c nxtk_events.c nxtk_setsubwindows.c \
|
||||
nxtk_drawcirclewindow.c nxtk_drawlinewindow.c nxtk_fillcirclewindow.c
|
||||
nxtk_fillwindow.c nxtk_getwindow.c nxtk_filltrapwindow.c \
|
||||
nxtk_movewindow.c nxtk_bitmapwindow.c nxtk_events.c \
|
||||
nxtk_setsubwindows.c nxtk_drawcirclewindow.c nxtk_drawlinewindow.c \
|
||||
nxtk_fillcirclewindow.c
|
||||
NXTKTB_CSRCS = nxtk_opentoolbar.c nxtk_closetoolbar.c nxtk_filltoolbar.c \
|
||||
nxtk_filltraptoolbar.c nxtk_movetoolbar.c nxtk_bitmaptoolbar.c \
|
||||
nxtk_drawcircletoolbar.c nxtk_drawlinetoolbar.c nxtk_fillcircletoolbar.c
|
||||
nxtk_gettoolbar.c nxtk_filltraptoolbar.c nxtk_movetoolbar.c \
|
||||
nxtk_bitmaptoolbar.c nxtk_drawcircletoolbar.c nxtk_drawlinetoolbar.c \
|
||||
nxtk_fillcircletoolbar.c
|
||||
NXTK_CSRCS = $(NXTKWIN_CSRCS) $(NXTKTB_CSRCS) nxtk_subwindowclip.c \
|
||||
nxtk_containerclip.c nxtk_subwindowmove.c nxtk_drawframe.c
|
||||
|
|
|
|||
122
graphics/nxtk/nxtk_gettoolbar.c
Normal file
122
graphics/nxtk/nxtk_gettoolbar.c
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxtk/nxtk_gettoolbar.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxtk.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
#include "nxtk_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxtk_gettoolbar
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxtk_gettoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride)
|
||||
{
|
||||
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
|
||||
struct nxgl_rect_s getrect;
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!hwnd || !rect || !dest)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clip the rectangle so that it lies within the sub-window bounds
|
||||
* then move the rectangle to that it is relative to the containing
|
||||
* window.
|
||||
*/
|
||||
|
||||
nxtk_subwindowclip(fwnd, &getrect, rect, &fwnd->tbrect);
|
||||
|
||||
/* Then get it */
|
||||
|
||||
return nx_getrectangle((NXWINDOW)hfwnd, &getrect, plane, dest, deststride);
|
||||
}
|
||||
122
graphics/nxtk/nxtk_getwindow.c
Normal file
122
graphics/nxtk/nxtk_getwindow.c
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/****************************************************************************
|
||||
* graphics/nxtk/nxtk_getwindow.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/nx/nx.h>
|
||||
#include <nuttx/nx/nxtk.h>
|
||||
|
||||
#include "nxfe.h"
|
||||
#include "nxtk_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-Processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxtk_getwindow
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride)
|
||||
{
|
||||
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
|
||||
struct nxgl_rect_s getrect;
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
if (!hwnd || !rect || !dest)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clip the rectangle so that it lies within the sub-window bounds
|
||||
* then move the rectangle to that it is relative to the containing
|
||||
* window.
|
||||
*/
|
||||
|
||||
nxtk_subwindowclip(fwnd, &getrect, rect, &fwnd->fwrect);
|
||||
|
||||
/* Then get it */
|
||||
|
||||
return nx_getrectangle((NXWINDOW)hfwnd, &getrect, plane, dest, deststride);
|
||||
}
|
||||
|
|
@ -613,6 +613,35 @@ EXTERN int nx_setpixel(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
|
|||
EXTERN int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_getrectangle
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Input Parameters:
|
||||
* hwnd - The window handle
|
||||
* rect - The location to be filled
|
||||
* color - The color to use in the fill
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void nx_getrectangle(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_filltrapezoid
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ EXTERN void nxgl_yuv2rgb(uint8_t y, uint8_t u, uint8_t v,
|
|||
* Name: nxgl_setpixel_*bpp
|
||||
*
|
||||
* Descripton:
|
||||
* Draw a single pixel in graphics memory memory at the given position and
|
||||
* Draw a single pixel in graphics memory at the given position and
|
||||
* with the given color. This is equivalent to nxgl_fillrectangle_*bpp()
|
||||
* with a 1x1 rectangle but is more efficient.
|
||||
*
|
||||
|
|
@ -280,11 +280,42 @@ EXTERN void nxgl_fillrectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo,
|
|||
FAR const struct nxgl_rect_s *rect,
|
||||
uint32_t color);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxgl_getrectangle_*bpp
|
||||
*
|
||||
* Descripton:
|
||||
* Fetch a rectangular region from graphics memory. The source is
|
||||
* expressed as a rectangle.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void nxgl_getrectangle_1bpp(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
EXTERN void nxgl_getrectangle_2bpp(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
EXTERN void nxgl_getrectangle_4bpp(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
EXTERN void nxgl_getrectangle_8bpp(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
EXTERN void nxgl_getrectangle_16bpp(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
EXTERN void nxgl_getrectangle_24bpp(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
EXTERN void nxgl_getrectangle_32bpp(FAR struct fb_planeinfo_s *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect,
|
||||
FAR void *dest, unsigned int deststride);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxglib_filltrapezoid_*bpp
|
||||
*
|
||||
* Descripton:
|
||||
* Fill a trapezoidal region in the framebuffer memory with a fixed color.
|
||||
* Fill a trapezoidal region in the graphics memory with a fixed color.
|
||||
* Clip the trapezoid to lie within a boundng box. This is useful for
|
||||
* drawing complex shapes that can be broken into a set of trapezoids.
|
||||
*
|
||||
|
|
@ -357,7 +388,7 @@ EXTERN void nxgl_moverectangle_32bpp(FAR NX_PLANEINFOTYPE *pinfo,
|
|||
*
|
||||
* Descripton:
|
||||
* Copy a rectangular bitmap image into the specific position in the
|
||||
* framebuffer memory.
|
||||
* graphics memory.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* include/nuttx/nx/nxtk.h
|
||||
*
|
||||
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
|
@ -220,6 +220,31 @@ EXTERN int nxtk_lower(NXTKWINDOW hfwnd);
|
|||
EXTERN int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxtk_getwindow
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void nxtk_getwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxtk_filltrapwindow
|
||||
*
|
||||
|
|
@ -416,6 +441,31 @@ EXTERN int nxtk_closetoolbar(NXTKWINDOW hfwnd);
|
|||
EXTERN int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxtk_gettoolbar
|
||||
*
|
||||
* Description:
|
||||
* Get the raw contents of graphic memory within a rectangular region. NOTE:
|
||||
* Since raw graphic memory is returned, the returned memory content may be
|
||||
* the memory of windows above this one and may not necessarily belong to
|
||||
* this window unless you assure that this is the top window.
|
||||
*
|
||||
* Input Parameters:
|
||||
* wnd - The window structure reference
|
||||
* rect - The location to be copied
|
||||
* plane - Specifies the color plane to get from.
|
||||
* dest - The location to copy the memory region
|
||||
* deststride - The width, in bytes, the the dest memory
|
||||
*
|
||||
* Return:
|
||||
* OK on success; ERROR on failure with errno set appropriately
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN void nxtk_gettoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
|
||||
unsigned int plane, FAR uint8_t *dest,
|
||||
unsigned int deststride);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nxtk_filltraptoolbar
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue