diff --git a/ChangeLog b/ChangeLog index be0d29dc7a..2d1e08bd3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/Documentation/NXGraphicsSubsystem.html b/Documentation/NXGraphicsSubsystem.html index 6c3ccf7bba..3a99eb1e11 100644 --- a/Documentation/NXGraphicsSubsystem.html +++ b/Documentation/NXGraphicsSubsystem.html @@ -12,7 +12,7 @@
Last Updated: September 28, 2011
+Last Updated: October 22, 2011
@@ -115,15 +115,16 @@ 2.3.18nx_raise()nx_lower()nx_fill()nx_filltrapezoid()nx_drawline()nx_drawcircle()nx_fillcircle()nx_setbgcolor()nx_move()nx_bitmap()nx_kbdin()nx_mousein()nx_getrectangle()nx_filltrapezoid()nx_drawline()nx_drawcircle()nx_fillcircle()nx_setbgcolor()nx_move()nx_bitmap()nx_kbdin()nx_mousein()nxtk_raise()nxtk_lower()nxtk_fillwindow()nxtk_filltrapwindow()nxtk_drawlinewindow()nxtk_drawcirclewindow()nxtk_fillcirclewindow()nxtk_movewindow()nxtk_bitmapwindow()nxtk_opentoolbar()nxtk_closetoolbar()nxtk_filltoolbar()nxtk_filltraptoolbar()nxtk_drawlinetoolbar()nxtk_drawcircletoolbar()nxtk_fillcircletoolbar()nxtk_movetoolbar()nxtk_bitmaptoolbar()
+ 2.4.10 nxtk_getwindow()nxtk_filltrapwindow()nxtk_drawlinewindow()nxtk_drawcirclewindow()nxtk_fillcirclewindow()nxtk_movewindow()nxtk_bitmapwindow()nxtk_opentoolbar()nxtk_closetoolbar()nxtk_filltoolbar()nxtk_gettoolbar()nxtk_filltraptoolbar()nxtk_drawlinetoolbar()nxtk_drawcircletoolbar()nxtk_fillcircletoolbar()nxtk_movetoolbar()nxtk_bitmaptoolbar()
@@ -1674,7 +1677,47 @@ int nx_fill(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
ERROR on failure with errno set appropriately
nx_filltrapezoid()nx_getrectangle()Function Prototype:
++#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); ++
+ 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: +
hwnd
+ nx_openwindow()
+ or nx_requestbkgd()
+ rect
+ plane
+ dest
+ deststride
+
+ Returned Value:
+ OK on success;
+ ERROR on failure with errno set appropriately
+
nx_filltrapezoid()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1708,7 +1751,7 @@ int nx_filltrapezoid(NXWINDOW hwnd, FAR const struct nxgl_rect_s *clip,ERRORon failure witherrnoset appropriately -2.3.22
+nx_drawline()2.3.23
nx_drawline()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1744,7 +1787,7 @@ int nx_drawline(NXWINDOW hwnd, FAR struct nxgl_vector_s *vector,ERRORon failure witherrnoset appropriately -2.3.23
+nx_drawcircle()2.3.24
nx_drawcircle()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1780,7 +1823,7 @@ int nx_drawcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,ERRORon failure witherrnoset appropriately -2.3.24
+nx_fillcircle()2.3.25
nx_fillcircle()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1813,7 +1856,7 @@ int nx_fillcircle(NXWINDOW hwnd, FAR const struct nxgl_point_s *center,ERRORon failure witherrnoset appropriately -2.3.25
+nx_setbgcolor()2.3.26
nx_setbgcolor()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1841,7 +1884,7 @@ int nx_setbgcolor(NXHANDLE handle,ERRORon failure witherrnoset appropriately -2.3.26
+nx_move()2.3.27
nx_move()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1872,7 +1915,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,ERRORon failure witherrnoset appropriately -2.3.27
+nx_bitmap()2.3.28
nx_bitmap()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1914,7 +1957,7 @@ int nx_bitmap(NXWINDOW hwnd, FAR const struct nxgl_rect_s *dest,ERRORon failure witherrnoset appropriately -2.3.28
+nx_kbdin()2.3.29
nx_kbdin()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -1937,7 +1980,7 @@ int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch);ERRORon failure witherrnoset appropriately -2.3.29
+nx_mousein()2.3.30
nx_mousein()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2260,7 +2303,47 @@ int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,ERRORon failure witherrnoset appropriately -2.4.10
+nxtk_filltrapwindow()2.4.10
+nxtk_getwindow()Function Prototype:
+
+#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); ++
+ 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: +
hfwnd
+ nxtk_openwindow().
+ rect
+ plane
+ dest
+ deststride
+
+ Returned Value:
+ OK on success;
+ ERROR on failure with errno set appropriately
+
nxtk_filltrapwindow()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2293,7 +2376,7 @@ int nxtk_filltrapwindow(NXTKWINDOW hfwnd,ERRORon failure witherrnoset appropriately -2.4.11
+nxtk_drawlinewindow()2.4.12
nxtk_drawlinewindow()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2330,7 +2413,7 @@ int nxtk_drawlinewindow(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,ERRORon failure witherrnoset appropriately -2.4.12
+nxtk_drawcirclewindow()2.4.13
nxtk_drawcirclewindow()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2366,7 +2449,7 @@ int nxtk_drawcirclewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *centeERRORon failure witherrnoset appropriately -2.4.13
+nxtk_fillcirclewindow()2.4.14
nxtk_fillcirclewindow()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2399,7 +2482,7 @@ int nxtk_fillcirclewindow(NXWINDOW hfwnd, FAR const struct nxgl_point_s *center,ERRORon failure witherrnoset appropriately -2.4.14
+nxtk_movewindow()2.4.15
nxtk_movewindow()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2432,7 +2515,7 @@ int nxtk_movewindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,ERRORon failure witherrnoset appropriately -2.4.15
+nxtk_bitmapwindow()2.4.16
nxtk_bitmapwindow()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2477,7 +2560,7 @@ int nxtk_bitmapwindow(NXTKWINDOW hfwnd,ERRORon failure witherrnoset appropriately -2.4.16
+nxtk_opentoolbar()2.4.17
nxtk_opentoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2512,7 +2595,7 @@ int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,ERRORon failure witherrnoset appropriately -2.4.17
+nxtk_closetoolbar()2.4.18
nxtk_closetoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2541,7 +2624,7 @@ int nxtk_closetoolbar(NXTKWINDOW hfwnd);ERRORon failure witherrnoset appropriately -2.4.18
+nxtk_filltoolbar()2.4.19
nxtk_filltoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2573,7 +2656,48 @@ int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,ERRORon failure witherrnoset appropriately -2.4.19
+nxtk_filltraptoolbar()2.4.19
+nxtk_gettoolbar()Function Prototype:
+
+#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); ++
+ 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: +
hfwnd
+ nxtk_openwindow().
+ rect
+ plane
+ dest
+ deststride
+
+ Returned Value:
+ OK on success;
+ ERROR on failure with errno set appropriately
+
nxtk_filltraptoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2605,7 +2729,7 @@ int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *trERRORon failure witherrnoset appropriately -2.4.20
+nxtk_drawlinetoolbar()2.4.22
nxtk_drawlinetoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2642,7 +2766,7 @@ int nxtk_drawlinetoolbar(NXTKWINDOW hfwnd, FAR struct nxgl_vector_s *vector,ERRORon failure witherrnoset appropriately -2.4.21
+nxtk_drawcircletoolbar()2.4.23
nxtk_drawcircletoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2678,7 +2802,7 @@ int nxtk_drawcircletoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_point_s *centERRORon failure witherrnoset appropriately -2.4.22
+nxtk_fillcircletoolbar()2.4.24
nxtk_fillcircletoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2711,7 +2835,7 @@ int nxtk_fillcircletoolbar(NXWINDOW hfwnd, FAR const struct nxgl_point_s *centerERRORon failure witherrnoset appropriately -2.4.23
+nxtk_movetoolbar()2.4.25
nxtk_movetoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h> @@ -2745,7 +2869,7 @@ int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,ERRORon failure witherrnoset appropriately -2.4.24
+nxtk_bitmaptoolbar()2.4.26
nxtk_bitmaptoolbar()Function Prototype:
#include <nuttx/nx/nxglib.h>
@@ -3764,6 +3888,11 @@ sudo ln -s libXext.so.6.4.0 libXext.so
<NuttX-Directory>/.config file
YES
+
+ nx_getrectangle()
+
+ YES
+
nx_filltrapezoid()
@@ -3869,6 +3998,11 @@ sudo ln -s libXext.so.6.4.0 libXext.so
YES
+
+ nxtk_getwindow()
+
+ NO
+
nxtk_filltrapwindow()
@@ -3914,6 +4048,11 @@ sudo ln -s libXext.so.6.4.0 libXext.so
YES
+
+ nxtk_gettoolbar()
+
+ NO
+
nxtk_filltraptoolbar()
diff --git a/graphics/nxbe/Make.defs b/graphics/nxbe/Make.defs
index 4003715b59..53fdf96640 100644
--- a/graphics/nxbe/Make.defs
+++ b/graphics/nxbe/Make.defs
@@ -1,8 +1,8 @@
############################################################################
# graphics/nxbe/Make.defs
#
-# Copyright (C) 2008 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt
+# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt
#
# 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
diff --git a/graphics/nxbe/nxbe.h b/graphics/nxbe/nxbe.h
index 5d9cd26959..877754782d 100644
--- a/graphics/nxbe/nxbe.h
+++ b/graphics/nxbe/nxbe.h
@@ -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
*
diff --git a/graphics/nxbe/nxbe_configure.c b/graphics/nxbe/nxbe_configure.c
index fc694f4f30..80c71db3a5 100644
--- a/graphics/nxbe/nxbe_configure.c
+++ b/graphics/nxbe/nxbe_configure.c
@@ -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;
diff --git a/graphics/nxbe/nxbe_getrectangle.c b/graphics/nxbe/nxbe_getrectangle.c
new file mode 100644
index 0000000000..f3f01d1925
--- /dev/null
+++ b/graphics/nxbe/nxbe_getrectangle.c
@@ -0,0 +1,149 @@
+/****************************************************************************
+ * graphics/nxbe/nxbe_fill.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+
+#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);
+}
diff --git a/graphics/nxglib/Make.defs b/graphics/nxglib/Make.defs
index 9dd4c83f75..240cdbd7cb 100644
--- a/graphics/nxglib/Make.defs
+++ b/graphics/nxglib/Make.defs
@@ -1,8 +1,8 @@
############################################################################
# graphics/nxglib/Make.defs
#
-# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt
+# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt
#
# 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)
diff --git a/graphics/nxglib/Makefile.sources b/graphics/nxglib/Makefile.sources
index 8e63f434ad..67f8defc31 100644
--- a/graphics/nxglib/Makefile.sources
+++ b/graphics/nxglib/Makefile.sources
@@ -1,8 +1,8 @@
############################################################################
# graphics/nxglib/Makefile.sources
#
-# Copyright (C) 2008, 2010 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt
+# Copyright (C) 2008, 2010-2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt
#
# 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
-
diff --git a/graphics/nxglib/fb/nxglib_getrectangle.c b/graphics/nxglib/fb/nxglib_getrectangle.c
new file mode 100644
index 0000000000..82e541ec54
--- /dev/null
+++ b/graphics/nxglib/fb/nxglib_getrectangle.c
@@ -0,0 +1,201 @@
+/****************************************************************************
+ * graphics/nxglib/fb/nxglib_getrectangle.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+
+#include
+#include
+
+#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;
+ }
+}
diff --git a/graphics/nxglib/fb/nxglib_setpixel.c b/graphics/nxglib/fb/nxglib_setpixel.c
index bd34f8f436..7079b7e573 100644
--- a/graphics/nxglib/fb/nxglib_setpixel.c
+++ b/graphics/nxglib/fb/nxglib_setpixel.c
@@ -2,7 +2,7 @@
* graphics/nxglib/fb/nxglib_setpixel.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
+ * Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/graphics/nxglib/lcd/nxglib_getrectangle.c b/graphics/nxglib/lcd/nxglib_getrectangle.c
new file mode 100644
index 0000000000..432d5531c6
--- /dev/null
+++ b/graphics/nxglib/lcd/nxglib_getrectangle.c
@@ -0,0 +1,105 @@
+/****************************************************************************
+ * graphics/nxglib/lcd/nxglib_getrectangle.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+
+#include
+#include
+
+#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;
+ }
+}
diff --git a/graphics/nxglib/lcd/nxglib_setpixel.c b/graphics/nxglib/lcd/nxglib_setpixel.c
index efe08fa10d..c5cff99a70 100644
--- a/graphics/nxglib/lcd/nxglib_setpixel.c
+++ b/graphics/nxglib/lcd/nxglib_setpixel.c
@@ -2,7 +2,7 @@
* graphics/nxglib/lcd/nxglib_setpixel.c
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
+ * Author: Gregory Nutt
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/graphics/nxmu/Make.defs b/graphics/nxmu/Make.defs
index 00feec64a5..6be702f111 100644
--- a/graphics/nxmu/Make.defs
+++ b/graphics/nxmu/Make.defs
@@ -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
diff --git a/graphics/nxmu/nx_getrectangle.c b/graphics/nxmu/nx_getrectangle.c
new file mode 100644
index 0000000000..19acae44af
--- /dev/null
+++ b/graphics/nxmu/nx_getrectangle.c
@@ -0,0 +1,137 @@
+/****************************************************************************
+ * graphics/nxmu/nx_getrectangle.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+#include
+#include
+
+#include
+
+#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;
+}
diff --git a/graphics/nxmu/nxfe.h b/graphics/nxmu/nxfe.h
index 1445b9fb50..b2f906f166 100644
--- a/graphics/nxmu/nxfe.h
+++ b/graphics/nxmu/nxfe.h
@@ -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
diff --git a/graphics/nxmu/nxmu_server.c b/graphics/nxmu/nxmu_server.c
index 47f855d31d..aa545c18f7 100644
--- a/graphics/nxmu/nxmu_server.c
+++ b/graphics/nxmu/nxmu_server.c
@@ -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;
diff --git a/graphics/nxsu/Make.defs b/graphics/nxsu/Make.defs
index 12885ebf14..d16fe549c0 100644
--- a/graphics/nxsu/Make.defs
+++ b/graphics/nxsu/Make.defs
@@ -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 \
diff --git a/graphics/nxsu/nx_getrectangle.c b/graphics/nxsu/nx_getrectangle.c
new file mode 100644
index 0000000000..2c3c589b76
--- /dev/null
+++ b/graphics/nxsu/nx_getrectangle.c
@@ -0,0 +1,108 @@
+/****************************************************************************
+ * graphics/nxsu/nx_getrectangle.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+#include
+#include
+
+#include
+
+#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);
+}
diff --git a/graphics/nxtk/Make.defs b/graphics/nxtk/Make.defs
index 782fbc9b6b..722613af4f 100644
--- a/graphics/nxtk/Make.defs
+++ b/graphics/nxtk/Make.defs
@@ -2,7 +2,7 @@
# graphics/nxtk/Make.defs
#
# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt
+# Author: Gregory Nutt
#
# 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
diff --git a/graphics/nxtk/nxtk_gettoolbar.c b/graphics/nxtk/nxtk_gettoolbar.c
new file mode 100644
index 0000000000..7d2b118405
--- /dev/null
+++ b/graphics/nxtk/nxtk_gettoolbar.c
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * graphics/nxtk/nxtk_gettoolbar.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+#include
+#include
+
+#include
+#include
+
+#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);
+}
diff --git a/graphics/nxtk/nxtk_getwindow.c b/graphics/nxtk/nxtk_getwindow.c
new file mode 100644
index 0000000000..88d1d4d0e0
--- /dev/null
+++ b/graphics/nxtk/nxtk_getwindow.c
@@ -0,0 +1,122 @@
+/****************************************************************************
+ * graphics/nxtk/nxtk_getwindow.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt
+ *
+ * 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
+
+#include
+#include
+#include
+
+#include
+#include
+
+#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);
+}
diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h
index d582256fb7..a4e9f5bafd 100644
--- a/include/nuttx/nx/nx.h
+++ b/include/nuttx/nx/nx.h
@@ -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
diff --git a/include/nuttx/nx/nxglib.h b/include/nuttx/nx/nxglib.h
index bf54b9029e..d94d6fe76f 100644
--- a/include/nuttx/nx/nxglib.h
+++ b/include/nuttx/nx/nxglib.h
@@ -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.
*
****************************************************************************/
diff --git a/include/nuttx/nx/nxtk.h b/include/nuttx/nx/nxtk.h
index 107d8677cc..c2f6c270d0 100644
--- a/include/nuttx/nx/nxtk.h
+++ b/include/nuttx/nx/nxtk.h
@@ -2,7 +2,7 @@
* include/nuttx/nx/nxtk.h
*
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt
+ * Author: Gregory Nutt
*
* 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
*