From 1f003cf9e6a6318af036b8d1df70aa4d64ea6d05 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 4 May 2012 20:48:52 +0000 Subject: Updated NxWM widgets, several NX, NxWidgets, and NxWM bug fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4699 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/ChangeLog.txt | 4 +- NxWidgets/libnxwidgets/include/cnxwidget.hxx | 55 ------- NxWidgets/libnxwidgets/src/cnxwidget.cxx | 19 --- NxWidgets/nxwm/Makefile | 2 +- NxWidgets/nxwm/images/cmd.png | Bin 0 -> 264 bytes NxWidgets/nxwm/images/play.png | Bin 0 -> 550 bytes NxWidgets/nxwm/include/nxwmconfig.hxx | 18 +++ NxWidgets/nxwm/include/nxwmglyphs.hxx | 4 +- NxWidgets/nxwm/src/cnxconsole.cxx | 2 +- NxWidgets/nxwm/src/cstartwindow.cxx | 2 +- NxWidgets/nxwm/src/glyph_cmd.cxx | 181 +++++++++++++++++++++++ NxWidgets/nxwm/src/glyph_minimize.cxx | 32 +++- NxWidgets/nxwm/src/glyph_play.cxx | 210 +++++++++++++++++++++++++++ NxWidgets/nxwm/src/glyph_stop.cxx | 33 ++++- 14 files changed, 471 insertions(+), 91 deletions(-) create mode 100755 NxWidgets/nxwm/images/cmd.png create mode 100755 NxWidgets/nxwm/images/play.png create mode 100644 NxWidgets/nxwm/src/glyph_cmd.cxx create mode 100644 NxWidgets/nxwm/src/glyph_play.cxx (limited to 'NxWidgets') diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index 570942828..1d4c69c9e 100755 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -22,6 +22,8 @@ need to "rewind" to the beginning of the image. * CRlePalettBitmap: Fixe a positioning problem. It was actually losing the last row of every image! -* CNxWidget: Removed support for "shelving" widgets. I will be removing +* CNxWidget: Removed support for "shelving" widgets. I will be removing some lesser used feature over time in order to reduce the NxWidgets footprint. +* CNxWidget: Removed support for reference constants and close types. + The goal is to ge the base widget class as small as possible. \ No newline at end of file diff --git a/NxWidgets/libnxwidgets/include/cnxwidget.hxx b/NxWidgets/libnxwidgets/include/cnxwidget.hxx index 99e748f38..ab44b9d42 100644 --- a/NxWidgets/libnxwidgets/include/cnxwidget.hxx +++ b/NxWidgets/libnxwidgets/include/cnxwidget.hxx @@ -123,17 +123,6 @@ namespace NXWidgets { public: - /** - * Enum describing the way other widgets should behave when they try to - * close this widget. - */ - - enum CloseType - { - CLOSE_TYPE_CLOSE = 0, /**< Widgets should call the close() method */ - CLOSE_TYPE_HIDE = 1 /**< Widgets should call the hide() method */ - }; - /** * Enum listing flags that can be set in the constructor's "flags" parameter. */ @@ -184,7 +173,6 @@ namespace NXWidgets protected: CWidgetControl *m_widgetControl; /**< The controlling widget for the display */ CRect m_rect; /**< Rectange bounding the widget. */ - uint32_t m_refcon; /**< Identifying number of the widget. */ // Dragging variables @@ -221,7 +209,6 @@ namespace NXWidgets // Visible regions CRectCache *m_rectCache; /**< List of the widget's visible regions. */ - CloseType m_closeType; /**< Type of close method that should be called for the widget. */ WidgetBorderSize m_borderSize; /**< Size of the widget borders. */ /** @@ -507,28 +494,6 @@ namespace NXWidgets const nxgl_coord_t getRelativeY(void) const; - /** - * Get the reference constant for this widget. - * @return The reference constant. - */ - - inline const uint32_t getRefcon(void) const - { - return m_refcon; - } - - /** - * Get the type of close routine that should be called by other widgets - * interacting with this widget. - * - * @return The close type of this widget. - */ - - inline const CloseType getCloseType(void) - { - return m_closeType; - } - /** * Is the widget active? * A value of true indicates that this widget has focus or is an ancestor @@ -900,15 +865,6 @@ namespace NXWidgets return m_style.colors.selectedText; } - /** - * Sets this widget's reference constant. This should be unique, - * at least amongst this widget's siblings. - * - * @param refcon The reference constant. - */ - - uint32_t setRefcon(uint32_t refcon); - /** * Sets this widget's border state. * @@ -1091,17 +1047,6 @@ namespace NXWidgets m_style.colors.selectedText = color; } - /** - * Sets the close type other widgets should use when closing this widget. - * - * @param closeType The close type to use. - */ - - inline void setCloseType(const CloseType closeType) - { - m_closeType = closeType; - } - /** * Sets the font. * diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx index 8b5d0cb57..483309832 100644 --- a/NxWidgets/libnxwidgets/src/cnxwidget.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx @@ -189,10 +189,6 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl, m_lastClickY = 0; m_doubleClickBounds = DOUBLE_CLICK_BOUNDS; - // Set other default values - - m_refcon = 0; - // Set border size to 1 line m_borderSize.top = 1; @@ -200,7 +196,6 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl, m_borderSize.bottom = 1; m_borderSize.left = 1; - m_closeType = CLOSE_TYPE_CLOSE; m_rectCache = new CRectCache(this); m_widgetEventHandlers = new CWidgetEventHandlerList(this); } @@ -506,20 +501,6 @@ TNxArray *CNxWidget::getForegroundRegions(void) return m_rectCache->getForegroundRegions(); } -/** - * Sets this widget's reference constant. This should be unique, - * at least amongst this widget's siblings. - * - * @param refcon The reference constant. - */ - -uint32_t CNxWidget::setRefcon(uint32_t refcon) -{ - uint32_t old = m_refcon; - m_refcon = refcon; - return old; -} - /** * Sets this widget's border state. * diff --git a/NxWidgets/nxwm/Makefile b/NxWidgets/nxwm/Makefile index 4f13ca362..badc5eb21 100644 --- a/NxWidgets/nxwm/Makefile +++ b/NxWidgets/nxwm/Makefile @@ -44,7 +44,7 @@ CSRCS = # Window Manager CXXSRCS = capplicationwindow.cxx cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx # Images -CXXSRCS += glyph_minimize.cxx glyph_nsh.cxx glyph_start.cxx glyph_stop.cxx +CXXSRCS += glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx glyph_play.cxx glyph_start.cxx glyph_stop.cxx SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) diff --git a/NxWidgets/nxwm/images/cmd.png b/NxWidgets/nxwm/images/cmd.png new file mode 100755 index 000000000..3e6cf667c Binary files /dev/null and b/NxWidgets/nxwm/images/cmd.png differ diff --git a/NxWidgets/nxwm/images/play.png b/NxWidgets/nxwm/images/play.png new file mode 100755 index 000000000..ab7c29249 Binary files /dev/null and b/NxWidgets/nxwm/images/play.png differ diff --git a/NxWidgets/nxwm/include/nxwmconfig.hxx b/NxWidgets/nxwm/include/nxwmconfig.hxx index 9387e2713..57566b2d4 100644 --- a/NxWidgets/nxwm/include/nxwmconfig.hxx +++ b/NxWidgets/nxwm/include/nxwmconfig.hxx @@ -248,6 +248,7 @@ * * CONFIG_NXWM_STARTWINDOW_VSPACING - Vertical spacing. Default: 2 pixels * CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows + * CONFIG_NXWM_STARTWINDOW_ICON - The glyph to use as the start window icon */ #ifndef CONFIG_NXWM_STARTWINDOW_VSPACING @@ -258,6 +259,14 @@ # define CONFIG_NXWM_STARTWINDOW_HSPACING (2) #endif +/** + * The start window glyph + */ + +#ifndef CONFIG_NXWM_STARTWINDOW_ICON +# define CONFIG_NXWM_STARTWINDOW_ICON NxWM::g_playBitmap +#endif + /* NxConsole Window *********************************************************/ /** * NxConsole Window Configuration @@ -275,6 +284,7 @@ * NxConsole window. Default: MKRGB(0,0,0) * CONFIG_NXWM_NXCONSOLE_FONTID - The ID of the font to use in the NxConsole * window. Default: CONFIG_NXWM_DEFAULT_FONTID + * CONFIG_NXWM_NXCONSOLE_ICON - The glyph to use as the NxConsole icon */ #ifndef CONFIG_NXWM_NXCONSOLE_PRIO @@ -302,6 +312,14 @@ # define CONFIG_NXWM_NXCONSOLE_FONTID CONFIG_NXWM_DEFAULT_FONTID #endif +/** + * The NxConsole window glyph + */ + +#ifndef CONFIG_NXWM_NXCONSOLE_ICON +# define CONFIG_NXWM_NXCONSOLE_ICON NxWM::g_cmdBitmap +#endif + /**************************************************************************** * Global Function Prototypes ****************************************************************************/ diff --git a/NxWidgets/nxwm/include/nxwmglyphs.hxx b/NxWidgets/nxwm/include/nxwmglyphs.hxx index 198fe9f26..6a850179c 100644 --- a/NxWidgets/nxwm/include/nxwmglyphs.hxx +++ b/NxWidgets/nxwm/include/nxwmglyphs.hxx @@ -57,8 +57,10 @@ namespace NxWM { - extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap; + extern const struct NXWidgets::SRlePaletteBitmap g_cmdBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap; + extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap; + extern const struct NXWidgets::SRlePaletteBitmap g_playBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_startBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_stopBitmap; } diff --git a/NxWidgets/nxwm/src/cnxconsole.cxx b/NxWidgets/nxwm/src/cnxconsole.cxx index de44ab7f0..8898b8bcb 100644 --- a/NxWidgets/nxwm/src/cnxconsole.cxx +++ b/NxWidgets/nxwm/src/cnxconsole.cxx @@ -169,7 +169,7 @@ CApplicationWindow *CNxConsole::getWindow(void) const NXWidgets::IBitmap *CNxConsole::getIcon(void) { NXWidgets::CRlePaletteBitmap *bitmap = - new NXWidgets::CRlePaletteBitmap(&g_nshBitmap); + new NXWidgets::CRlePaletteBitmap(&CONFIG_NXWM_NXCONSOLE_ICON); return bitmap; } diff --git a/NxWidgets/nxwm/src/cstartwindow.cxx b/NxWidgets/nxwm/src/cstartwindow.cxx index f25ed8d2b..a29f1f785 100644 --- a/NxWidgets/nxwm/src/cstartwindow.cxx +++ b/NxWidgets/nxwm/src/cstartwindow.cxx @@ -120,7 +120,7 @@ CApplicationWindow *CStartWindow::getWindow(void) const NXWidgets::IBitmap *CStartWindow::getIcon(void) { NXWidgets::CRlePaletteBitmap *bitmap = - new NXWidgets::CRlePaletteBitmap(&g_startBitmap); + new NXWidgets::CRlePaletteBitmap(&CONFIG_NXWM_STARTWINDOW_ICON); return bitmap; } diff --git a/NxWidgets/nxwm/src/glyph_cmd.cxx b/NxWidgets/nxwm/src/glyph_cmd.cxx new file mode 100644 index 000000000..816c888c5 --- /dev/null +++ b/NxWidgets/nxwm/src/glyph_cmd.cxx @@ -0,0 +1,181 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/glyph_cmd.cxx + * + * Copyright (C) 2012 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, NxWidgets, nor the names of its contributors + * me 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 + +#include "crlepalettebitmap.hxx" + +#include "nxwmconfig.hxx" +#include "nxwmglyphs.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define BITMAP_NROWS 22 +#define BITMAP_NCOLUMNS 25 +#define BITMAP_NLUTCODES 8 + +/******************************************************************************************** + * Private Bitmap Data + ********************************************************************************************/ + +using namespace NxWM; + +/* RGB24 (8-8-8) Colors */ + +#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 + +static const uint32_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x909090, 0x000000, 0xb4fcfc, 0xb4d8fc, 0x6cb4fc, 0x6c6c6c, 0xfcfcfc, 0x484848 +}; + +static const uint32_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xababab, 0x3f3f3f, 0xc6fcfc, 0xc6e1fc, 0x90c6fc, 0x909090, 0xfcfcfc, 0x757575 +}; +/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ + +#elif CONFIG_NXWIDGETS_BPP == 16 + +static const uint16_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x9492, 0x0000, 0xb7ff, 0xb6df, 0x6dbf, 0x6b6d, 0xffff, 0x4a49 +}; + +static const uint16_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xad55, 0x39e7, 0xc7ff, 0xc71f, 0x963f, 0x9492, 0xffff, 0x73ae +}; + +/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used + * to lookup an 8-bit value. There is no savings in that! It would be better to just put + * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these + * pointless lookups. But these p;ointless lookups do make the logic compatible with the + * 16- and 24-bit types. + */ + +#elif CONFIG_NXWIDGETS_BPP == 8 +# ifdef CONFIG_NXWIDGETS_GREYSCALE + +/* 8-bit Greyscale */ + +static const uint8_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x90, 0x00, 0xe6, 0xd1, 0xa6, 0x6c, 0xfc, 0x48 +}; + +static const uint8_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xab, 0x3f, 0xeb, 0xdc, 0xbc, 0x90, 0xfc, 0x75 +}; + +# else /* CONFIG_NXWIDGETS_GREYSCALE */ + +/* RGB8 (332) Colors */ + +static const nxgl_mxpixel_t g_cmdNormalLut[BITMAP_NLUTCODES] = +{ + 0x92, 0x00, 0xbf, 0xbb, 0x77, 0x6d, 0xff, 0x49 +}; + +static const nxgl_mxpixel_t g_cmdBrightlLut[BITMAP_NLUTCODES] = +{ + 0xb6, 0x24, 0xdf, 0xdf, 0x9b, 0x92, 0xff, 0x6d +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +static const struct NXWidgets::SRlePaletteBitmapEntry g_cmdRleEntries[] = +{ + { 24, 0}, { 1, 1}, /* Row 0 */ + { 24, 0}, { 1, 1}, /* Row 1 */ + { 2, 0}, { 1, 2}, { 13, 3}, { 7, 4}, { 1, 0}, { 1, 1}, /* Row 2 */ + { 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 3 */ + { 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 4 */ + { 24, 0}, { 1, 1}, /* Row 5 */ + { 1, 0}, { 22, 1}, { 1, 0}, { 1, 1}, /* Row 6 */ + { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 7 */ + { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 8 */ + { 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 9 */ + { 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 17, 5}, { 1, 0}, { 1, 1}, /* Row 10 */ + { 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 16, 5}, { 1, 0}, { 1, 1}, /* Row 11 */ + { 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 12 */ + { 1, 0}, { 1, 1}, { 6, 5}, { 1, 6}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 13 */ + { 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 1, 7}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 14 */ + { 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 1, 7}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 15 */ + { 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 1, 7}, { 4, 5}, { 9, 6}, { 3, 5}, /* Row 16 */ + { 1, 0}, { 1, 1}, + { 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 1, 7}, { 6, 5}, { 9, 7}, { 2, 5}, /* Row 17 */ + { 1, 0}, { 1, 1}, + { 1, 0}, { 1, 1}, { 2, 5}, { 1, 7}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 18 */ + { 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 19 */ + { 24, 0}, { 1, 1}, /* Row 20 */ + { 25, 1}, /* Row 21 */ +}; + +/******************************************************************************************** + * Public Bitmap Structure Defintions + ********************************************************************************************/ + +const struct NXWidgets::SRlePaletteBitmap NxWM::g_cmdBitmap = +{ + CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel + CONFIG_NXWIDGETS_FMT, // fmt - Color format + BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT) + BITMAP_NCOLUMNS, // width - Width in pixels + BITMAP_NROWS, // height - Height in rows + { // lut - Pointer to the beginning of the Look-Up Table (LUT) + g_cmdNormalLut, // Index 0: Unselected LUT + g_cmdBrightlLut, // Index 1: Selected LUT + }, + g_cmdRleEntries // data - Pointer to the beginning of the RLE data +}; diff --git a/NxWidgets/nxwm/src/glyph_minimize.cxx b/NxWidgets/nxwm/src/glyph_minimize.cxx index 1f375ab13..4dd95f9f2 100644 --- a/NxWidgets/nxwm/src/glyph_minimize.cxx +++ b/NxWidgets/nxwm/src/glyph_minimize.cxx @@ -70,20 +70,30 @@ using namespace NxWM; #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 -static const uint32_t g_minimizeLut[BITMAP_NLUTCODES] = +static const uint32_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x2448b4, 0x486cd8, 0x0024b4, 0x0024d8, 0x242490, 0x0000b4, 0xfcfcfc, 0xd8fcfc /* Codes 0-7 */ }; +static const uint32_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x5a75c6, 0x7590e1, 0x3f5ac6, 0x3f5ae1, 0x5a5aab, 0x3f3fc6, 0xfcfcfc, 0xe1fcfc /* Codes 0-7 */ +}; + /* RGB16 (565) Colors (four of the colors in this map are duplicates) */ #elif CONFIG_NXWIDGETS_BPP == 16 -static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] = +static const uint16_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x2256, 0x4b7b, 0x0136, 0x013b, 0x2132, 0x0016, 0xffff, 0xdfff /* Codes 0-7 */ }; +static const uint16_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x5bb8, 0x749c, 0x3ad8, 0x3adc, 0x5ad5, 0x39f8, 0xffff, 0xe7ff /* Codes 0-7 */ +}; + /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used * to lookup an 8-bit value. There is no savings in that! It would be better to just put * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these @@ -96,20 +106,30 @@ static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] = /* 8-bit Greyscale */ -static const uint8_t g_minimizeLut[BITMAP_NLUTCODES] = +static const uint8_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x49, 0x6d, 0x29, 0x2d, 0x30, 0x14, 0xfc, 0xf1 /* Codes 0-7 */ }; +static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x76, 0x91, 0x5e, 0x61, 0x63, 0x4e, 0xfc, 0xf3 /* Codes 0-7 */ +}; + # else /* CONFIG_NXWIDGETS_GREYSCALE */ /* RGB8 (332) Colors */ -static const nxgl_mxpixel_t g_minimizeLut[BITMAP_NLUTCODES] = +static const nxgl_mxpixel_t g_minimizeNormalLut[BITMAP_NLUTCODES] = { 0x2a, 0x4f, 0x06, 0x07, 0x26, 0x02, 0xff, 0xdf /* Codes 0-7 */ }; +static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] = +{ + 0x4f, 0x73, 0x2b, 0x2b, 0x4a, 0x27, 0xff, 0xff /* Codes 0-7 */ +}; + # endif #else # error "Unsupport pixel format" @@ -152,8 +172,8 @@ const struct NXWidgets::SRlePaletteBitmap NxWM::g_minimizeBitmap = BITMAP_NCOLUMNS, // width - Width in pixels BITMAP_NROWS, // height - Height in rows { // lut - Pointer to the beginning of the Look-Up Table (LUT) - g_minimizeLut, // Index 0: Unselected LUT - g_minimizeLut, // Index 1: Selected LUT + g_minimizeNormalLut, // Index 0: Unselected LUT + g_minimizeBrightLut, // Index 1: Selected LUT }, g_minimizeRleEntries // data - Pointer to the beginning of the RLE data }; diff --git a/NxWidgets/nxwm/src/glyph_play.cxx b/NxWidgets/nxwm/src/glyph_play.cxx new file mode 100644 index 000000000..a6970b2e0 --- /dev/null +++ b/NxWidgets/nxwm/src/glyph_play.cxx @@ -0,0 +1,210 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/glyph_play.cxx + * + * Copyright (C) 2012 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, NxWidgets, nor the names of its contributors + * me 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 + +#include "crlepalettebitmap.hxx" + +#include "nxwmconfig.hxx" +#include "nxwmglyphs.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define BITMAP_NROWS 25 +#define BITMAP_NCOLUMNS 25 +#define BITMAP_NLUTCODES 6 + +/******************************************************************************************** + * Private Bitmap Data + ********************************************************************************************/ + +using namespace NxWM; + +/* RGB24 (8-8-8) Colors */ + +#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 + +static const uint32_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x00d800, 0x008400, 0x006800, 0x00ac00, 0x004800, /* Codes 1-5 */ +}; + +static const uint32_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x3fe13f, 0x3fa23f, 0x3f8d3f, 0x3fc03f, 0x3f753f /* Codes 1-5 */ +}; +/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ + +#elif CONFIG_NXWIDGETS_BPP == 16 + +static const uint16_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x06c0, 0x0420, 0x0340, 0x0560, 0x0240, /* Codes 0-5 */ +}; + +static const uint16_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x3f07, 0x3d07, 0x3c67, 0x3e07, 0x3ba7, /* Codes 0-5 */ +}; + +/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used + * to lookup an 8-bit value. There is no savings in that! It would be better to just put + * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these + * pointless lookups. But these p;ointless lookups do make the logic compatible with the + * 16- and 24-bit types. + */ + +#elif CONFIG_NXWIDGETS_BPP == 8 +# ifdef CONFIG_NXWIDGETS_GREYSCALE + +/* 8-bit Greyscale */ + +static const uint8_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x7e, 0x4d, 0x3d, 0x64, 0x2a /* Codes 1-5 */ +}; + +static const uint8_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x9e, 0x79, 0x6c, 0x8a, 0x5e /* Codes 1-5 */ +}; + +# else /* CONFIG_NXWIDGETS_GREYSCALE */ + +/* RGB8 (332) Colors */ + +static const nxgl_mxpixel_t g_playNormalLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x18, 0x10, 0x0c, 0x14, 0x08 /* Codes 0-5 */ +}; + +static const nxgl_mxpixel_t g_playBrightlLut[BITMAP_NLUTCODES] = +{ + CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */ + 0x3c, 0x34, 0x30, 0x38, 0x2c /* Codes 0-5 */ +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +static const struct NXWidgets::SRlePaletteBitmapEntry g_playRleEntries[] = +{ + { 25, 0}, /* Row 0 */ + { 9, 0}, { 1, 1}, { 1, 2}, { 3, 3}, { 1, 2}, { 1, 1}, { 9, 0}, /* Row 1 */ + { 7, 0}, { 1, 1}, { 1, 3}, { 2, 2}, { 3, 1}, { 1, 4}, { 1, 3}, { 1, 5}, /* Row 2 */ + { 1, 2}, { 7, 0}, + { 6, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 7, 0}, { 1, 1}, { 1, 5}, { 1, 3}, /* Row 3 */ + { 6, 0}, + { 4, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 4}, { 9, 0}, { 1, 1}, { 1, 2}, /* Row 4 */ + { 1, 5}, { 1, 3}, { 4, 0}, + { 3, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 0}, { 1, 1}, { 10, 0}, /* Row 5 */ + { 1, 4}, { 1, 5}, { 1, 2}, { 3, 0}, + { 3, 0}, { 1, 3}, { 1, 5}, { 3, 0}, { 2, 1}, { 10, 0}, { 2, 3}, { 1, 4}, /* Row 6 */ + { 2, 0}, + { 2, 0}, { 1, 1}, { 1, 5}, { 1, 4}, { 3, 0}, { 1, 1}, { 1, 4}, { 2, 1}, /* Row 7 */ + { 8, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 2, 0}, + { 2, 0}, { 1, 3}, { 1, 2}, { 4, 0}, { 1, 1}, { 5, 4}, { 7, 0}, { 1, 1}, /* Row 8 */ + { 1, 5}, { 1, 2}, { 1, 0}, + { 1, 0}, { 1, 1}, { 1, 3}, { 1, 4}, { 4, 0}, { 1, 1}, { 7, 4}, { 6, 0}, /* Row 9 */ + { 1, 2}, { 1, 3}, { 1, 0}, + { 1, 1}, { 1, 3}, { 1, 5}, { 5, 0}, { 1, 1}, { 9, 4}, { 4, 0}, { 1, 4}, /* Row 10 */ + { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 3}, { 1, 4}, { 5, 0}, { 1, 1}, { 11, 4}, { 2, 0}, { 1, 4}, /* Row 11 */ + { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 5}, { 1, 1}, { 5, 0}, { 1, 4}, { 9, 2}, { 2, 3}, { 1, 5}, /* Row 12 */ + { 1, 0}, { 1, 4}, { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 3}, { 1, 1}, { 5, 0}, { 1, 4}, { 7, 2}, { 3, 3}, { 1, 5}, /* Row 13 */ + { 2, 0}, { 1, 4}, { 1, 2}, { 1, 4}, + { 1, 1}, { 1, 3}, { 1, 4}, { 5, 0}, { 1, 4}, { 5, 2}, { 3, 3}, { 1, 5}, /* Row 14 */ + { 4, 0}, { 1, 2}, { 1, 3}, { 1, 4}, + { 1, 0}, { 1, 2}, { 1, 3}, { 5, 0}, { 1, 4}, { 3, 2}, { 3, 3}, { 1, 5}, /* Row 15 */ + { 5, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 1, 0}, + { 2, 0}, { 1, 5}, { 1, 4}, { 4, 0}, { 1, 4}, { 2, 2}, { 2, 3}, { 1, 5}, /* Row 16 */ + { 7, 0}, { 1, 2}, { 1, 5}, { 2, 0}, + { 2, 0}, { 1, 2}, { 1, 5}, { 1, 1}, { 3, 0}, { 1, 4}, { 2, 3}, { 1, 5}, /* Row 17 */ + { 8, 0}, { 1, 1}, { 1, 3}, { 1, 2}, { 2, 0}, + { 3, 0}, { 1, 2}, { 1, 3}, { 3, 0}, { 1, 3}, { 1, 5}, { 9, 0}, { 1, 1}, /* Row 18 */ + { 2, 3}, { 3, 0}, + { 3, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 2, 0}, { 1, 5}, { 9, 0}, { 1, 1}, /* Row 19 */ + { 1, 4}, { 1, 5}, { 4, 0}, + { 4, 0}, { 1, 1}, { 1, 5}, { 1, 3}, { 10, 0}, { 1, 1}, { 1, 3}, { 1, 5}, /* Row 20 */ + { 5, 0}, + { 6, 0}, { 1, 2}, { 1, 5}, { 1, 4}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 21 */ + { 1, 2}, { 6, 0}, + { 7, 0}, { 1, 3}, { 3, 5}, { 3, 3}, { 2, 5}, { 1, 3}, { 1, 2}, { 7, 0}, /* Row 22 */ + { 9, 0}, { 1, 4}, { 2, 2}, { 1, 3}, { 2, 2}, { 1, 4}, { 9, 0}, /* Row 23 */ + { 25, 0}, /* Row 24 */ +}; + +/******************************************************************************************** + * Public Bitmap Structure Defintions + ********************************************************************************************/ + +const struct NXWidgets::SRlePaletteBitmap NxWM::g_playBitmap = +{ + CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel + CONFIG_NXWIDGETS_FMT, // fmt - Color format + BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT) + BITMAP_NCOLUMNS, // width - Width in pixels + BITMAP_NROWS, // height - Height in rows + { // lut - Pointer to the beginning of the Look-Up Table (LUT) + g_playNormalLut, // Index 0: Unselected LUT + g_playBrightlLut, // Index 1: Selected LUT + }, + g_playRleEntries // data - Pointer to the beginning of the RLE data +}; diff --git a/NxWidgets/nxwm/src/glyph_stop.cxx b/NxWidgets/nxwm/src/glyph_stop.cxx index 9081b48a2..a60b75ce8 100644 --- a/NxWidgets/nxwm/src/glyph_stop.cxx +++ b/NxWidgets/nxwm/src/glyph_stop.cxx @@ -70,22 +70,34 @@ using namespace NxWM; #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 -static const uint32_t g_stopLut[BITMAP_NLUTCODES] = +static const uint32_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xd8d8d8, 0xfc6c6c, 0xfcb4b4, 0xd80000, 0xfc0000, 0x902424, 0xfcfcfc, 0xd8fcfc, /* Codes 0-7 */ 0xb40000, 0xb40024, 0xfcd8d8 /* Codes 8-10 */ }; +static const uint32_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xe1e1e1, 0xfc9090, 0xfcc6c6, 0xe13f3f, 0xfc3f3f, 0xab5a5a, 0xfcfcfc, 0xe1fcfc, /* Codes 0-7 */ + 0xc63f3f, 0xc63f5a, 0xfce1e1 /* Codes 8-10 */ +}; + /* RGB16 (565) Colors (four of the colors in this map are duplicates) */ #elif CONFIG_NXWIDGETS_BPP == 16 -static const uint16_t g_stopLut[BITMAP_NLUTCODES] = +static const uint16_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xdedb, 0xfb6d, 0xfdb6, 0xd800, 0xf800, 0x9124, 0xffff, 0xdfff, 0xb000, 0xb004, /* Codes 0-9 */ 0xfedb /* Codes 10-10 */ }; +static const uint16_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xe71c, 0xfc92, 0xfe38, 0xe1e7, 0xf9e7, 0xaacb, 0xffff, 0xe7ff, 0xc1e7, 0xc1eb, /* Codes 0-9 */ + 0xff1c /* Codes 10-10 */ +}; + /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used * to lookup an 8-bit value. There is no savings in that! It would be better to just put * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these @@ -98,21 +110,30 @@ static const uint16_t g_stopLut[BITMAP_NLUTCODES] = /* 8-bit Greyscale */ -static const uint8_t g_stopLut[BITMAP_NLUTCODES] = +static const uint8_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xd8, 0x97, 0xc9, 0x40, 0x4b, 0x44, 0xfc, 0xf1, 0x35, 0x39, 0xe2 /* Codes 0-10 */ +}; +static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xe1, 0xb0, 0xd6, 0x6f, 0x77, 0x72, 0xfc, 0xf3, 0x67, 0x6a, 0xe9 /* Codes 0-10 */ }; # else /* CONFIG_NXWIDGETS_GREYSCALE */ /* RGB8 (332) Colors */ -static const nxgl_mxpixel_t g_stopLut[BITMAP_NLUTCODES] = +static const nxgl_mxpixel_t g_stopNormalLut[BITMAP_NLUTCODES] = { 0xdb, 0xed, 0xf6, 0xc0, 0xe0, 0x84, 0xff, 0xdf, 0xa0, 0xa0, 0xfb /* Codes 0-10 */ }; +static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] = +{ + 0xff, 0xf2, 0xfb, 0xe4, 0xe4, 0xa9, 0xff, 0xff, 0xc4, 0xc5, 0xff /* Codes 0-10 */ +}; + # endif #else # error "Unsupport pixel format" @@ -166,8 +187,8 @@ const struct NXWidgets::SRlePaletteBitmap NxWM::g_stopBitmap = BITMAP_NCOLUMNS, // width - Width in pixels BITMAP_NROWS, // height - Height in rows { // lut - Pointer to the beginning of the Look-Up Table (LUT) - g_stopLut, // Index 0: Unselected LUT - g_stopLut, // Index 1: Selected LUT + g_stopNormalLut, // Index 0: Unselected LUT + g_stopBrightLut, // Index 1: Selected LUT }, g_stopRleEntries // data - Pointer to the beginning of the RLE data }; -- cgit v1.2.3