diff options
Diffstat (limited to 'NxWidgets/nxwm/src')
-rw-r--r-- | NxWidgets/nxwm/src/capplicationwindow.cxx | 115 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/cnxtaskbar.cxx | 24 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/glyph_minimize.cxx | 185 | ||||
-rwxr-xr-x | NxWidgets/nxwm/src/glyph_stop.cxx | 223 |
4 files changed, 536 insertions, 11 deletions
diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx new file mode 100644 index 000000000..0c5c9791f --- /dev/null +++ b/NxWidgets/nxwm/src/capplicationwindow.cxx @@ -0,0 +1,115 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/cnxtaskbar.cxx + * + * Copyright (C) 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 + * 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 <nuttx/config.h> + +#include "nxwmconfig.hxx" +#include "cappliationwinow.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +/******************************************************************************************** + * CNxApplicationWindow Method Implementations + ********************************************************************************************/ + + using namespace NxWM; + +/** + * CNxApplicationWindow Constructor + * + * @param taskbar. A pointer to the parent task bar instance + * @param window. The window to be used by this application. + */ + +CNxApplicationWindow::CNxApplicationWindow(NxWidgets::CNxTkWindow *window); +{ + m_window = (NxWidgets::CNxTkWindow *)0; + m_toolbar = (NxWidgets::CNxToolbar *)0; + m_minimize = (NxWidgets::CImage *)0; + m_close = (NxWidgets::CImage *)0; + m_callback = (IApplicationCallback *)0; +} + +/** + * CNxApplicationWindow Destructor + */ + +CNxApplicationWindow::~CNxApplicationWindow(void) +{ + // Free the resources that we are responsible for + + if (m_toolbar) + { + delete m_toolbar; + } + + if (m_minimize) + { + delete m_minimize; + } + + if (m_close) + { + delete m_close; + } + + // We didn't create the window. That was done by the task bar, + // Be we will handle destruction of with window as a courtesy. + + if (m_window) + { + delete m_window; + } +} + +/** + * Initialize window. Window initialization is separate from + * object instantiation so that failures can be reported. + * + * @return True if the window was successfully initialized. + */ + +bool CNxApplicationWindow::open(void) +{ + +} + + diff --git a/NxWidgets/nxwm/src/cnxtaskbar.cxx b/NxWidgets/nxwm/src/cnxtaskbar.cxx index 3cacc2629..b230c6785 100644 --- a/NxWidgets/nxwm/src/cnxtaskbar.cxx +++ b/NxWidgets/nxwm/src/cnxtaskbar.cxx @@ -50,6 +50,8 @@ * CNxConsole Method Implementations ********************************************************************************************/ +using namespace NxWM; + /** * CNxTaskBar Constructor * @@ -58,7 +60,7 @@ CNxTaskBar::CNxTaskBar(void) { - m_toolbar = (INxWindow *)NULL; + m_taskbar = (INxWindow *)NULL; m_background = (INxWindow *)NULL; m_start = (INxWindow *)NULL; } @@ -201,12 +203,12 @@ void CNxTaskBar::disconnect(void) // Close the windows NxWidgets::CWidgetControl *control; - if (m_toolbar) + if (m_taskbar) { // Delete the contained widget control. We are responsible for it // because we created it - control = m_toolbar->getWidgetControl(); + control = m_taskbar->getWidgetControl(); if (control) { delete control; @@ -214,7 +216,7 @@ void CNxTaskBar::disconnect(void) // Then delete the toolbar - delete m_toolbar; + delete m_taskbar; } if (m_background) @@ -350,7 +352,7 @@ bool CNxTaskBar::setApplicationGeometry(NxWidgets::INxWindow *window) // Get the widget control from the toolbar window. The physical window geometry // should be the same for all windows. - NxWidgets::CWidgetControl *control = m_toolbar->getWidgetControl(); + NxWidgets::CWidgetControl *control = m_taskbar->getWidgetControl(); // Now position and size the application. This will depend on the position and // orientation of the toolbar. @@ -404,8 +406,8 @@ bool CNxTaskBar::createToolbarWindow(void) { // Create a raw window to present the toolbar - m_toolbar = openRawWindow(); - if (!m_toolbar) + m_taskbar = openRawWindow(); + if (!m_taskbar) { message("CNxwm::createGraphics: Failed to create CBgWindow instance\n"); return false; @@ -413,7 +415,7 @@ bool CNxTaskBar::createToolbarWindow(void) // Get the contained widget control - NxWidgets::CWidgetControl *control = m_toolbar->getWidgetControl(); + NxWidgets::CWidgetControl *control = m_taskbar->getWidgetControl(); // Get the size of the window from the widget control @@ -457,12 +459,12 @@ bool CNxTaskBar::createToolbarWindow(void) * @return True on success, false on failure. */ - m_toolbar->setPosition(&pos); - m_toolbar->setSize(&size); + m_taskbar->setPosition(&pos); + m_taskbar->setSize(&size); /* And raise the window to the top of the display */ - m_toolbar->raise(void); + m_taskbar->raise(void); // Add the start menu's icon to the toolbar #warning "Missing logic" diff --git a/NxWidgets/nxwm/src/glyph_minimize.cxx b/NxWidgets/nxwm/src/glyph_minimize.cxx new file mode 100644 index 000000000..1d5237412 --- /dev/null +++ b/NxWidgets/nxwm/src/glyph_minimize.cxx @@ -0,0 +1,185 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/glyph_minimize.cxx + * + * Copyright (C) 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 + * 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 <nuttx/config.h> + +#include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> + +#include <nuttx/nx/nxglib.h> +#include <nuttx/fb.h> +#include <nuttx/rgbcolors.h> + +#include "nxconfig.hxx" +#include "crlepalettebitmap.hxx" +#include "glyphs.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define BITMAP_NROWS 25 +#define BITMAP_NCOLUMNS 25 +#define BITMAP_NLUTCODES 25 + +/******************************************************************************************** + * 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_minimizeLut[BITMAP_NLUTCODES] = +{ + 0xffffff, 0x2449b6, 0x24496d, 0x244992, 0x242492, 0x496ddb, 0x0024db, 0x0024b6, /* Codes 0-7 */ + 0x002492, 0x0000b6, 0x2424b6, 0x0024ff, 0x0000db, 0x4949db, 0x496db6, 0x246db6, /* Codes 8-15 */ + 0x4949b6, 0x2449db, 0xb6dbff, 0xb6b6db, 0xdbdbff, 0xdbffff, 0x496dff, 0x246dff, /* Codes 16-23 */ + 0x4949ff /* Codes 24-24 */ +}; + +/* 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] = +{ + 0xffff, 0x2256, 0x224d, 0x2252, 0x2132, 0x4b7b, 0x013b, 0x0136, 0x0132, 0x0016, /* Codes 0-9 */ + 0x2136, 0x013f, 0x001b, 0x4a5b, 0x4b76, 0x2376, 0x4a56, 0x225b, 0xb6df, 0xb5bb, /* Codes 10-19 */ + 0xdedf, 0xdfff, 0x4b7f, 0x237f, 0x4a5f /* Codes 20-24 */ +}; + +/* 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_minimizeLut[BITMAP_NLUTCODES] = +{ + 0xff, 0x4a, 0x42, 0x46, 0x30, 0x6e, 0x2e, 0x29, 0x25, 0x14, 0x34, 0x32, 0x18, 0x59, 0x6a, 0x5f, /* Codes 0-15 */ + 0x55, 0x4e, 0xd4, 0xba, 0xdf, 0xf4, 0x72, 0x67, 0x5d /* Codes 16-24 */ +}; + +# else /* CONFIG_NXWIDGETS_GREYSCALE */ + +/* RGB8 (332) Colors */ + +static const nxgl_mxpixel_t g_minimizeLut[BITMAP_NLUTCODES] = +{ + 0xff, 0x2a, 0x29, 0x2a, 0x26, 0x4f, 0x07, 0x06, 0x06, 0x02, 0x26, 0x07, 0x03, 0x4b, 0x4e, 0x2e, /* Codes 0-15 */ + 0x4a, 0x2b, 0xbb, 0xb7, 0xdb, 0xdf, 0x4f, 0x2f, 0x4b /* Codes 16-24 */ +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +static const struct SRlePaletteBitmapEntry g_minimizeRleEntries[] = +{ + { 25, 0}, /* Row 0 */ + { 25, 0}, /* Row 1 */ + { 2, 0}, { 1, 1}, { 3, 2}, { 1, 3}, { 1, 4}, { 3, 3}, { 2, 4}, { 4, 3}, /* Row 2 */ + { 1, 4}, { 1, 3}, { 2, 2}, { 1, 1}, { 1, 5}, { 2, 0}, + { 2, 0}, { 1, 2}, { 3, 6}, { 8, 7}, { 2, 8}, { 3, 7}, { 2, 8}, { 1, 4}, /* Row 3 */ + { 1, 1}, { 2, 0}, + { 2, 0}, { 1, 4}, { 11, 6}, { 3, 7}, { 1, 6}, { 4, 7}, { 1, 2}, { 2, 0}, /* Row 4 */ + { 2, 0}, { 1, 7}, { 11, 6}, { 3, 7}, { 1, 6}, { 4, 7}, { 1, 3}, { 2, 0}, /* Row 5 */ + { 2, 0}, { 1, 4}, { 9, 6}, { 10, 7}, { 1, 1}, { 2, 0}, /* Row 6 */ + { 2, 0}, { 1, 4}, { 9, 6}, { 2, 7}, { 1, 8}, { 7, 7}, { 1, 1}, { 2, 0}, /* Row 7 */ + { 2, 0}, { 1, 4}, { 8, 6}, { 4, 7}, { 1, 8}, { 6, 7}, { 1, 1}, { 2, 0}, /* Row 8 */ + { 2, 0}, { 1, 4}, { 9, 6}, { 8, 7}, { 1, 9}, { 1, 7}, { 1, 1}, { 2, 0}, /* Row 9 */ + { 2, 0}, { 1, 10}, { 9, 6}, { 1, 7}, { 1, 6}, { 6, 7}, { 1, 9}, { 1, 7}, /* Row 10 */ + { 1, 1}, { 2, 0}, + { 2, 0}, { 1, 10}, { 7, 6}, { 1, 7}, { 2, 6}, { 6, 7}, { 2, 9}, { 1, 7}, /* Row 11 */ + { 1, 10}, { 2, 0}, + { 2, 0}, { 1, 10}, { 6, 6}, { 3, 7}, { 1, 6}, { 6, 7}, { 3, 9}, { 1, 10}, /* Row 12 */ + { 2, 0}, + { 2, 0}, { 1, 10}, { 4, 6}, { 8, 7}, { 3, 9}, { 1, 7}, { 3, 9}, { 1, 10}, /* Row 13 */ + { 2, 0}, + { 2, 0}, { 1, 4}, { 1, 7}, { 1, 6}, { 1, 7}, { 2, 6}, { 2, 7}, { 3, 9}, /* Row 14 */ + { 1, 7}, { 6, 9}, { 1, 7}, { 1, 9}, { 1, 4}, { 2, 0}, + { 2, 0}, { 1, 10}, { 2, 6}, { 1, 7}, { 1, 6}, { 3, 7}, { 2, 9}, { 1, 7}, /* Row 15 */ + { 6, 9}, { 1, 7}, { 1, 6}, { 1, 9}, { 1, 10}, { 2, 0}, + { 2, 0}, { 1, 10}, { 1, 11}, { 2, 6}, { 5, 7}, { 1, 6}, { 3, 7}, { 3, 9}, /* Row 16 */ + { 2, 7}, { 2, 9}, { 1, 10}, { 2, 0}, + { 2, 0}, { 1, 10}, { 3, 11}, { 5, 6}, { 3, 9}, { 5, 7}, { 1, 6}, { 1, 7}, /* Row 17 */ + { 1, 9}, { 1, 10}, { 2, 0}, + { 2, 0}, { 1, 10}, { 1, 6}, { 1, 12}, { 1, 13}, { 1, 14}, { 1, 1}, { 2, 15}, /* Row 18 */ + { 1, 1}, { 1, 14}, { 2, 16}, { 3, 14}, { 1, 1}, { 1, 15}, { 1, 17}, { 2, 9}, + { 1, 4}, { 2, 0}, + { 2, 0}, { 1, 4}, { 2, 10}, { 1, 18}, { 13, 0}, { 1, 18}, { 1, 10}, { 1, 4}, /* Row 19 */ + { 1, 2}, { 2, 0}, + { 2, 0}, { 1, 4}, { 1, 10}, { 1, 9}, { 1, 19}, { 3, 20}, { 2, 21}, { 7, 20}, /* Row 20 */ + { 1, 21}, { 1, 18}, { 1, 13}, { 1, 4}, { 1, 2}, { 2, 0}, + { 2, 0}, { 1, 1}, { 3, 6}, { 1, 17}, { 2, 22}, { 1, 5}, { 1, 23}, { 2, 22}, /* Row 21 */ + { 3, 5}, { 2, 22}, { 1, 5}, { 1, 22}, { 1, 24}, { 1, 7}, { 1, 1}, { 2, 0}, + { 2, 0}, { 1, 5}, { 1, 1}, { 1, 6}, { 1, 7}, { 2, 10}, { 3, 7}, { 2, 6}, /* Row 22 */ + { 6, 7}, { 2, 10}, { 1, 1}, { 1, 5}, { 2, 0}, + { 25, 0}, /* Row 23 */ + { 25, 0} /* Row 24 */ +}; + +/******************************************************************************************** + * Public Bitmap Structure Defintions + ********************************************************************************************/ + +const struct SRlePaletteBitmap NXWidgets::g_mimimizeBitmap = +{ + 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_minimizeLut, // Index 0: Unselected LUT + g_minimizeLut, // Index 1: Selected LUT + }, + g_minimizeRleEntries // 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 new file mode 100755 index 000000000..d5b2fe697 --- /dev/null +++ b/NxWidgets/nxwm/src/glyph_stop.cxx @@ -0,0 +1,223 @@ +/******************************************************************************************** + * NxWidgets/nxwm/src/glyph_stop.cxx + * + * Copyright (C) 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 + * 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 <nuttx/config.h> + +#include <sys/types.h> +#include <stdint.h> +#include <stdbool.h> + +#include <nuttx/nx/nxglib.h> +#include <nuttx/fb.h> +#include <nuttx/rgbcolors.h> + +#include "nxconfig.hxx" +#include "crlepalettebitmap.hxx" +#include "glyphs.hxx" + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define BITMAP_NROWS 25 +#define BITMAP_NCOLUMNS 25 +#define BITMAP_NLUTCODES 66 + +/******************************************************************************************** + * 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_stopLut[BITMAP_NLUTCODES] = +{ + 0xffffff, 0xdbdbdb, 0xdbb6db, 0xdbb6b6, 0xdb9292, 0xdb926d, 0xdb6d6d, 0xb66d6d, /* Codes 0-7 */ + 0xb64949, 0xb62449, 0xdb246d, 0xdb4949, 0xff496d, 0xffb6b6, 0xffdbff, 0xffdbdb, /* Codes 8-15 */ + 0xff9292, 0xff6d6d, 0xdb6d49, 0xff2449, 0xff246d, 0xdb2449, 0xdbdbb6, 0xff4949, /* Codes 16-23 */ + 0xff2424, 0xffffdb, 0xdbb692, 0xdb2424, 0xff4924, 0xffb6db, 0xffdbb6, 0xff6d49, /* Codes 24-31 */ + 0xffb692, 0xdb4924, 0xb64924, 0xdbdb92, 0xb69292, 0xb62424, 0xdb496d, 0xb6926d, /* Codes 32-39 */ + 0xdbffff, 0xdbffdb, 0xb6496d, 0xdb0024, 0xdb6d92, 0xff2400, 0xb66d49, 0xdb2400, /* Codes 40-47 */ + 0xb62400, 0x922424, 0xb60000, 0x922449, 0xff92b6, 0x920000, 0xdb0049, 0xb60024, /* Codes 48-55 */ + 0xdb0000, 0x922400, 0x924949, 0x924924, 0x920024, 0xff6d92, 0x6d4924, 0x6d2400, /* Codes 56-63 */ + 0x6d2424, 0x6d0000 /* Codes 64-65 */ +}; + +/* 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] = +{ + 0xffff, 0xdedb, 0xddbb, 0xddb6, 0xdc92, 0xdc8d, 0xdb6d, 0xb36d, 0xb249, 0xb129, /* Codes 0-9 */ + 0xd92d, 0xda49, 0xfa4d, 0xfdb6, 0xfedf, 0xfedb, 0xfc92, 0xfb6d, 0xdb69, 0xf929, /* Codes 10-19 */ + 0xf92d, 0xd929, 0xded6, 0xfa49, 0xf924, 0xfffb, 0xddb2, 0xd924, 0xfa44, 0xfdbb, /* Codes 20-29 */ + 0xfed6, 0xfb69, 0xfdb2, 0xda44, 0xb244, 0xded2, 0xb492, 0xb124, 0xda4d, 0xb48d, /* Codes 30-39 */ + 0xdfff, 0xdffb, 0xb24d, 0xd804, 0xdb72, 0xf920, 0xb369, 0xd920, 0xb120, 0x9124, /* Codes 40-49 */ + 0xb000, 0x9129, 0xfc96, 0x9000, 0xd809, 0xb004, 0xd800, 0x9120, 0x9249, 0x9244, /* Codes 50-59 */ + 0x9004, 0xfb72, 0x6a44, 0x6920, 0x6924, 0x6800 /* Codes 60-65 */ +}; + +/* 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_stopLut[BITMAP_NLUTCODES] = +{ + 0xff, 0xdb, 0xc5, 0xc1, 0xa7, 0xa3, 0x8d, 0x82, 0x69, 0x53, 0x63, 0x74, 0x83, 0xcb, 0xe9, 0xe5, /* Codes 0-15 */ + 0xb2, 0x98, 0x89, 0x69, 0x6d, 0x5e, 0xd6, 0x7f, 0x65, 0xfa, 0xbc, 0x5a, 0x7b, 0xd0, 0xe1, 0x94, /* Codes 16-31 */ + 0xc7, 0x70, 0x65, 0xd2, 0x9c, 0x4f, 0x78, 0x98, 0xf4, 0xf0, 0x6d, 0x45, 0x92, 0x61, 0x7e, 0x56, /* Codes 32-47 */ + 0x4b, 0x44, 0x36, 0x49, 0xb6, 0x2b, 0x49, 0x3a, 0x41, 0x40, 0x5e, 0x5a, 0x2f, 0x9c, 0x4f, 0x35, /* Codes 48-63 */ + 0x39, 0x20 /* Codes 64-65 */ +}; + +# else /* CONFIG_NXWIDGETS_GREYSCALE */ + +/* RGB8 (332) Colors */ + +static const nxgl_mxpixel_t g_stopLut[BITMAP_NLUTCODES] = +{ + 0xff, 0xdb, 0xd7, 0xd6, 0xd2, 0xd1, 0xcd, 0xad, 0xa9, 0xa5, 0xc5, 0xc9, 0xe9, 0xf6, 0xfb, 0xfb, /* Codes 0-15 */ + 0xf2, 0xed, 0xcd, 0xe5, 0xe5, 0xc5, 0xda, 0xe9, 0xe4, 0xff, 0xd6, 0xc4, 0xe8, 0xf7, 0xfa, 0xed, /* Codes 16-31 */ + 0xf6, 0xc8, 0xa8, 0xda, 0xb2, 0xa4, 0xc9, 0xb1, 0xdf, 0xdf, 0xa9, 0xc0, 0xce, 0xe4, 0xad, 0xc4, /* Codes 32-47 */ + 0xa4, 0x84, 0xa0, 0x85, 0xf2, 0x80, 0xc1, 0xa0, 0xc0, 0x84, 0x89, 0x88, 0x80, 0xee, 0x68, 0x64, /* Codes 48-63 */ + 0x64, 0x60 /* Codes 64-65 */ +}; + +# endif +#else +# error "Unsupport pixel format" +#endif + +static const struct SRlePaletteBitmapEntry g_stopRleEntries[] = +{ + { 25, 0}, /* Row 0 */ + { 25, 0}, /* Row 1 */ + { 2, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 2}, { 2, 3}, { 2, 4}, { 1, 5}, /* Row 2 */ + { 2, 6}, { 1, 7}, { 2, 8}, { 1, 9}, { 1, 10}, { 1, 11}, { 1, 8}, { 1, 11}, + { 1, 12}, { 1, 13}, { 2, 0}, + { 2, 0}, { 1, 1}, { 1, 14}, { 2, 15}, { 1, 1}, { 1, 3}, { 1, 13}, { 2, 16}, /* Row 3 */ + { 2, 17}, { 1, 18}, { 1, 11}, { 2, 19}, { 1, 20}, { 1, 19}, { 1, 21}, { 2, 19}, + { 1, 17}, { 2, 0}, + { 2, 0}, { 1, 2}, { 1, 14}, { 2, 15}, { 1, 22}, { 1, 3}, { 1, 4}, { 2, 17}, /* Row 4 */ + { 3, 23}, { 3, 24}, { 2, 21}, { 1, 23}, { 1, 19}, { 1, 24}, { 1, 8}, { 2, 0}, + { 2, 0}, { 1, 3}, { 2, 15}, { 1, 0}, { 2, 25}, { 1, 26}, { 1, 6}, { 1, 11}, /* Row 5 */ + { 2, 23}, { 1, 24}, { 2, 27}, { 1, 28}, { 2, 15}, { 1, 0}, { 1, 17}, { 1, 23}, + { 1, 8}, { 2, 0}, + { 2, 0}, { 1, 3}, { 1, 29}, { 1, 13}, { 1, 30}, { 1, 0}, { 1, 25}, { 1, 22}, /* Row 6 */ + { 1, 5}, { 1, 11}, { 2, 27}, { 1, 24}, { 1, 27}, { 1, 31}, { 1, 32}, { 1, 25}, + { 1, 0}, { 1, 26}, { 1, 33}, { 1, 27}, { 1, 34}, { 2, 0}, + { 2, 0}, { 1, 3}, { 1, 13}, { 2, 16}, { 1, 30}, { 1, 0}, { 1, 25}, { 1, 26}, /* Row 7 */ + { 1, 8}, { 2, 21}, { 1, 27}, { 1, 11}, { 1, 26}, { 1, 25}, { 1, 0}, { 1, 35}, + { 1, 34}, { 1, 33}, { 1, 27}, { 1, 8}, { 2, 0}, + { 2, 0}, { 1, 36}, { 2, 16}, { 2, 6}, { 1, 13}, { 1, 0}, { 1, 25}, { 1, 4}, /* Row 8 */ + { 3, 8}, { 1, 4}, { 1, 25}, { 1, 0}, { 1, 13}, { 1, 8}, { 1, 37}, { 2, 24}, + { 1, 37}, { 2, 0}, + { 2, 0}, { 1, 36}, { 1, 4}, { 1, 17}, { 1, 12}, { 1, 11}, { 1, 38}, { 1, 15}, /* Row 9 */ + { 2, 0}, { 2, 36}, { 1, 7}, { 1, 15}, { 1, 0}, { 1, 15}, { 1, 23}, { 1, 27}, + { 3, 24}, { 1, 27}, { 2, 0}, + { 2, 0}, { 1, 39}, { 1, 6}, { 2, 23}, { 1, 19}, { 1, 37}, { 1, 38}, { 1, 15}, /* Row 10 */ + { 1, 0}, { 2, 40}, { 1, 41}, { 1, 0}, { 1, 29}, { 1, 42}, { 1, 43}, { 1, 27}, + { 3, 24}, { 1, 27}, { 2, 0}, + { 2, 0}, { 1, 7}, { 1, 18}, { 1, 21}, { 2, 24}, { 1, 21}, { 1, 9}, { 1, 44}, /* Row 11 */ + { 1, 0}, { 3, 40}, { 1, 0}, { 1, 44}, { 1, 9}, { 3, 27}, { 1, 45}, { 1, 24}, + { 1, 37}, { 2, 0}, + { 2, 0}, { 1, 7}, { 1, 18}, { 1, 21}, { 2, 24}, { 1, 21}, { 1, 9}, { 1, 44}, /* Row 12 */ + { 1, 0}, { 3, 40}, { 1, 0}, { 1, 44}, { 1, 9}, { 3, 27}, { 1, 45}, { 1, 24}, + { 1, 37}, { 2, 0}, + { 2, 0}, { 1, 46}, { 1, 11}, { 4, 27}, { 1, 9}, { 1, 44}, { 5, 0}, { 1, 44}, /* Row 13 */ + { 1, 9}, { 1, 27}, { 2, 37}, { 1, 47}, { 1, 27}, { 1, 37}, { 2, 0}, + { 2, 0}, { 1, 8}, { 3, 27}, { 1, 48}, { 1, 37}, { 1, 6}, { 1, 15}, { 1, 0}, /* Row 14 */ + { 3, 15}, { 1, 0}, { 1, 15}, { 1, 7}, { 1, 37}, { 1, 49}, { 1, 37}, { 1, 48}, + { 1, 27}, { 1, 37}, { 2, 0}, + { 2, 0}, { 1, 8}, { 1, 37}, { 1, 27}, { 2, 48}, { 1, 46}, { 1, 15}, { 1, 0}, /* Row 15 */ + { 1, 15}, { 3, 7}, { 1, 15}, { 1, 0}, { 1, 30}, { 1, 23}, { 1, 37}, { 2, 48}, + { 1, 27}, { 1, 37}, { 2, 0}, + { 2, 0}, { 1, 49}, { 1, 37}, { 1, 27}, { 1, 50}, { 1, 34}, { 1, 30}, { 1, 0}, /* Row 16 */ + { 1, 25}, { 1, 7}, { 2, 51}, { 1, 9}, { 1, 7}, { 1, 25}, { 1, 0}, { 1, 52}, + { 1, 27}, { 1, 53}, { 1, 47}, { 1, 27}, { 1, 49}, { 2, 0}, + { 2, 0}, { 1, 37}, { 1, 54}, { 1, 55}, { 1, 9}, { 1, 30}, { 1, 0}, { 1, 15}, /* Row 17 */ + { 1, 17}, { 1, 56}, { 2, 43}, { 1, 37}, { 1, 57}, { 1, 17}, { 1, 15}, { 1, 0}, + { 1, 30}, { 1, 58}, { 1, 53}, { 1, 37}, { 1, 58}, { 2, 0}, + { 2, 0}, { 1, 9}, { 1, 53}, { 1, 37}, { 1, 32}, { 1, 0}, { 1, 25}, { 1, 5}, /* Row 18 */ + { 1, 37}, { 1, 55}, { 2, 50}, { 1, 53}, { 1, 49}, { 1, 59}, { 1, 5}, { 1, 25}, + { 1, 0}, { 1, 16}, { 1, 9}, { 1, 60}, { 1, 49}, { 2, 0}, + { 2, 0}, { 1, 49}, { 1, 60}, { 1, 61}, { 1, 0}, { 1, 25}, { 1, 30}, { 1, 62}, /* Row 19 */ + { 1, 57}, { 1, 53}, { 2, 50}, { 1, 57}, { 1, 63}, { 1, 57}, { 1, 49}, { 1, 30}, + { 1, 15}, { 1, 0}, { 1, 61}, { 1, 37}, { 1, 49}, { 2, 0}, + { 2, 0}, { 1, 49}, { 1, 55}, { 1, 11}, { 1, 8}, { 1, 58}, { 1, 64}, { 1, 65}, /* Row 20 */ + { 1, 55}, { 1, 50}, { 2, 55}, { 1, 37}, { 1, 53}, { 1, 37}, { 1, 53}, { 1, 64}, + { 1, 8}, { 1, 11}, { 1, 21}, { 1, 60}, { 1, 51}, { 2, 0}, + { 2, 0}, { 1, 38}, { 1, 55}, { 1, 60}, { 2, 49}, { 1, 65}, { 1, 60}, { 1, 50}, /* Row 21 */ + { 1, 43}, { 3, 50}, { 1, 55}, { 2, 50}, { 1, 64}, { 1, 49}, { 2, 60}, { 1, 37}, + { 1, 38}, { 2, 0}, + { 2, 0}, { 1, 29}, { 1, 38}, { 2, 49}, { 2, 64}, { 1, 49}, { 2, 55}, { 2, 37}, /* Row 22 */ + { 3, 49}, { 1, 37}, { 1, 64}, { 1, 58}, { 2, 49}, { 1, 6}, { 1, 13}, { 2, 0}, + { 25, 0}, /* Row 23 */ + { 25, 0} /* Row 24 */ +}; + +/******************************************************************************************** + * Public Bitmap Structure Defintions + ********************************************************************************************/ + +const struct SRlePaletteBitmap NXWidgets::g_mimimizeBitmap = +{ + 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_stopLut, // Index 0: Unselected LUT + g_stopLut, // Index 1: Selected LUT + }, + g_stopRleEntries // data - Pointer to the beginning of the RLE data +}; |