avoided nasty font pixelation effects with theme iceblue

This commit is contained in:
louis 2013-05-28 17:23:33 +02:00
parent 6a6db7ff52
commit 4f93ac2516
7 changed files with 30 additions and 23 deletions

View File

@ -69,6 +69,7 @@ void cDetailView::createPixmaps() {
void cDetailView::drawHeader() {
header->drawBackground();
header->drawBoldBorder();
tColor colorTextBack = (tvguideConfig.useBlending==0)?theme.Color(clrHeader):clrTransparent;
int logoHeight = header->Height() / 2;
int logoWidth = logoHeight * tvguideConfig.logoWidthRatio / tvguideConfig.logoHeightRatio;
int lineHeight = tvguideConfig.FontDetailHeader->Height();
@ -93,27 +94,28 @@ void cDetailView::drawHeader() {
}
int textX = logoDrawn?(20 + logoWidth):20;
int textY = (header->Height() - 2*lineHeight)/2;
header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailHeader);
header->DrawText(cPoint(textX, textY), event->Title(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailHeader);
cString datetime = cString::sprintf("%s, %s - %s (%d min)", *event->GetDateString(), *event->GetTimeString(), *event->GetEndTimeString(), event->Duration()/60);
header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
header->DrawText(cPoint(textX, textY + lineHeight), *datetime, theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView);
header->DrawText(cPoint(textX, textY + 2 * lineHeight), event->ShortText(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView);
}
void cDetailView::drawContent() {
content->Fill(theme.Color(clrBorder));
content->DrawRectangle(cRect(2, 0, content->ViewPort().Width() - 2, content->DrawPort().Height()), theme.Color(clrBackground));
tColor colorTextBack = (tvguideConfig.useBlending==0)?theme.Color(clrBackground):clrTransparent;
int textHeight = tvguideConfig.FontDetailView->Height();
int textLines = description.Lines();
int i=0;
for (; i<textLines; i++) {
content->DrawText(cPoint(20, 20 + i*textHeight), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
content->DrawText(cPoint(20, 20 + i*textHeight), description.GetLine(i), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView);
}
i++;
if (tvguideConfig.displayRerunsDetailEPGView) {
textLines = reruns.Lines();
for (int j=0; j<textLines; j++) {
content->DrawText(cPoint(20, 20 + i*textHeight), reruns.GetLine(j), theme.Color(clrFont), clrTransparent, tvguideConfig.FontDetailView);
content->DrawText(cPoint(20, 20 + i*textHeight), reruns.GetLine(j), theme.Color(clrFont), colorTextBack, tvguideConfig.FontDetailView);
i++;
}
}

View File

@ -58,23 +58,24 @@ void cDummyGrid::setText() {
void cDummyGrid::drawText() {
tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont);
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
if (tvguideConfig.displayMode == eVertical) {
if (Height()/tvguideConfig.minutePixel < 6)
return;
int textHeight = tvguideConfig.FontGrid->Height();
int textLines = text->Lines();
for (int i=0; i<textLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, clrTransparent, tvguideConfig.FontGrid);
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, tvguideConfig.FontGrid);
}
} else if (tvguideConfig.displayMode == eHorizontal) {
if (Width()/tvguideConfig.minutePixel < 10) {
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, clrTransparent, tvguideConfig.FontGridHorizontal);
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, tvguideConfig.FontGridHorizontal);
return;
}
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, clrTransparent, tvguideConfig.FontGridHorizontal);
pixmap->DrawText(cPoint(borderWidth, titleY), *strText, colorText, colorTextBack, tvguideConfig.FontGridHorizontal);
}
}
cString cDummyGrid::getText(void) {

View File

@ -72,20 +72,21 @@ void cEpgGrid::setText() {
void cEpgGrid::drawText() {
tColor colorText = (active)?theme.Color(clrFontActive):theme.Color(clrFont);
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
if (tvguideConfig.displayMode == eVertical) {
if (Height()/tvguideConfig.minutePixel < 6)
return;
int textHeight = tvguideConfig.FontGrid->Height();
int textLines = text->Lines();
for (int i=0; i<textLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, clrTransparent, tvguideConfig.FontGrid);
pixmap->DrawText(cPoint(borderWidth, borderWidth + i*textHeight), text->GetLine(i), colorText, colorTextBack, tvguideConfig.FontGrid);
}
int extTextLines = extText->Lines();
int offset = (textLines+1)*textHeight - 0.5*textHeight;
textHeight = tvguideConfig.FontGridSmall->Height();
if ((Height()-textHeight-10) > offset) {
for (int i=0; i<extTextLines; i++) {
pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), colorText, clrTransparent, tvguideConfig.FontGridSmall);
pixmap->DrawText(cPoint(borderWidth, borderWidth + offset + i*textHeight), extText->GetLine(i), colorText, colorTextBack, tvguideConfig.FontGridSmall);
}
}
if (hasTimer)
@ -93,13 +94,13 @@ void cEpgGrid::drawText() {
} else if (tvguideConfig.displayMode == eHorizontal) {
if (Width()/tvguideConfig.minutePixel < 10) {
int titleY = (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, clrTransparent, tvguideConfig.FontGridHorizontal);
pixmap->DrawText(cPoint(borderWidth - 2, titleY), "...", colorText, colorTextBack, tvguideConfig.FontGridHorizontal);
return;
}
pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, clrTransparent, tvguideConfig.FontGridHorizontalSmall);
pixmap->DrawText(cPoint(borderWidth, borderWidth), *timeString, colorText, colorTextBack, tvguideConfig.FontGridHorizontalSmall);
cString strTitle = CutText(event->Title(), viewportHeight, tvguideConfig.FontGridHorizontal).c_str();
int titleY = tvguideConfig.FontGridHorizontalSmall->Height() + (tvguideConfig.rowHeight - tvguideConfig.FontGridHorizontalSmall->Height() - tvguideConfig.FontGridHorizontal->Height())/2;
pixmap->DrawText(cPoint(borderWidth, titleY), *strTitle, colorText, clrTransparent, tvguideConfig.FontGridHorizontal);
pixmap->DrawText(cPoint(borderWidth, titleY), *strTitle, colorText, colorTextBack, tvguideConfig.FontGridHorizontal);
}
}
@ -108,7 +109,7 @@ void cEpgGrid::drawRecIcon() {
int width = tvguideConfig.FontGrid->Width(*recIconText)+2*borderWidth;
int height = tvguideConfig.FontGrid->Height()+10;
pixmap->DrawRectangle( cRect(Width() - width - borderWidth, Height() - height - borderWidth, width, height), theme.Color(clrButtonRed));
pixmap->DrawText(cPoint(Width() - width, Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), clrTransparent, tvguideConfig.FontGrid);
pixmap->DrawText(cPoint(Width() - width, Height() - height - borderWidth/2), *recIconText, theme.Color(clrFont), theme.Color(clrButtonRed), tvguideConfig.FontGrid);
}
cString cEpgGrid::getTimeString(void) {

View File

@ -39,7 +39,7 @@ void cFooter::drawBlueButton() {
}
void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int num) {
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
int left = num * buttonWidth + (num + 1) * buttonBorder;
footer->DrawRectangle(cRect(left, buttonY, buttonWidth, buttonHeight), borderColor);
if (tvguideConfig.useBlending) {
@ -52,5 +52,5 @@ void cFooter::DrawButton(const char *text, tColor color, tColor borderColor, int
}
int textWidth = tvguideConfig.FontButton->Width(text);
int textHeight = tvguideConfig.FontButton->Height();
footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), clrTransparent, tvguideConfig.FontButton);
footer->DrawText(cPoint(left + (buttonWidth-textWidth)/2, buttonY + (buttonHeight-textHeight)/2), text, theme.Color(clrFontButtons), colorTextBack, tvguideConfig.FontButton);
}

View File

@ -66,9 +66,10 @@ void cHeaderGrid::drawChannelHorizontal(const cChannel *channel) {
textWidthMax -= logoWidth;
}
if (drawText) {
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
cString strChannel = cString::sprintf("%d %s", channel->Number(), channel->Name());
strChannel = CutText(*strChannel, textWidthMax, tvguideConfig.FontChannelHeaderHorizontal).c_str();
pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontChannelHeaderHorizontal);
pixmap->DrawText(cPoint(textX, textY), *strChannel, theme.Color(clrFontHeader), colorTextBack, tvguideConfig.FontChannelHeaderHorizontal);
}
}
@ -99,12 +100,13 @@ void cHeaderGrid::drawChannelVertical(const cChannel *channel) {
}
if (!drawText)
return;
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
for (int i=0; i<lines; i++) {
int textWidth = tvguideConfig.FontChannelHeader->Width(tw.GetLine(i));
int xText = (tvguideConfig.colWidth - textWidth) / 2;
if (xText < 0)
xText = 0;
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), clrTransparent, tvguideConfig.FontChannelHeader);
pixmap->DrawText(cPoint(xText, yStart + i*lineHeight), tw.GetLine(i), theme.Color(clrFontHeader), colorTextBack, tvguideConfig.FontChannelHeader);
}
}

View File

@ -83,7 +83,7 @@ bool cMessageBox::Start(int displayTime, cString msg) {
int textWidth = 0;
for (int i=0; i<textLines; i++) {
textWidth = tvguideConfig.FontMessageBox->Width(message.GetLine(i));
content->DrawText(cPoint((width - textWidth)/2, 20 + i*textHeight), message.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontMessageBox);
content->DrawText(cPoint((width - textWidth)/2, 20 + i*textHeight), message.GetLine(i), theme.Color(clrFont), theme.Color(clrBackground), tvguideConfig.FontMessageBox);
}
cPixmap::Unlock();
msgboxThread->Start();

View File

@ -51,6 +51,7 @@ void cStatusHeader::ScaleVideo(void) {
void cStatusHeader::DrawInfoText(cGrid *grid) {
int border = 5;
tColor colorTextBack = (tvguideConfig.useBlending==0)?color:clrTransparent;
pixmapText->Fill(clrTransparent);
int x = border;
int y = border;
@ -61,7 +62,7 @@ void cStatusHeader::DrawInfoText(cGrid *grid) {
title = cString::sprintf(": %s", event->Title());
cString header = cString::sprintf("%s%s", *time, *title);
header = CutText(*header, pixmapText->ViewPort().Width() - 2 * border, tvguideConfig.FontStatusHeaderLarge).c_str();
pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeaderLarge);
pixmapText->DrawText(cPoint(x,y), *header, theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeaderLarge);
y += tvguideConfig.FontStatusHeaderLarge->Height() + border;
int heightText = pixmapText->ViewPort().Height() - y;
cTextWrapper description;
@ -71,17 +72,17 @@ void cStatusHeader::DrawInfoText(cGrid *grid) {
int maxLines = heightText / lineHeight;
int lines = min(textLines, maxLines);
for (int i = 0; i < lines-1; i++) {
pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeader);
pixmapText->DrawText(cPoint(x,y), description.GetLine(i), theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeader);
y += lineHeight;
}
cString lastLine = description.GetLine(lines-1);
if (textLines > maxLines) {
lastLine = cString::sprintf("%s...", *lastLine);
}
pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeader);
pixmapText->DrawText(cPoint(x,y), *lastLine, theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeader);
} else {
int heightText = pixmapText->ViewPort().Height() - y;
y += (heightText - tvguideConfig.FontStatusHeaderLarge->Height() - 2*border)/2;
pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), clrTransparent, tvguideConfig.FontStatusHeaderLarge);
pixmapText->DrawText(cPoint(x,y), *grid->getText(), theme.Color(clrFont), colorTextBack, tvguideConfig.FontStatusHeaderLarge);
}
}