summaryrefslogtreecommitdiff
path: root/nuttx/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/graphics')
-rw-r--r--nuttx/graphics/README.txt5
-rw-r--r--nuttx/graphics/nxbe/nxbe_move.c9
-rw-r--r--nuttx/graphics/nxglib/fb/nxglib_moverectangle.c14
-rw-r--r--nuttx/graphics/nxmu/nx_move.c6
-rw-r--r--nuttx/graphics/nxtk/nxtk_drawframe.c163
-rw-r--r--nuttx/graphics/nxtk/nxtk_internal.h13
-rw-r--r--nuttx/graphics/nxtk/nxtk_openwindow.c12
7 files changed, 144 insertions, 78 deletions
diff --git a/nuttx/graphics/README.txt b/nuttx/graphics/README.txt
index acecfe433..3cd213247 100644
--- a/nuttx/graphics/README.txt
+++ b/nuttx/graphics/README.txt
@@ -256,10 +256,11 @@ CONFIG_NX_KBD
CONFIG_NXTK_BORDERWIDTH
Specifies with with of the border (in pixels) used with framed windows.
The default is 4.
-CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2
+CONFIG_NXTK_BORDERCOLOR1, CONFIG_NXTK_BORDERCOLOR2, CONFIG_NXTK_BORDERCOLOR3
Specify the colors of the border used with framed windows.
CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so is normally darker.
- The default is medium and dark grey, respectively
+ CONFIG_NXTK_BORDERCOLOR3 is the shiny side color and so is normally brighter.
+ The default is mediumdark grey, and light grey, respectively
CONFIG_NXTK_AUTORAISE
If set, a window will be raised to the top if the mouse position is over a
visible portion of the window. Default: A mouse button must be clicked over
diff --git a/nuttx/graphics/nxbe/nxbe_move.c b/nuttx/graphics/nxbe/nxbe_move.c
index c52151421..193b174c2 100644
--- a/nuttx/graphics/nxbe/nxbe_move.c
+++ b/nuttx/graphics/nxbe/nxbe_move.c
@@ -1,8 +1,8 @@
/****************************************************************************
* graphics/nxbe/nxbe_move.c
*
- * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2009, 2011-2012 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
@@ -93,6 +93,8 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops,
if (info->offset.x != 0 || info->offset.y != 0)
{
+ /* Offset is the destination position of the moved rectangle */
+
offset.x = rect->pt1.x + info->offset.x;
offset.y = rect->pt1.y + info->offset.y;
@@ -160,8 +162,7 @@ static void nxbe_clipmovedest(FAR struct nxbe_clipops_s *cops,
/* Clip to determine what is inside the bounds */
- nxgl_rectoffset(&tmprect1, rect, -offset.x, -offset.y);
- nxgl_rectintersect(&src, &tmprect1, &dstdata->srcrect);
+ nxgl_rectintersect(&src, rect, &dstdata->srcrect);
if (!nxgl_nullrect(&src))
{
diff --git a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c
index d1bcbe7c9..d8e52250c 100644
--- a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c
+++ b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c
@@ -1,8 +1,8 @@
/****************************************************************************
* graphics/nxglib/fb/nxglib_moverectangle.c
*
- * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2012 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
@@ -185,14 +185,16 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX)
* source position.
*/
- dline = (FAR uint8_t*)sline - offset->y * stride - NXGL_SCALEX(offset->x);
+ dline = pinfo->fbmem + offset->y * stride + NXGL_SCALEX(offset->x);
/* Case 1: Is the destination position above the displayed position?
- * If the Y offset is negative, then the destination is offset to a
- * postion below (or to the right) in the source in framebuffer memory.
+ * If the destination position is less then then the src address, then the
+ * destination is offset to a postion below (and or to the left) of the
+ * source in framebuffer memory.
*/
- if (offset->y < 0 || (offset->y == 0 && offset->x <= 0))
+ if (offset->y < rect->pt1.y ||
+ (offset->y < rect->pt1.y && offset->x <= rect->pt1.x))
{
/* Yes.. Copy the rectangle from top down (i.e., adding the stride
* to move to the next, lower row) */
diff --git a/nuttx/graphics/nxmu/nx_move.c b/nuttx/graphics/nxmu/nx_move.c
index 6159ce0ca..3f4a00e2f 100644
--- a/nuttx/graphics/nxmu/nx_move.c
+++ b/nuttx/graphics/nxmu/nx_move.c
@@ -1,8 +1,8 @@
/****************************************************************************
* graphics/nxmu/nx_move.c
*
- * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2009, 2012 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
@@ -102,7 +102,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
/* Format the fill command */
- outmsg.msgid = NX_SVRMSG_FILL;
+ outmsg.msgid = NX_SVRMSG_MOVE;
outmsg.wnd = wnd;
outmsg.offset.x = offset->x;
outmsg.offset.y = offset->y;
diff --git a/nuttx/graphics/nxtk/nxtk_drawframe.c b/nuttx/graphics/nxtk/nxtk_drawframe.c
index edf3dcac8..1ffbf689b 100644
--- a/nuttx/graphics/nxtk/nxtk_drawframe.c
+++ b/nuttx/graphics/nxtk/nxtk_drawframe.c
@@ -1,8 +1,8 @@
/****************************************************************************
* graphics/nxtk/nxtk_drawframe.c
*
- * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2009, 2011-2012 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
@@ -114,45 +114,79 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd,
struct nxgl_rect_s frame;
struct nxgl_size_s wndsize;
struct nxgl_size_s tbsize;
+ nxgl_coord_t thickness;
+
+ /* Shiny edge:
+ * Thickness: 1
+ * Color: CONFIG_NXTK_BORDERCOLOR3;
+ * Condition: CONFIG_NXTK_BORDERWIDTH > 2
+ * Central part:
+ * Thickness: Varies with CONFIG_NXTK_BORDERWIDTH
+ * Color: CONFIG_NXTK_BORDERCOLOR1;
+ * Condition: CONFIG_NXTK_BORDERWIDTH > 0
+ * Shadow part:
+ * Thickness: 1;
+ * Color: CONFIG_NXTK_BORDERCOLOR2;
+ * Condition: CONFIG_NXTK_BORDERWIDTH > 1
+ */
+
+#if CONFIG_NXTK_BORDERWIDTH > 2
+ thickness = CONFIG_NXTK_BORDERWIDTH - 2;
+#elif CONFIG_NXTK_BORDERWIDTH > 1
+ thickness = CONFIG_NXTK_BORDERWIDTH - 1;
+#else
+ thickness = CONFIG_NXTK_BORDERWIDTH;
+#endif
/* Get the size of the rectangle */
nxgl_rectsize(&wndsize, &fwnd->wnd.bounds);
nxgl_rectsize(&tbsize, &fwnd->tbrect);
- /* Draw the top. Thickness: CONFIG_NXTK_BORDERWIDTH-1, Color:
- * CONFIG_NXTK_BORDERCOLOR1
- */
+ /* Draw the top ***********************************************************/
+#if CONFIG_NXTK_BORDERWIDTH > 0
frame.pt1.x = 0;
frame.pt2.x = wndsize.w - 1;
-
frame.pt1.y = 0;
-#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 2;
-#else
- frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 1;
+
+ /* Draw the shiny edge */
+
+#if CONFIG_NXTK_BORDERWIDTH > 2
+ frame.pt2.y = 0;
+ nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3);
+ frame.pt1.y = 1;
#endif
+
+ /* Draw the central part */
+
+ frame.pt2.y = frame.pt1.y + thickness - 1;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
/* Draw a single line under the toolbar, color CONFIG_NXTK_BORDERCOLOR2 */
#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt1.y += tbsize.h + CONFIG_NXTK_BORDERWIDTH - 1;
+ frame.pt1.y += tbsize.h + thickness;
frame.pt2.y = frame.pt1.y;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
#endif
- /* Draw the bottom. First, thickness: CONFIG_NXTK_BORDERWIDTH-1,
- * Color: CONFIG_NXTK_BORDERCOLOR1
- */
+ /* Draw the bottom ********************************************************/
+#if CONFIG_NXTK_BORDERWIDTH > 0
frame.pt1.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH;
-#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt2.y = wndsize.h - 2;
-#else
+
+ /* Draw the shiny edge */
+
+#if CONFIG_NXTK_BORDERWIDTH > 2
frame.pt2.y = frame.pt1.y;
+ nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3);
+ frame.pt1.y ++;
#endif
+
+ /* Draw the central part */
+
+ frame.pt2.y = frame.pt1.y + thickness - 1;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
/* Then a single line at the very bottom, Color: CONFIG_NXTK_BORDERCOLOR2 */
@@ -162,75 +196,82 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd,
frame.pt2.y = frame.pt1.y;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
#endif
+#endif
- /* Draw the outer left side. Thickness: CONFIG_NXTK_BORDERWIDTH-1,
- * Color: CONFIG_NXTK_BORDERCOLOR1
- */
+ /* Draw left and right outer edges *****************************************/
- frame.pt1.y = 0;
- frame.pt2.y = wndsize.h - 2;
+ /* Draw the shiny left out edge */
- frame.pt1.x = 0;
#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt2.x = CONFIG_NXTK_BORDERWIDTH - 2;
-#else
+ frame.pt1.x = 0;
+ frame.pt1.y = 1;
+#if CONFIG_NXTK_BORDERWIDTH > 2
frame.pt2.x = frame.pt1.x;
+ frame.pt2.y = wndsize.h - 2;
+ nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3);
#endif
- nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
- /* Draw the outer right side. Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2 */
+ /* Draw the shadowed right outer edge */
-#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt1.x = wndsize.w - 1;
+ frame.pt1.x = wndsize.w - 2;
frame.pt2.x = frame.pt1.x;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
#endif
- /* Draw the inner left side, Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2.
- * This segment stops at the bottom of the toolbar. If there is a
- * tool bar, then we have to continue this to the top of the display
- * using g_bordercolor1 (see below)
- */
+ /* Draw left and right central regions *************************************/
-#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt1.y = CONFIG_NXTK_BORDERWIDTH - 1 + tbsize.h;
+#if CONFIG_NXTK_BORDERWIDTH > 2
+ frame.pt1.x = 1;
+ frame.pt1.y = 1;
+ frame.pt2.x = frame.pt1.x + thickness - 1;
+ frame.pt2.y = wndsize.h - 2;
#else
- frame.pt1.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h;
-#endif
- frame.pt2.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH - 1;
-#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt1.x = CONFIG_NXTK_BORDERWIDTH - 1;
- frame.pt2.x = frame.pt1.x;
- nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
+ frame.pt1.x = 0;
+ frame.pt1.y = 0;
+ frame.pt2.x = frame.pt1.x + thickness - 1;
+ frame.pt2.y = wndsize.h - 1;
#endif
+ nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
- /* Draw the inner left side, Thickness: CONFIG_NXTK_BORDERWIDTH-1,
- * Color: CONFIG_NXTK_BORDERCOLOR1
- */
-
-#if CONFIG_NXTK_BORDERWIDTH > 1
- frame.pt1.x = wndsize.w - CONFIG_NXTK_BORDERWIDTH;
+#if CONFIG_NXTK_BORDERWIDTH > 2
+ frame.pt1.x = wndsize.w - thickness - 1;
frame.pt2.x = wndsize.w - 2;
#else
- frame.pt1.x = wndsize.w - 1;
- frame.pt2.x = frame.pt1.x;
+ frame.pt1.x = wndsize.w - thickness;
+ frame.pt2.x = wndsize.w - 1;
#endif
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
+#endif
- /* When there is a toolbar, we also have to patch in this tiny
- * line segment -- Is there a better way?
+ /* Draw left and right inner sides *****************************************/
+ /* This segment stops at the bottom of the toolbar. If there is a
+ * tool bar, then we have to continue this to the top of the display
+ * using g_bordercolor1 (see below)
*/
+ /* Draw the shadowed left inner edge */
+
#if CONFIG_NXTK_BORDERWIDTH > 1
- if (tbsize.h > 0)
- {
- frame.pt1.y = 0;
- frame.pt2.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h - 2;
+#if CONFIG_NXTK_BORDERWIDTH > 2
+ frame.pt1.x = thickness + 1;
+ frame.pt1.y = tbsize.h + thickness + 1;
+ frame.pt2.x = frame.pt1.x;
+ frame.pt2.y = wndsize.h - thickness - 2;
+#else
+ frame.pt1.x = thickness;
+ frame.pt1.y = tbsize.h + thickness;
+ frame.pt2.x = frame.pt1.x;
+ frame.pt2.y = wndsize.h - thickness - 1;
+#endif
+ nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
- frame.pt1.x = CONFIG_NXTK_BORDERWIDTH - 1;
- frame.pt2.x = frame.pt1.x;
- nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
- }
+ /* Draw the shiny right inner edge */
+
+#if CONFIG_NXTK_BORDERWIDTH > 2
+ frame.pt1.x = wndsize.w - thickness - 2;
+ frame.pt2.x = frame.pt1.x;
+ nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3);
+#endif
#endif
return OK;
diff --git a/nuttx/graphics/nxtk/nxtk_internal.h b/nuttx/graphics/nxtk/nxtk_internal.h
index 5351048cf..763b1bfe8 100644
--- a/nuttx/graphics/nxtk/nxtk_internal.h
+++ b/nuttx/graphics/nxtk/nxtk_internal.h
@@ -80,6 +80,18 @@
# endif
#endif
+#ifndef CONFIG_NXTK_BORDERCOLOR3
+# if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP)
+# define CONFIG_NXTK_BORDERCOLOR3 0x00d9d9d9
+# elif !defined(CONFIG_NX_DISABLE_16BPP)
+# define CONFIG_NXTK_BORDERCOLOR3 0xdedb
+# elif !defined(CONFIG_NX_DISABLE_4BPP)
+# define CONFIG_NXTK_BORDERCOLOR3 8
+# else
+# define CONFIG_NXTK_BORDERCOLOR3 'S'
+# endif
+#endif
+
/****************************************************************************
* Public Types
****************************************************************************/
@@ -124,6 +136,7 @@ extern FAR const struct nx_callback_s g_nxtkcb;
extern nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES];
extern nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES];
+extern nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES];
/****************************************************************************
* Public Function Prototypes
diff --git a/nuttx/graphics/nxtk/nxtk_openwindow.c b/nuttx/graphics/nxtk/nxtk_openwindow.c
index 3716e63ca..4080b0e7a 100644
--- a/nuttx/graphics/nxtk/nxtk_openwindow.c
+++ b/nuttx/graphics/nxtk/nxtk_openwindow.c
@@ -68,7 +68,7 @@ nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES] =
{
CONFIG_NXTK_BORDERCOLOR1
#if CONFIG_NX_NPLANES > 1
-# error "Multiple corder colors not defined"
+# error "Multiple plane border colors not defined"
#endif
};
@@ -76,7 +76,15 @@ nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES] =
{
CONFIG_NXTK_BORDERCOLOR2
#if CONFIG_NX_NPLANES > 1
-# error "Multiple border colors not defined"
+# error "Multiple plane border colors not defined"
+#endif
+};
+
+nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES] =
+{
+ CONFIG_NXTK_BORDERCOLOR3
+#if CONFIG_NX_NPLANES > 1
+# error "Multiple plane border colors not defined"
#endif
};