Experimental option for non-transparent fonts, to make them readable with high transparency levels. Looking a bit ugly, must be improved

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1858 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2011-11-17 10:53:53 +00:00
parent ebb93aae6a
commit 0b32b39bdf
7 changed files with 43 additions and 30 deletions

View File

@@ -259,6 +259,7 @@ colorchooser.blue blue
colorchooser.green green colorchooser.green green
colorchooser.red red colorchooser.red red
colormenu.background Background colormenu.background Background
colormenu.contrast_fonts Contrast fonts
colormenu.fade Fade menus colormenu.fade Fade menus
colormenu.font Select GUI font colormenu.font Select GUI font
colormenu.font_ttx Select Teletext font colormenu.font_ttx Select Teletext font

View File

@@ -35,6 +35,7 @@
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <system/debug.h> #include <system/debug.h>
#include <global.h>
/* Drawing pixels is actually faster without the GXA accelerator (wich OTOH is /* Drawing pixels is actually faster without the GXA accelerator (wich OTOH is
faster for drawing lines, so disable it here. */ faster for drawing lines, so disable it here. */
@@ -451,6 +452,9 @@ void Font::RenderString(int x, int y, const int width, const char *text, const u
(((fgg + deltag * i / 255) & ((1 << gl) - 1)) << go) | (((fgg + deltag * i / 255) & ((1 << gl) - 1)) << go) |
(((fgb + deltab * i / 255) & ((1 << bl) - 1)) << bo) | (((fgb + deltab * i / 255) & ((1 << bl) - 1)) << bo) |
(((fgt + deltat * i / 255) & ((1 << tl) - 1)) << to)); (((fgt + deltat * i / 255) & ((1 << tl) - 1)) << to));
/* FIXME must be better solution */
if(g_settings.contrast_fonts && ((255-i) > 128))
colors[255 - i] |= 0xFF << to;
} }
} }
@@ -540,7 +544,9 @@ void Font::RenderString(int x, int y, const int width, const char *text, const u
frameBuffer->paintPixel(x + glyph->left + ax, y - glyph->top + ay, colors[*s++]); frameBuffer->paintPixel(x + glyph->left + ax, y - glyph->top + ay, colors[*s++]);
#else #else
/* do not paint the backgroundcolor, see below */ /* do not paint the backgroundcolor, see below */
if (colors[*s] != bgcolor) //if (colors[*s] != bgcolor)
// from code above bgcolor index should be always 0
if(*s != 0)
*td = colors[*s]; *td = colors[*s];
td++; s++; td++; s++;
#endif #endif
@@ -570,7 +576,9 @@ void Font::RenderString(int x, int y, const int width, const char *text, const u
colored boxes are painted beneath the fonts anyway colored boxes are painted beneath the fonts anyway
note that this is not totally correct, because of subpixel hinting etc, note that this is not totally correct, because of subpixel hinting etc,
but that should be barely visible in reality ;) */ but that should be barely visible in reality ;) */
if (colors[lcolor] != bgcolor) //if (colors[lcolor] != bgcolor)
// from code above bgcolor index should be always 0
if (lcolor != 0)
*td = colors[lcolor]; *td = colors[lcolor];
td++; td++;
#endif #endif

View File

@@ -552,11 +552,12 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts)
fontSettings->addItem( new CMenuForwarder(LOCALE_COLORMENU_FONT, true, NULL, this, "select_font", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED)); fontSettings->addItem( new CMenuForwarder(LOCALE_COLORMENU_FONT, true, NULL, this, "select_font", CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED));
fontSettings->addItem( new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, NULL, this, "ttx_font", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN)); fontSettings->addItem( new CMenuForwarder(LOCALE_COLORMENU_FONT_TTX, true, NULL, this, "ttx_font", CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN));
fontSettings->addItem( new CMenuOptionChooser(LOCALE_COLORMENU_CONTRAST_FONTS, &g_settings.contrast_fonts, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW));
fontSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_FONTMENU_SIZES)); fontSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_FONTMENU_SIZES));
//submenu font scaling //submenu font scaling
fontSettings->addItem(new CMenuForwarder(LOCALE_FONTMENU_SCALING, true, NULL, this, "font_scaling", CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW)); fontSettings->addItem(new CMenuForwarder(LOCALE_FONTMENU_SCALING, true, NULL, this, "font_scaling", CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE));
//fontSettings->addItem( new CMenuForwarder(LOCALE_EPGPLUS_SELECT_FONT_NAME, true, NULL, this, "select_font")); //fontSettings->addItem( new CMenuForwarder(LOCALE_EPGPLUS_SELECT_FONT_NAME, true, NULL, this, "select_font"));
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
{ {
@@ -571,7 +572,7 @@ void COsdSetup::showOsdFontSizeSetup(CMenuWidget *menu_fonts)
fontSettingsSubMenu->addItem(GenericMenuSeparatorLine); fontSettingsSubMenu->addItem(GenericMenuSeparatorLine);
fontSettingsSubMenu->addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, font_sizes_groups[i].actionkey)); fontSettingsSubMenu->addItem(new CMenuForwarder(LOCALE_OPTIONS_DEFAULT, true, NULL, this, font_sizes_groups[i].actionkey));
fontSettings->addItem(new CMenuForwarder(font_sizes_groups[i].groupname, true, NULL, fontSettingsSubMenu)); fontSettings->addItem(new CMenuForwarder(font_sizes_groups[i].groupname, true, NULL, fontSettingsSubMenu, "", CRCInput::convertDigitToKey(i+1)));
} }
} }
@@ -633,6 +634,3 @@ void COsdSetup::showOsdChanlistSetup(CMenuWidget *menu_chanlist)
menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_CHANNELLIST_FOOT, &g_settings.channellist_foot, CHANNELLIST_FOOT_OPTIONS, CHANNELLIST_FOOT_OPTIONS_COUNT, true)); menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_CHANNELLIST_FOOT, &g_settings.channellist_foot, CHANNELLIST_FOOT_OPTIONS, CHANNELLIST_FOOT_OPTIONS_COUNT, true));
menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_COLORED_EVENTS, &g_settings.colored_events_channellist, OPTIONS_COLORED_EVENTS_OPTIONS, OPTIONS_COLORED_EVENTS_OPTION_COUNT, true)); menu_chanlist->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_CHANNELLIST_COLORED_EVENTS, &g_settings.colored_events_channellist, OPTIONS_COLORED_EVENTS_OPTIONS, OPTIONS_COLORED_EVENTS_OPTION_COUNT, true));
} }

View File

@@ -564,6 +564,8 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.colored_events_green = configfile.getInt32( "colored_events_green", 70 ); g_settings.colored_events_green = configfile.getInt32( "colored_events_green", 70 );
g_settings.colored_events_blue = configfile.getInt32( "colored_events_blue", 0 ); g_settings.colored_events_blue = configfile.getInt32( "colored_events_blue", 0 );
g_settings.contrast_fonts = configfile.getInt32("contrast_fonts", 0);
//network //network
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) { for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) {
sprintf(cfg_key, "network_nfs_ip_%d", i); sprintf(cfg_key, "network_nfs_ip_%d", i);
@@ -1127,6 +1129,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setInt32( "colored_events_green", g_settings.colored_events_green ); configfile.setInt32( "colored_events_green", g_settings.colored_events_green );
configfile.setInt32( "colored_events_blue", g_settings.colored_events_blue ); configfile.setInt32( "colored_events_blue", g_settings.colored_events_blue );
configfile.setInt32( "contrast_fonts", g_settings.contrast_fonts );
//network //network
for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) { for(int i=0 ; i < NETWORK_NFS_NR_OF_ENTRIES ; i++) {
sprintf(cfg_key, "network_nfs_ip_%d", i); sprintf(cfg_key, "network_nfs_ip_%d", i);

View File

@@ -286,6 +286,7 @@ typedef enum
LOCALE_COLORCHOOSER_GREEN, LOCALE_COLORCHOOSER_GREEN,
LOCALE_COLORCHOOSER_RED, LOCALE_COLORCHOOSER_RED,
LOCALE_COLORMENU_BACKGROUND, LOCALE_COLORMENU_BACKGROUND,
LOCALE_COLORMENU_CONTRAST_FONTS,
LOCALE_COLORMENU_FADE, LOCALE_COLORMENU_FADE,
LOCALE_COLORMENU_FONT, LOCALE_COLORMENU_FONT,
LOCALE_COLORMENU_FONT_TTX, LOCALE_COLORMENU_FONT_TTX,

View File

@@ -286,6 +286,7 @@ const char * locale_real_names[] =
"colorchooser.green", "colorchooser.green",
"colorchooser.red", "colorchooser.red",
"colormenu.background", "colormenu.background",
"colormenu.contrast_fonts",
"colormenu.fade", "colormenu.fade",
"colormenu.font", "colormenu.font",
"colormenu.font_ttx", "colormenu.font_ttx",

View File

@@ -210,6 +210,7 @@ struct SNeutrinoSettings
unsigned char colored_events_blue; unsigned char colored_events_blue;
int colored_events_channellist; int colored_events_channellist;
int colored_events_infobar; int colored_events_infobar;
int contrast_fonts;
//network //network
#define NETWORK_NFS_NR_OF_ENTRIES 8 #define NETWORK_NFS_NR_OF_ENTRIES 8