Squashed commit of the following:

apps/graphics/twm4nx:  Adds some colors and better style control to support the CONTEMPORARY theme.  Still getting a few artifacts on the display.

    apps/graphics/twm4nx:  Use custom CWidgetStyle to force Icon background to match selected desktop background.

    apps/graphics/nxglyphs:  Add more modern looking button images for the Twm4Nx CONTEMPORARY theme

    apps/graphics/twm4nx:  Add some definitions to support Themes.  Background image is now optional.
This commit is contained in:
Gregory Nutt 2019-05-21 14:48:01 -06:00
parent 5cad41c973
commit 0a00a9950c
27 changed files with 1628 additions and 40 deletions

View File

@ -56,6 +56,8 @@ ifeq ($(CONFIG_NXGLYPHS_LARGE_ICONS),y)
CXXSRCS += glyph_calculator47x49.cxx glyph_calibration48x42.cxx glyph_cmd49x43.cxx
CXXSRCS += glyph_minimize42x42.cxx glyph_play48x48.cxx glyph_stop42x42.cxx
CXXSRCS += glyph_menu42x42.cxx glyph_resize42x42.cxx glyph_nxicon42x42.cxx
CXXSRCS += glpyh_menu2-42x42.cxx glpyh_minimize2-42x42.cxx glpyh_resize2-42x42.cxx
CXXSRCS += glyph_stop2-42x42.cxx
else
# Small icons
@ -63,6 +65,8 @@ else
CXXSRCS += glyph_calculator24x25.cxx glyph_calibration24x21.cxx glyph_cmd25x22.cxx
CXXSRCS += glyph_minimize21x21.cxx glyph_play24x24.cxx glyph_stop21x21.cxx
CXXSRCS += glyph_menu21x21.cxx glyph_resize21x21.cxx glyph_nxicon21x21.cxx
CXXSRCS += glpyh_menu2-21x21.cxx glpyh_minimize2-21x21.cxx glpyh_resize2-21x21.cxx
CXXSRCS += glpyh_stop2-21x21.cxx
endif
ifeq ($(CONFIG_NXGLYPHS_LARGE_ICONS),y)

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

View File

@ -0,0 +1,167 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 21
#define BITMAP_NCOLUMNS 21
#define BITMAP_NLUTCODES 2
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, /* Codes 0-1 */
};
static const uint32_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, /* Codes 0-1 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, /* Codes 0-1 */
};
static const uint16_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, /* Codes 0-1 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, /* Codes 0-1 */
}
static const uint8_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, /* Codes 0-1 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, /* Codes 0-1 */
};
static const uint8_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, /* Codes 0-1 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_menu2RleEntries[] =
{
{ 21, 0}, // Row 0
{ 21, 0}, // Row 1
{ 21, 0}, // Row 2
{ 21, 0}, // Row 3
{ 4, 0}, { 14, 1}, { 3, 0}, // Row 4
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 5
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 6
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 7
{ 4, 0}, { 14, 1}, { 3, 0}, // Row 8
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 9
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 10
{ 4, 0}, { 14, 1}, { 3, 0}, // Row 11
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 12
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 13
{ 4, 0}, { 14, 1}, { 3, 0}, // Row 14
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 15
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 16
{ 4, 0}, { 14, 1}, { 3, 0}, // Row 17
{ 21, 0}, // Row 18
{ 21, 0}, // Row 19
{ 21, 0}, // Row 20
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_menu2Bitmap =
{
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_menu2NormalLut, // Index 0: Unselected LUT
g_menu2BrightLut, // Index 1: Selected LUT
},
g_menu2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -0,0 +1,188 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 42
#define BITMAP_NCOLUMNS 42
#define BITMAP_NLUTCODES 3
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xd8fcfc, /* Codes 0-2 */
};
static const uint32_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xe1fcfc, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xdfff, /* Codes 0-2 */
};
static const uint16_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xe7ff, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf1, /* Codes 0-2 */
}
static const uint8_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf3, /* Codes 0-2 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_menu2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xdf, /* Codes 0-2 */
};
static const uint8_t g_menu2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xff, /* Codes 0-2 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_menu2RleEntries[] =
{
{ 42, 0}, // Row 0
{ 42, 0}, // Row 1
{ 42, 0}, // Row 2
{ 42, 0}, // Row 3
{ 42, 0}, // Row 4
{ 42, 0}, // Row 5
{ 42, 0}, // Row 6
{ 42, 0}, // Row 7
{ 7, 0}, { 27, 1}, { 8, 0}, // Row 8
{ 7, 0}, { 1, 1}, { 25, 2}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 9
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 10
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 11
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 12
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 13
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 14
{ 7, 0}, { 27, 1}, { 1, 2}, { 7, 0}, // Row 15
{ 7, 0}, { 1, 1}, { 25, 2}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 16
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 17
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 18
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 19
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 20
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 21
{ 7, 0}, { 27, 1}, { 1, 2}, { 7, 0}, // Row 22
{ 7, 0}, { 1, 1}, { 25, 2}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 23
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 24
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 25
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 26
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 27
{ 7, 0}, { 27, 1}, { 1, 2}, { 7, 0}, // Row 28
{ 7, 0}, { 1, 1}, { 25, 2}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 29
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 30
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 31
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 32
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 33
{ 7, 0}, { 27, 1}, { 1, 2}, { 7, 0}, // Row 34
{ 8, 0}, { 27, 2}, { 7, 0}, // Row 35
{ 42, 0}, // Row 36
{ 42, 0}, // Row 37
{ 42, 0}, // Row 38
{ 42, 0}, // Row 39
{ 42, 0}, // Row 40
{ 42, 0}, // Row 41
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_menu2Bitmap =
{
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_menu2NormalLut, // Index 0: Unselected LUT
g_menu2BrightLut, // Index 1: Selected LUT
},
g_menu2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -0,0 +1,167 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 21
#define BITMAP_NCOLUMNS 21
#define BITMAP_NLUTCODES 3
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xd8fcfc, /* Codes 0-2 */
};
static const uint32_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xe1fcfc, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xdfff, /* Codes 0-2 */
};
static const uint16_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xe7ff, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf1, /* Codes 0-2 */
}
static const uint8_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf3, /* Codes 0-2 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xdf, /* Codes 0-2 */
};
static const uint8_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xff, /* Codes 0-2 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_minimize2RleEntries[] =
{
{ 21, 0}, // Row 0
{ 21, 0}, // Row 1
{ 21, 0}, // Row 2
{ 21, 0}, // Row 3
{ 21, 0}, // Row 4
{ 21, 0}, // Row 5
{ 21, 0}, // Row 6
{ 21, 0}, // Row 7
{ 21, 0}, // Row 8
{ 21, 0}, // Row 9
{ 21, 0}, // Row 10
{ 21, 0}, // Row 11
{ 21, 0}, // Row 12
{ 21, 0}, // Row 13
{ 21, 0}, // Row 14
{ 21, 0}, // Row 15
{ 21, 0}, // Row 16
{ 3, 0}, { 14, 1}, { 1, 2}, { 3, 0}, // Row 17
{ 3, 0}, { 15, 2}, { 3, 0}, // Row 18
{ 21, 0}, // Row 19
{ 21, 0}, // Row 20
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_minimize2Bitmap =
{
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_minimize2NormalLut, // Index 0: Unselected LUT
g_minimize2BrightLut, // Index 1: Selected LUT
},
g_minimize2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -0,0 +1,188 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 42
#define BITMAP_NCOLUMNS 42
#define BITMAP_NLUTCODES 3
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xd8fcfc, /* Codes 0-2 */
};
static const uint32_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xe1fcfc, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xdfff, /* Codes 0-2 */
};
static const uint16_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xe7ff, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf1, /* Codes 0-2 */
}
static const uint8_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf3, /* Codes 0-2 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_minimize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xdf, /* Codes 0-2 */
};
static const uint8_t g_minimize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xff, /* Codes 0-2 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_minimize2RleEntries[] =
{
{ 42, 0}, // Row 0
{ 42, 0}, // Row 1
{ 42, 0}, // Row 2
{ 42, 0}, // Row 3
{ 42, 0}, // Row 4
{ 42, 0}, // Row 5
{ 42, 0}, // Row 6
{ 42, 0}, // Row 7
{ 42, 0}, // Row 8
{ 42, 0}, // Row 9
{ 42, 0}, // Row 10
{ 42, 0}, // Row 11
{ 42, 0}, // Row 12
{ 42, 0}, // Row 13
{ 42, 0}, // Row 14
{ 42, 0}, // Row 15
{ 42, 0}, // Row 16
{ 42, 0}, // Row 17
{ 42, 0}, // Row 18
{ 42, 0}, // Row 19
{ 42, 0}, // Row 20
{ 42, 0}, // Row 21
{ 42, 0}, // Row 22
{ 42, 0}, // Row 23
{ 42, 0}, // Row 24
{ 42, 0}, // Row 25
{ 42, 0}, // Row 26
{ 42, 0}, // Row 27
{ 42, 0}, // Row 28
{ 42, 0}, // Row 29
{ 42, 0}, // Row 30
{ 42, 0}, // Row 31
{ 7, 0}, { 28, 1}, { 7, 0}, // Row 32
{ 6, 0}, { 29, 1}, { 1, 2}, { 6, 0}, // Row 33
{ 6, 0}, { 29, 1}, { 1, 2}, { 6, 0}, // Row 34
{ 6, 0}, { 29, 1}, { 1, 2}, { 6, 0}, // Row 35
{ 6, 0}, { 29, 1}, { 1, 2}, { 6, 0}, // Row 36
{ 7, 0}, { 28, 2}, { 7, 0}, // Row 37
{ 42, 0}, // Row 38
{ 42, 0}, // Row 39
{ 42, 0}, // Row 40
{ 42, 0}, // Row 41
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_minimize2Bitmap =
{
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_minimize2NormalLut, // Index 0: Unselected LUT
g_minimize2BrightLut, // Index 1: Selected LUT
},
g_minimize2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -0,0 +1,167 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 21
#define BITMAP_NCOLUMNS 21
#define BITMAP_NLUTCODES 2
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, /* Codes 0-1 */
};
static const uint32_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, /* Codes 0-1 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, /* Codes 0-1 */
};
static const uint16_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, /* Codes 0-1 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, /* Codes 0-1 */
}
static const uint8_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, /* Codes 0-1 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, /* Codes 0-1 */
};
static const uint8_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, /* Codes 0-1 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_resize2RleEntries[] =
{
{ 21, 0}, // Row 0
{ 21, 0}, // Row 1
{ 21, 0}, // Row 2
{ 21, 0}, // Row 3
{ 4, 0}, { 14, 1}, { 3, 0}, // Row 4
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 5
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 6
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 7
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 8
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 9
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 10
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 11
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 12
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 13
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 14
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 15
{ 4, 0}, { 1, 1}, { 12, 0}, { 1, 1}, { 3, 0}, // Row 16
{ 4, 0}, { 14, 1}, { 3, 0}, // Row 17
{ 21, 0}, // Row 18
{ 21, 0}, // Row 19
{ 21, 0}, // Row 20
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_resize2Bitmap =
{
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_resize2NormalLut, // Index 0: Unselected LUT
g_resize2BrightLut, // Index 1: Selected LUT
},
g_resize2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -0,0 +1,188 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 42
#define BITMAP_NCOLUMNS 42
#define BITMAP_NLUTCODES 3
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xd8fcfc, /* Codes 0-2 */
};
static const uint32_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xe1fcfc, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xdfff, /* Codes 0-2 */
};
static const uint16_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xe7ff, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf1, /* Codes 0-2 */
}
static const uint8_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf3, /* Codes 0-2 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_resize2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xdf, /* Codes 0-2 */
};
static const uint8_t g_resize2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xff, /* Codes 0-2 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_resize2RleEntries[] =
{
{ 42, 0}, // Row 0
{ 42, 0}, // Row 1
{ 42, 0}, // Row 2
{ 42, 0}, // Row 3
{ 42, 0}, // Row 4
{ 42, 0}, // Row 5
{ 42, 0}, // Row 6
{ 42, 0}, // Row 7
{ 7, 0}, { 27, 1}, { 8, 0}, // Row 8
{ 7, 0}, { 1, 1}, { 24, 2}, { 2, 1}, { 1, 2}, { 7, 0}, // Row 9
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 10
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 11
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 12
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 13
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 14
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 15
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 16
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 17
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 18
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 19
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 20
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 21
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 22
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 23
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 24
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 25
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 26
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 27
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 28
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 29
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 30
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 31
{ 7, 0}, { 1, 1}, { 1, 2}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 32
{ 7, 0}, { 2, 1}, { 24, 0}, { 1, 1}, { 1, 2}, { 7, 0}, // Row 33
{ 7, 0}, { 27, 1}, { 1, 2}, { 7, 0}, // Row 34
{ 8, 0}, { 27, 2}, { 7, 0}, // Row 35
{ 42, 0}, // Row 36
{ 42, 0}, // Row 37
{ 42, 0}, // Row 38
{ 42, 0}, // Row 39
{ 42, 0}, // Row 40
{ 42, 0}, // Row 41
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_resize2Bitmap =
{
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_resize2NormalLut, // Index 0: Unselected LUT
g_resize2BrightLut, // Index 1: Selected LUT
},
g_resize2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -0,0 +1,167 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 21
#define BITMAP_NCOLUMNS 21
#define BITMAP_NLUTCODES 3
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xd8fcfc, /* Codes 0-2 */
};
static const uint32_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xe1fcfc, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xdfff, /* Codes 0-2 */
};
static const uint16_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xe7ff, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf1, /* Codes 0-2 */
}
static const uint8_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf3, /* Codes 0-2 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xdf, /* Codes 0-2 */
};
static const uint8_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xff, /* Codes 0-2 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_stop2RleEntries[] =
{
{ 21, 0}, // Row 0
{ 21, 0}, // Row 1
{ 21, 0}, // Row 2
{ 3, 0}, { 2, 1}, { 1, 2}, { 9, 0}, { 2, 1}, { 1, 2}, { 3, 0}, // Row 3
{ 3, 0}, { 3, 1}, { 1, 2}, { 7, 0}, { 3, 1}, { 1, 2}, { 3, 0}, // Row 4
{ 4, 0}, { 3, 1}, { 1, 2}, { 5, 0}, { 3, 1}, { 1, 2}, { 4, 0}, // Row 5
{ 5, 0}, { 3, 1}, { 1, 2}, { 3, 0}, { 3, 1}, { 1, 2}, { 5, 0}, // Row 6
{ 6, 0}, { 3, 1}, { 1, 2}, { 1, 0}, { 3, 1}, { 1, 2}, { 6, 0}, // Row 7
{ 7, 0}, { 6, 1}, { 1, 2}, { 7, 0}, // Row 8
{ 8, 0}, { 2, 1}, { 3, 2}, { 8, 0}, // Row 9
{ 8, 0}, { 2, 1}, { 3, 2}, { 8, 0}, // Row 10
{ 8, 0}, { 4, 1}, { 1, 2}, { 8, 0}, // Row 11
{ 7, 0}, { 6, 1}, { 1, 2}, { 7, 0}, // Row 12
{ 6, 0}, { 2, 1}, { 2, 2}, { 1, 0}, { 2, 1}, { 2, 2}, { 6, 0}, // Row 13
{ 5, 0}, { 3, 1}, { 1, 2}, { 3, 0}, { 3, 1}, { 1, 2}, { 5, 0}, // Row 14
{ 4, 0}, { 3, 1}, { 1, 2}, { 5, 0}, { 3, 1}, { 1, 2}, { 4, 0}, // Row 15
{ 3, 0}, { 3, 1}, { 1, 2}, { 7, 0}, { 3, 1}, { 1, 2}, { 3, 0}, // Row 16
{ 3, 0}, { 3, 2}, { 9, 0}, { 3, 2}, { 3, 0}, // Row 17
{ 21, 0}, // Row 18
{ 21, 0}, // Row 19
{ 21, 0}, // Row 20
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_stop2Bitmap =
{
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_stop2NormalLut, // Index 0: Unselected LUT
g_stop2BrightLut, // Index 1: Selected LUT
},
g_stop2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -0,0 +1,188 @@
/********************************************************************************************
* apps/graphics/nxglyphs/src/glyph_xxxxxx.cxx
*
* Copyright (C) 2019 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 "graphics/nxwidgets/crlepalettebitmap.hxx"
#include "graphics/nxglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 42
#define BITMAP_NCOLUMNS 42
#define BITMAP_NLUTCODES 3
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NXWidgets;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
// RGB24 (8-8-8) Colors
static const uint32_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xd8fcfc, /* Codes 0-2 */
};
static const uint32_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfcfcfc, 0xe1fcfc, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 16
// RGB16 (565) Colors (four of the colors in this map are duplicates)
static const uint16_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xdfff, /* Codes 0-2 */
};
static const uint16_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xffff, 0xe7ff, /* Codes 0-2 */
};
#elif CONFIG_NXWIDGETS_BPP == 8
// 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.
///
# ifdef CONFIG_NXWIDGETS_GREYSCALE
// 8-bit Greyscale
static const uint8_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf1, /* Codes 0-2 */
}
static const uint8_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xfc, 0xf3, /* Codes 0-2 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
// RGB8 (332) Colors
static const nxgl_mxpixel_t g_stop2NormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xdf, /* Codes 0-2 */
};
static const uint8_t g_stop2BrightLut[BITMAP_NLUTCODES] =
{
CONFIG_NXGLYPHS_BACKGROUNDCOLOR, 0xff, 0xff, /* Codes 0-2 */
};
# endif
#else
# error Unsupported pixel format
#endif
static const struct SRlePaletteBitmapEntry g_stop2RleEntries[] =
{
{ 42, 0}, // Row 0
{ 42, 0}, // Row 1
{ 42, 0}, // Row 2
{ 42, 0}, // Row 3
{ 42, 0}, // Row 4
{ 42, 0}, // Row 5
{ 5, 0}, { 5, 1}, { 2, 2}, { 18, 0}, { 6, 1}, { 1, 2}, { 5, 0}, // Row 6
{ 5, 0}, { 6, 1}, { 2, 2}, { 16, 0}, { 7, 1}, { 1, 2}, { 5, 0}, // Row 7
{ 5, 0}, { 7, 1}, { 2, 2}, { 14, 0}, { 7, 1}, { 2, 2}, { 5, 0}, // Row 8
{ 6, 0}, { 8, 1}, { 1, 2}, { 12, 0}, { 7, 1}, { 2, 2}, { 6, 0}, // Row 9
{ 7, 0}, { 7, 1}, { 2, 2}, { 10, 0}, { 7, 1}, { 2, 2}, { 7, 0}, // Row 10
{ 8, 0}, { 7, 1}, { 2, 2}, { 8, 0}, { 7, 1}, { 2, 2}, { 8, 0}, // Row 11
{ 9, 0}, { 7, 1}, { 2, 2}, { 6, 0}, { 7, 1}, { 2, 2}, { 9, 0}, // Row 12
{ 10, 0}, { 7, 1}, { 2, 2}, { 4, 0}, { 7, 1}, { 2, 2}, { 10, 0}, // Row 13
{ 11, 0}, { 7, 1}, { 2, 2}, { 2, 0}, { 7, 1}, { 2, 2}, { 11, 0}, // Row 14
{ 12, 0}, { 7, 1}, { 2, 2}, { 7, 1}, { 2, 2}, { 12, 0}, // Row 15
{ 13, 0}, { 14, 1}, { 2, 2}, { 13, 0}, // Row 16
{ 14, 0}, { 12, 1}, { 2, 2}, { 14, 0}, // Row 17
{ 15, 0}, { 10, 1}, { 2, 2}, { 15, 0}, // Row 18
{ 16, 0}, { 8, 1}, { 2, 2}, { 16, 0}, // Row 19
{ 17, 0}, { 6, 1}, { 2, 2}, { 17, 0}, // Row 20
{ 17, 0}, { 6, 1}, { 2, 2}, { 17, 0}, // Row 21
{ 16, 0}, { 8, 1}, { 2, 2}, { 16, 0}, // Row 22
{ 15, 0}, { 10, 1}, { 2, 2}, { 15, 0}, // Row 23
{ 14, 0}, { 12, 1}, { 2, 2}, { 14, 0}, // Row 24
{ 13, 0}, { 14, 1}, { 2, 2}, { 13, 0}, // Row 25
{ 12, 0}, { 7, 1}, { 2, 2}, { 7, 1}, { 2, 2}, { 12, 0}, // Row 26
{ 11, 0}, { 7, 1}, { 2, 2}, { 2, 0}, { 7, 1}, { 2, 2}, { 11, 0}, // Row 27
{ 10, 0}, { 7, 1}, { 2, 2}, { 4, 0}, { 7, 1}, { 2, 2}, { 10, 0}, // Row 28
{ 9, 0}, { 7, 1}, { 2, 2}, { 6, 0}, { 7, 1}, { 2, 2}, { 9, 0}, // Row 29
{ 8, 0}, { 7, 1}, { 2, 2}, { 8, 0}, { 7, 1}, { 2, 2}, { 8, 0}, // Row 30
{ 7, 0}, { 7, 1}, { 2, 2}, { 10, 0}, { 7, 1}, { 2, 2}, { 7, 0}, // Row 31
{ 6, 0}, { 7, 1}, { 2, 2}, { 12, 0}, { 7, 1}, { 2, 2}, { 6, 0}, // Row 32
{ 5, 0}, { 7, 1}, { 2, 2}, { 14, 0}, { 7, 1}, { 2, 2}, { 5, 0}, // Row 33
{ 5, 0}, { 6, 1}, { 2, 2}, { 16, 0}, { 7, 1}, { 1, 2}, { 5, 0}, // Row 34
{ 5, 0}, { 7, 2}, { 18, 0}, { 7, 2}, { 5, 0}, // Row 35
{ 42, 0}, // Row 36
{ 42, 0}, // Row 37
{ 42, 0}, // Row 38
{ 42, 0}, // Row 39
{ 42, 0}, // Row 40
{ 42, 0}, // Row 41
};
/********************************************************************************************
* Public Bitmap Structure Definitions
********************************************************************************************/
const struct SRlePaletteBitmap NXWidgets::g_stop2Bitmap =
{
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_stop2NormalLut, // Index 0: Unselected LUT
g_stop2BrightLut, // Index 1: Selected LUT
},
g_stop2RleEntries // data - Pointer to the beginning of the RLE data
};

View File

@ -110,6 +110,23 @@ config TWM4NX_MOUSE_DEVPATH
default "/dev/mouse0" if TWM4NX_MOUSE
default "/dev/input0" if TWM4NX_TOUCHSCREEN
choice
prompt "Twm4Nx Theme"
default TWM4NX_CLASSIC
config TWM4NX_CLASSIC
bool "Classic"
---help---
Strong bordered windows with dark primary colors. Reminiscent of
Windows 98.
config TWM4NX_CONTEMPORARY
bool "Contemporary"
---help---
Border-less windows in pastel shades for a more contemporary look.
endchoice # Twm4Nx Theme
config TWM4NX_DEBUG
bool "Force debug output"
default n

View File

@ -125,6 +125,13 @@ How To:
o Move toward the top decreases the height of the Window
o Other moves will affect both the height and width of the window.
Themes
- There are two themes support by the configuration system:
o CONFIG_TWM4NX_CLASSIC. Strong bordered windows with dark primary
colors. Reminiscent of Windows 98.
o CONFIG_TWM4NX_CONTEMPORARY. Border-less windows in pastel shades
for a more contemporary look.
Issues:
2019-05-16:
@ -158,3 +165,6 @@ Issues:
set half of the display width which is okay for the display I am using,
but it really needs to set a width that is appropriate for the number
of columns and the size of a generic name string.
8. There are a few color artifacts in the toolbar of the CONTEMPORARY
theme. These look like boards are being drawn around the toolbar
widgets (even though the are configured to be borderless).

View File

@ -75,7 +75,9 @@ CBackground::CBackground(FAR CTwm4Nx *twm4nx)
m_twm4nx = twm4nx; // Save the session instance
m_eventq = (mqd_t)-1; // No NxWidget event message queue yet
m_backWindow = (NXWidgets::CBgWindow *)0; // No background window yet
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
m_backImage = (NXWidgets::CImage *)0; // No background image yet
#endif
}
/**
@ -127,6 +129,7 @@ bool CBackground::
twminfo("Create the background image\n");
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
// Create the new background image
if (!createBackgroundImage(sbitmap))
@ -135,6 +138,7 @@ bool CBackground::
cleanup();
return false;
}
#endif
return true;
}
@ -176,6 +180,7 @@ void CBackground::getDisplaySize(FAR struct nxgl_size_s &size)
bool CBackground::checkCollision(FAR const struct nxgl_rect_s &bounds,
FAR struct nxgl_rect_s &collision)
{
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
// Is there a background image
if (m_backImage != (NXWidgets::CImage *)0)
@ -195,6 +200,7 @@ bool CBackground::checkCollision(FAR const struct nxgl_rect_s &bounds,
return nxgl_intersecting(&bounds, &collision);
}
#endif
return false;
}
@ -232,6 +238,7 @@ bool CBackground::redrawBackgroundWindow(FAR const struct nxgl_rect_s *rect,
redrawSize.w, redrawSize.h,
CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR);
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
if (m_backImage != (NXWidgets::CImage *)0)
{
// Does any part of the image need to be redrawn?
@ -252,6 +259,7 @@ bool CBackground::redrawBackgroundWindow(FAR const struct nxgl_rect_s *rect,
m_backImage->redraw();
}
}
#endif
// Now redraw any background icons that need to be redrawn
@ -422,6 +430,7 @@ bool CBackground::createBackgroundWindow(void)
* @return true on success
*/
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
bool CBackground::
createBackgroundImage(FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap)
{
@ -497,6 +506,7 @@ bool CBackground::
m_backImage->redraw();
return true;
}
#endif
/**
* Release resources held by the background.
@ -512,6 +522,7 @@ void CBackground::cleanup(void)
m_eventq = (mqd_t)-1;
}
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
// Delete the background image
if (m_backImage != (NXWidgets::CImage *)0)
@ -519,6 +530,7 @@ void CBackground::cleanup(void)
delete m_backImage;
m_backImage = (NXWidgets::CImage *)0;
}
#endif
// Delete the background

View File

@ -68,6 +68,8 @@
#include "graphics/nxwidgets/cimage.hxx"
#include "graphics/nxwidgets/clabel.hxx"
#include "graphics/nxwidgets/cnxfont.hxx"
#include "graphics/nxwidgets/singletons.hxx"
#include "graphics/nxwidgets/cwidgetstyle.hxx"
#include "graphics/twm4nx/twm4nx_config.hxx"
#include "graphics/twm4nx/ctwm4nx.hxx"
@ -163,6 +165,13 @@ CWindow::CWindow(CTwm4Nx *twm4nx)
m_tbFlags = 0; // No customizations
m_tbDisables = 0; // No buttons disabled
// Style for the toolbar widgets. It is the same as the default
// widget style, but using the color assigned to the toolbar background.
m_tbStyle = *NXWidgets::g_defaultWidgetStyle;
m_tbStyle.colors.background = CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR;
m_tbStyle.colors.selectedBackground = CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR;
// Icons/Icon Manager
m_iconBitMap = (FAR NXWidgets::CRlePaletteBitmap *)0;
@ -347,13 +356,21 @@ bool CWindow::initialize(FAR const NXWidgets::CNxString &name,
return false;
}
// Create a style for the Icon widget. It is the same as the default
// widget style, but using the color assigned to the background as the
// widget background color.
NXWidgets::CWidgetStyle style = *NXWidgets::g_defaultWidgetStyle;
style.colors.background = CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR;
style.colors.selectedBackground = CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR;
// Get the widget control instance from the background. This is needed
// to force the icon widgets to be draw on the background
// to force the icon widgets to be drawn on the background
FAR CBackground *background = m_twm4nx->getBackground();
FAR NXWidgets::CWidgetControl *control = background->getWidgetControl();
m_iconWidget = new CIconWidget(m_twm4nx, control, pos->x, pos->y);
m_iconWidget = new CIconWidget(m_twm4nx, control, pos->x, pos->y, &style);
if (m_iconWidget == (FAR CIconWidget *)0)
{
twmerr("ERROR: Failed to create the icon widget\n");
@ -973,11 +990,11 @@ bool CWindow::fillToolbar(void)
return false;
}
// Get the background color of the current widget style.
// REVISIT: Using the the non-shadowed border color
// Fill the toolbar with the background color of the current widget style
// (which is always the default widget style for now).
port->drawFilledRect(0, 0, windowSize.w, windowSize.h,
CONFIG_NXTK_BORDERCOLOR1);
NXWidgets::g_defaultWidgetStyle->colors.background);
return true;
}
@ -1184,7 +1201,7 @@ bool CWindow::createToolbarButtons(uint8_t flags)
h = scaler->getHeight();
m_tbButtons[btindex] =
new NXWidgets::CImage(control, 0, 0, w, h, scaler, 0);
new NXWidgets::CImage(control, 0, 0, w, h, scaler, &m_tbStyle);
if (m_tbButtons[btindex] == (FAR NXWidgets::CImage *)0)
{
twmerr("ERROR: Failed to create image\n");
@ -1204,7 +1221,7 @@ bool CWindow::createToolbarButtons(uint8_t flags)
h = cbitmap->getHeight();
m_tbButtons[btindex] =
new NXWidgets::CImage(control, 0, 0, w, h, cbitmap, 0);
new NXWidgets::CImage(control, 0, 0, w, h, cbitmap, &m_tbStyle);
if (m_tbButtons[btindex] == (FAR NXWidgets::CImage *)0)
{
twmerr("ERROR: Failed to create image\n");
@ -1308,7 +1325,7 @@ bool CWindow::createToolbarTitle(FAR const NXWidgets::CNxString &name)
// Create the toolbar title widget
m_tbTitle = new NXWidgets::CLabel(control, titlePos.x, titlePos.y,
titleSize.w, titleSize.h, name);
titleSize.w, titleSize.h, name, &m_tbStyle);
if (m_tbTitle == (FAR NXWidgets::CLabel *)0)
{
twmerr("ERROR: Failed to construct tool bar title widget\n");

View File

@ -108,7 +108,9 @@ namespace NXWidgets
extern const struct SRlePaletteBitmap g_calibrationBitmap;
extern const struct SRlePaletteBitmap g_cmdBitmap;
extern const struct SRlePaletteBitmap g_menuBitmap;
extern const struct SRlePaletteBitmap g_menu2Bitmap;
extern const struct SRlePaletteBitmap g_resizeBitmap;
extern const struct SRlePaletteBitmap g_resize2Bitmap;
extern const struct SRlePaletteBitmap g_nxiconBitmap;
// Used by NxWM meda player
@ -120,8 +122,10 @@ namespace NXWidgets
extern const struct SRlePaletteBitmap g_mplayerRewBitmap;
extern const struct SRlePaletteBitmap g_mplayerVolBitmap;
extern const struct SRlePaletteBitmap g_minimizeBitmap;
extern const struct SRlePaletteBitmap g_minimize2Bitmap;
extern const struct SRlePaletteBitmap g_playBitmap;
extern const struct SRlePaletteBitmap g_stopBitmap;
extern const struct SRlePaletteBitmap g_stop2Bitmap;
}
#endif // __cplusplus

View File

@ -125,8 +125,8 @@ namespace NXWidgets
class CWidgetStyle
{
public:
CWidgetColors colors; /**< Default widget colors */
CNxFont *font; /**< Default font */
CWidgetColors colors; /**< Default widget colors */
CNxFont *font; /**< Default font */
};
}

View File

@ -128,11 +128,19 @@
// Colors
#ifndef CONFIG_TWM4NX_NXTERM_WCOLOR
# define CONFIG_TWM4NX_NXTERM_WCOLOR CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_NXTERM_WCOLOR CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
# else
# define CONFIG_TWM4NX_NXTERM_WCOLOR MKRGB(188,152,106)
# endif
#endif
#ifndef CONFIG_TWM4NX_NXTERM_FONTCOLOR
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
# else
# define CONFIG_TWM4NX_NXTERM_FONTCOLOR MKRGB(112,70,14)
# endif
#endif
// Font ID

View File

@ -79,7 +79,9 @@ namespace Twm4Nx
FAR CTwm4Nx *m_twm4nx; /**< Cached CTwm4Nx instance */
mqd_t m_eventq; /**< NxWidget event message queue */
FAR NXWidgets::CBgWindow *m_backWindow; /**< The background window */
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
FAR NXWidgets::CImage *m_backImage; /**< The background image */
#endif
/**
* Create the background window.
@ -96,6 +98,7 @@ namespace Twm4Nx
bool createBackgroundWidget(void);
#ifdef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
/**
* Create the background image.
*
@ -104,6 +107,7 @@ namespace Twm4Nx
*/
bool createBackgroundImage(FAR const struct NXWidgets::SRlePaletteBitmap *sbitmap);
#endif
/**
* Release resources held by the background.

View File

@ -173,6 +173,7 @@ namespace Twm4Nx
// Toolbar
FAR NXWidgets::CNxToolbar *m_toolbar; /**< The tool bar sub-window */
FAR NXWidgets::CWidgetStyle m_tbStyle; /**< The tool bar widget style */
FAR NXWidgets::CLabel *m_tbTitle; /**< Toolbar title widget */
nxgl_coord_t m_tbHeight; /**< Height of the toolbar */
nxgl_coord_t m_tbLeftX; /**< Rightmost position of left buttons */

View File

@ -86,12 +86,18 @@
/**
* CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
* MKRGB(148,189,215)
* CONFIG_TWM4NX_BACKGROUND_HASIMAGE - True if the background has an image
* CONFIG_TWM4NX_BACKGROUND_IMAGE - The name of the image to use in the
* background window. Default:NXWidgets::g_nuttxBitmap160x160
*/
#ifndef CONFIG_TWM4NX_BACKGROUND_IMAGE
# define CONFIG_TWM4NX_BACKGROUND_IMAGE NXWidgets::g_nuttxBitmap160x160
#ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_BACKGROUND_HASIMAGE 1
# ifndef CONFIG_TWM4NX_BACKGROUND_IMAGE
# define CONFIG_TWM4NX_BACKGROUND_IMAGE NXWidgets::g_nuttxBitmap160x160
# endif
#else
# undef CONFIG_TWM4NX_BACKGROUND_HASIMAGE
#endif
// Windows //////////////////////////////////////////////////////////////////
@ -111,19 +117,35 @@
*/
#ifndef CONFIG_TWM4NX_MENU_IMAGE
# define CONFIG_TWM4NX_MENU_IMAGE NXWidgets::g_menuBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_MENU_IMAGE NXWidgets::g_menuBitmap
# else
# define CONFIG_TWM4NX_MENU_IMAGE NXWidgets::g_menu2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_MINIMIZE_IMAGE
# define CONFIG_TWM4NX_MINIMIZE_IMAGE NXWidgets::g_minimizeBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_MINIMIZE_IMAGE NXWidgets::g_minimizeBitmap
# else
# define CONFIG_TWM4NX_MINIMIZE_IMAGE NXWidgets::g_minimize2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_RESIZE_IMAGE
# define CONFIG_TWM4NX_RESIZE_IMAGE NXWidgets::g_resizeBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_RESIZE_IMAGE NXWidgets::g_resizeBitmap
# else
# define CONFIG_TWM4NX_RESIZE_IMAGE NXWidgets::g_resize2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_TERMINATE_IMAGE
# define CONFIG_TWM4NX_TERMINATE_IMAGE NXWidgets::g_stopBitmap
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_TERMINATE_IMAGE NXWidgets::g_stopBitmap
# else
# define CONFIG_TWM4NX_TERMINATE_IMAGE NXWidgets::g_stop2Bitmap
# endif
#endif
#ifndef CONFIG_TWM4NX_ICONMGR_IMAGE
@ -174,23 +196,56 @@
* CONFIG_TWM4NX_MENU_IMAGE. Menu image (see toolbar icons)
*/
// Themes ///////////////////////////////////////////////////////////////////
/**
* CONFIG_TWM4NX_CLASSIC. Strong bordered windows with dark primary colors.
* Reminiscent of Windows 98.
* CONFIG_TWM4NX_CONTEMPORARY. Border-less windows in pastel shades for a
* more contemporary look
*
* Selecting a theme selects default colors, button images, and icons. For
* a given theme to work correctly, it may depend on other configuration
* settings outside of Twm4Nx.
*/
#if defined(CONFIG_TWM4NX_CONTEMPORARY) && CONFIG_NXTK_BORDERWIDTH != 0
# warning Contemporary theme needs border-less windows (CONFIG_NXTK_BORDERWIDTH == 0)
#endif
// Colors ///////////////////////////////////////////////////////////////////
/**
* Color configuration
*
* CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR - Normal background color. Default:
* MKRGB(148,189,215)
* CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR - Normal background color. Defaults:
* Classic Theme: MKRGB(148,189,215)
* Contemporary Theme: MKRGB(101,157,189)
* CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR - Select background color.
* Default: MKRGB(206,227,241)
* Defaults:
* Classic Theme: MKRGB(206,227,241)
* Contemporary Theme: MKRGB(143,191,219)
* CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR - Normal toolbar background color. Defaults:
* Classic Theme: MKRGB(148,189,215)
* Contemporary Theme: MKRGB(193,167,79)
* CONFIG_TWM4NX_DEFAULT_SELECTTOOLBARCOLOR - Select toolbar color.
* Defaults:
* Classic Theme: MKRGB(206,227,241)
* Contemporary Theme: MKRGB(251,238,193)
* CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR - Color of the bright edge of a border.
* Default: MKRGB(255,255,255)
* Defaults:
* Classic Theme: MKRGB(255,255,255)
* Contemporary Theme: MKRGB(251,240,199)
* CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR - Color of the shadowed edge of a border.
* Default: MKRGB(0,0,0)
* CONFIG_TWM4NX_DEFAULT_FONTCOLOR - Default font color. Default:
* MKRGB(0,0,0)
* CONFIG_TWM4NX_TRANSPARENT_COLOR - The "transparent" color. Default:
* MKRGB(0,0,0)
* Defaults:
* Classic Theme: MKRGB(0,0,0)
* Contemporary Theme: MKRGB(201,165,116)
* CONFIG_TWM4NX_DEFAULT_FONTCOLOR - Default font color. Defaults:
* Classic Theme: MKRGB(255,255,255)
* Contemporary Theme: MKRGB(255,255,255)
* CONFIG_TWM4NX_TRANSPARENT_COLOR - The "transparent" color. Defaults:
* Classic Theme: MKRGB(0,0,0)
* Contemporary Theme: MKRGB(0,0,0)
*/
/**
@ -198,7 +253,11 @@
*/
#ifndef CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR
# define CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR MKRGB(148,189,215)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR MKRGB(148,189,215)
# else
# define CONFIG_TWM4NX_DEFAULT_BACKGROUNDCOLOR MKRGB(101,148,188)
# endif
#endif
/**
@ -206,7 +265,35 @@
*/
#ifndef CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR
# define CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(206,227,241)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(206,227,241)
# else
# define CONFIG_TWM4NX_DEFAULT_SELECTEDBACKGROUNDCOLOR MKRGB(158,193,211)
# endif
#endif
/**
* Normal toolbar background color
*/
#ifndef CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR MKRGB(148,189,215)
# else
# define CONFIG_TWM4NX_DEFAULT_TOOLBARCOLOR MKRGB(193,167,79)
# endif
#endif
/**
* Default selected toolbar background color
*/
#ifndef CONFIG_TWM4NX_DEFAULT_SELECTEDTOOLBARCOLOR
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SELECTEDTOOLBARCOLOR MKRGB(206,227,241)
# else
# define CONFIG_TWM4NX_DEFAULT_SELECTEDTOOLBARCOLOR MKRGB(251,238,193)
# endif
#endif
/**
@ -214,11 +301,19 @@
*/
#ifndef CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR
# define CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR MKRGB(248,248,248)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR MKRGB(248,248,248)
# else
# define CONFIG_TWM4NX_DEFAULT_SHINEEDGECOLOR MKRGB(251,240,199)
# endif
#endif
#ifndef CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR
# define CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR MKRGB(35,58,73)
# ifdef CONFIG_TWM4NX_CLASSIC
# define CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR MKRGB(35,58,73)
# else
# define CONFIG_TWM4NX_DEFAULT_SHADOWEDGECOLOR MKRGB(201,165,116)
# endif
#endif
/**
@ -314,27 +409,23 @@
// Font Colors
#ifndef CONFIG_TWM4NX_TITLE_FONTCOLOR
# define CONFIG_TWM4NX_TITLE_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_TITLE_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_MENU_FONTCOLOR
# define CONFIG_TWM4NX_MENU_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_MENU_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_ICON_FONTCOLOR
# define CONFIG_TWM4NX_ICON_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_ICON_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_SIZE_FONTCOLOR
# define CONFIG_TWM4NX_SIZE_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_SIZE_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
#ifndef CONFIG_TWM4NX_ICONMGR_FONTCOLOR
# define CONFIG_TWM4NX_ICONMGR_FONTCOLOR MKRGB(0,64,0)
#endif
#ifndef CONFIG_TWM4NX_DEFAULT_FONTCOLOR
# define CONFIG_TWM4NX_DEFAULT_FONTCOLOR MKRGB(0,64,0)
# define CONFIG_TWM4NX_ICONMGR_FONTCOLOR CONFIG_TWM4NX_DEFAULT_FONTCOLOR
#endif
// Input Devices /////////////////////////////////////////////////////////////