summaryrefslogtreecommitdiff
path: root/nuttx/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/graphics')
-rw-r--r--nuttx/graphics/nxbe/Make.defs14
-rw-r--r--nuttx/graphics/nxbe/nxbe.h29
-rw-r--r--nuttx/graphics/nxbe/nxbe_configure.c7
-rw-r--r--nuttx/graphics/nxbe/nxbe_getrectangle.c149
-rw-r--r--nuttx/graphics/nxglib/Make.defs16
-rw-r--r--nuttx/graphics/nxglib/Makefile.sources23
-rw-r--r--nuttx/graphics/nxglib/fb/nxglib_getrectangle.c201
-rw-r--r--nuttx/graphics/nxglib/fb/nxglib_setpixel.c2
-rw-r--r--nuttx/graphics/nxglib/lcd/nxglib_getrectangle.c105
-rw-r--r--nuttx/graphics/nxglib/lcd/nxglib_setpixel.c2
-rw-r--r--nuttx/graphics/nxmu/Make.defs2
-rw-r--r--nuttx/graphics/nxmu/nx_getrectangle.c137
-rw-r--r--nuttx/graphics/nxmu/nxfe.h13
-rw-r--r--nuttx/graphics/nxmu/nxmu_server.c7
-rw-r--r--nuttx/graphics/nxsu/Make.defs2
-rw-r--r--nuttx/graphics/nxsu/nx_getrectangle.c108
-rw-r--r--nuttx/graphics/nxtk/Make.defs14
-rw-r--r--nuttx/graphics/nxtk/nxtk_gettoolbar.c122
-rw-r--r--nuttx/graphics/nxtk/nxtk_getwindow.c122
19 files changed, 1049 insertions, 26 deletions
diff --git a/nuttx/graphics/nxbe/Make.defs b/nuttx/graphics/nxbe/Make.defs
index 4003715b5..53fdf9664 100644
--- a/nuttx/graphics/nxbe/Make.defs
+++ b/nuttx/graphics/nxbe/Make.defs
@@ -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
diff --git a/nuttx/graphics/nxbe/nxbe.h b/nuttx/graphics/nxbe/nxbe.h
index 5d9cd2695..877754782 100644
--- a/nuttx/graphics/nxbe/nxbe.h
+++ b/nuttx/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,
@@ -354,6 +357,32 @@ EXTERN void nxbe_filltrapezoid(FAR struct nxbe_window_s *wnd,
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
*
* Description:
diff --git a/nuttx/graphics/nxbe/nxbe_configure.c b/nuttx/graphics/nxbe/nxbe_configure.c
index fc694f4f3..80c71db3a 100644
--- a/nuttx/graphics/nxbe/nxbe_configure.c
+++ b/nuttx/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/nuttx/graphics/nxbe/nxbe_getrectangle.c b/nuttx/graphics/nxbe/nxbe_getrectangle.c
new file mode 100644
index 000000000..f3f01d192
--- /dev/null
+++ b/nuttx/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 <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);
+}
diff --git a/nuttx/graphics/nxglib/Make.defs b/nuttx/graphics/nxglib/Make.defs
index 9dd4c83f7..240cdbd7c 100644
--- a/nuttx/graphics/nxglib/Make.defs
+++ b/nuttx/graphics/nxglib/Make.defs
@@ -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)
diff --git a/nuttx/graphics/nxglib/Makefile.sources b/nuttx/graphics/nxglib/Makefile.sources
index 8e63f434a..67f8defc3 100644
--- a/nuttx/graphics/nxglib/Makefile.sources
+++ b/nuttx/graphics/nxglib/Makefile.sources
@@ -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
-
diff --git a/nuttx/graphics/nxglib/fb/nxglib_getrectangle.c b/nuttx/graphics/nxglib/fb/nxglib_getrectangle.c
new file mode 100644
index 000000000..82e541ec5
--- /dev/null
+++ b/nuttx/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 <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;
+ }
+}
diff --git a/nuttx/graphics/nxglib/fb/nxglib_setpixel.c b/nuttx/graphics/nxglib/fb/nxglib_setpixel.c
index bd34f8f43..7079b7e57 100644
--- a/nuttx/graphics/nxglib/fb/nxglib_setpixel.c
+++ b/nuttx/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 <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
diff --git a/nuttx/graphics/nxglib/lcd/nxglib_getrectangle.c b/nuttx/graphics/nxglib/lcd/nxglib_getrectangle.c
new file mode 100644
index 000000000..432d5531c
--- /dev/null
+++ b/nuttx/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 <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;
+ }
+}
diff --git a/nuttx/graphics/nxglib/lcd/nxglib_setpixel.c b/nuttx/graphics/nxglib/lcd/nxglib_setpixel.c
index efe08fa10..c5cff99a7 100644
--- a/nuttx/graphics/nxglib/lcd/nxglib_setpixel.c
+++ b/nuttx/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 <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
diff --git a/nuttx/graphics/nxmu/Make.defs b/nuttx/graphics/nxmu/Make.defs
index 00feec64a..6be702f11 100644
--- a/nuttx/graphics/nxmu/Make.defs
+++ b/nuttx/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/nuttx/graphics/nxmu/nx_getrectangle.c b/nuttx/graphics/nxmu/nx_getrectangle.c
new file mode 100644
index 000000000..19acae44a
--- /dev/null
+++ b/nuttx/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 <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;
+}
diff --git a/nuttx/graphics/nxmu/nxfe.h b/nuttx/graphics/nxmu/nxfe.h
index 1445b9fb5..b2f906f16 100644
--- a/nuttx/graphics/nxmu/nxfe.h
+++ b/nuttx/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/nuttx/graphics/nxmu/nxmu_server.c b/nuttx/graphics/nxmu/nxmu_server.c
index 47f855d31..aa545c18f 100644
--- a/nuttx/graphics/nxmu/nxmu_server.c
+++ b/nuttx/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/nuttx/graphics/nxsu/Make.defs b/nuttx/graphics/nxsu/Make.defs
index 12885ebf1..d16fe549c 100644
--- a/nuttx/graphics/nxsu/Make.defs
+++ b/nuttx/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/nuttx/graphics/nxsu/nx_getrectangle.c b/nuttx/graphics/nxsu/nx_getrectangle.c
new file mode 100644
index 000000000..2c3c589b7
--- /dev/null
+++ b/nuttx/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 <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);
+}
diff --git a/nuttx/graphics/nxtk/Make.defs b/nuttx/graphics/nxtk/Make.defs
index 782fbc9b6..722613af4 100644
--- a/nuttx/graphics/nxtk/Make.defs
+++ b/nuttx/graphics/nxtk/Make.defs
@@ -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
diff --git a/nuttx/graphics/nxtk/nxtk_gettoolbar.c b/nuttx/graphics/nxtk/nxtk_gettoolbar.c
new file mode 100644
index 000000000..7d2b11840
--- /dev/null
+++ b/nuttx/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 <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);
+}
diff --git a/nuttx/graphics/nxtk/nxtk_getwindow.c b/nuttx/graphics/nxtk/nxtk_getwindow.c
new file mode 100644
index 000000000..88d1d4d0e
--- /dev/null
+++ b/nuttx/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 <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);
+}