fixed bug displaying pixmaps with transparency

This commit is contained in:
louis 2015-07-08 19:08:57 +02:00
parent 5df1af0e17
commit ce49462ca7
3 changed files with 15 additions and 21 deletions

View File

@ -379,3 +379,5 @@ Version 0.5.3
- added banner to displaymenuschedulescurrentview and - added banner to displaymenuschedulescurrentview and
displaymenureplaycurrentview displaymenureplaycurrentview
- immplemented areacontainers to group areas - immplemented areacontainers to group areas
- fixed bug displaying pixmaps with transparency

View File

@ -128,9 +128,8 @@ void cPixmapContainer::CreatePixmap(int num, int Layer, const cRect &ViewPort, c
pixmaps[num]->Fill(clrTransparent); pixmaps[num]->Fill(clrTransparent);
if (pixContainerInit && (fadeTime || shiftTime)) { if (pixContainerInit && (fadeTime || shiftTime)) {
pixmaps[num]->SetAlpha(0); pixmaps[num]->SetAlpha(0);
} else if (pixmapsTransparency[num] > 0) { } else if (pixmapsTransparency[num]) {
int alpha = (100 - pixmapsTransparency[num])*255/100; pixmaps[num]->SetAlpha(pixmapsTransparency[num]);
pixmaps[num]->SetAlpha(alpha);
} }
} }
@ -224,7 +223,7 @@ void cPixmapContainer::SetAlpha(int num, int Alpha) {
void cPixmapContainer::SetTransparency(int num, int Transparency) { void cPixmapContainer::SetTransparency(int num, int Transparency) {
if (Transparency < 0 && Transparency > 100) if (Transparency < 0 && Transparency > 100)
return; return;
pixmapsTransparency[num] = Transparency; pixmapsTransparency[num] = (100 - Transparency)*255/100;
} }
void cPixmapContainer::SetLayer(int num, int Layer) { void cPixmapContainer::SetLayer(int num, int Layer) {
@ -352,8 +351,9 @@ int cPixmapContainer::AnimationDelay(void) {
void cPixmapContainer::FadeIn(void) { void cPixmapContainer::FadeIn(void) {
if (!fadeTime) { if (!fadeTime) {
for (int i = 0; i < numPixmaps; i++) { for (int i = 0; i < numPixmaps; i++) {
if (PixmapExists(i)) if (PixmapExists(i)) {
SetAlpha(i, ALPHA_OPAQUE); SetAlpha(i, pixmapsTransparency[i] ? pixmapsTransparency[i] : ALPHA_OPAQUE);
}
} }
return; return;
} }
@ -368,12 +368,8 @@ void cPixmapContainer::FadeIn(void) {
for (int i = 0; i < numPixmaps; i++) { for (int i = 0; i < numPixmaps; i++) {
if (!PixmapExists(i)) if (!PixmapExists(i))
continue; continue;
if (pixmapsTransparency[i] > 0) { int alpha = (double)pixmapsTransparency[i] / 255.0 * Alpha;
int alpha = (100 - pixmapsTransparency[i])*Alpha/100; SetAlpha(i, alpha);
SetAlpha(i, alpha);
} else {
SetAlpha(i, Alpha);
}
} }
DoFlush(); DoFlush();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
@ -398,12 +394,8 @@ void cPixmapContainer::FadeOut(void) {
for (int i = 0; i < numPixmaps; i++) { for (int i = 0; i < numPixmaps; i++) {
if (!PixmapExists(i)) if (!PixmapExists(i))
continue; continue;
if (pixmapsTransparency[i] > 0) { int alpha = (double)pixmapsTransparency[i] / 255.0 * Alpha;
int alpha = (100 - pixmapsTransparency[i])*Alpha/100; SetAlpha(i, alpha);
SetAlpha(i, alpha);
} else {
SetAlpha(i, Alpha);
}
} }
DoFlush(); DoFlush();
int Delta = cTimeMs::Now() - Now; int Delta = cTimeMs::Now() - Now;
@ -481,7 +473,7 @@ void cPixmapContainer::ShiftInFromBorder(int frames, int frameTime) {
cRect r = ViewPort(i); cRect r = ViewPort(i);
r.SetPoint(pos.X(), pos.Y()); r.SetPoint(pos.X(), pos.Y());
SetViewPort(i, r); SetViewPort(i, r);
SetAlpha(i, ALPHA_OPAQUE); SetAlpha(i, pixmapsTransparency[i] ? pixmapsTransparency[i] : ALPHA_OPAQUE);
} }
DoFlush(); DoFlush();
//Calculating total shifting distance //Calculating total shifting distance
@ -635,7 +627,7 @@ void cPixmapContainer::ShiftInFromPoint(int frames, int frameTime) {
cRect r = ViewPort(i); cRect r = ViewPort(i);
r.SetPoint(startPos); r.SetPoint(startPos);
SetViewPort(i, r); SetViewPort(i, r);
SetAlpha(i, ALPHA_OPAQUE); SetAlpha(i, pixmapsTransparency[i] ? pixmapsTransparency[i] : ALPHA_OPAQUE);
} }
DoFlush(); DoFlush();
//Move In //Move In

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd"> <!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd">
<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="0" shifttype="bottom" shiftmode="slowed"> <displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttimechannel}" shifttype="bottom" shiftmode="slowed">
<background> <background>
<!-- background infobar --> <!-- background infobar -->
<area x="0" y="80%" width="100%" height="20%" layer="1"> <area x="0" y="80%" width="100%" height="20%" layer="1">