I'm trying to display channel icons in an EPG plugin I've
written for enigma. They're all in .png format. Unfortunately
they all come out with badly mangled colours.
Can anyone give me guidelines how I can either pre-prepare PNGs
so that they'll come out OK independent of the skin-palette,
or how I can accomplish that with any old .png using the enigma
API ?
Thanks,
PentVaer
p.s. I use a dreambox, if it's relevant.
p.p.s replies auf Deutsch are fine, I just don't write it so good
PNG import
-
- Beiträge: 2
- Registriert: Samstag 21. August 2004, 14:45
I'm facing the same problem here. I'm writing a weatherplugin and I want it to display nice weathericons. I've no problems displaying an icon but the palette is wrong.
The problem is that I do not understand how the palette works. All the images that were preloaded by enigma show correctly. So if I would use:
gPixmap *p = eSkin::getActive()->queryImage("dreamlogo");
That would show correct in my window. But, if I load the very same image manually with loadPNG the colors are wrong. I think the correct procedure would be to get the current palette (or clut), update this palette with the colors used in my image and the reapply the palette. But, I didnt succeed doing this yet..
Does anyone have some examplecode that will show how to display a PNG image in a window?
Thanks,
Bjorn
The problem is that I do not understand how the palette works. All the images that were preloaded by enigma show correctly. So if I would use:
gPixmap *p = eSkin::getActive()->queryImage("dreamlogo");
That would show correct in my window. But, if I load the very same image manually with loadPNG the colors are wrong. I think the correct procedure would be to get the current palette (or clut), update this palette with the colors used in my image and the reapply the palette. But, I didnt succeed doing this yet..
Does anyone have some examplecode that will show how to display a PNG image in a window?
Thanks,
Bjorn
-
- Beiträge: 2
- Registriert: Samstag 21. August 2004, 14:45
I've found the solution. First of all your PNG files have to be of the correct type. You can use the following ImageMagick command to convert them:
convert -type PaletteMatte src.png dst.png
Then use the following code:
gPixmap *img = loadPNG("/path/to/dst.png");
gPixmap * mp = &gFBDC::getInstance()->getPixmap();
gPixmapDC mydc(img);
gPainter p(mydc);
p.mergePalette(*mp);
lb->move(ePoint(45, 100));
lb->resize(eSize(580, 580));
lb->setBlitFlags(BF_ALPHATEST);
lb->setPixmap(img);
lb->setPixmapPosition(ePoint(1, 1));
No idea if this is the best method but it does work..
Best regards,
Bjorn
convert -type PaletteMatte src.png dst.png
Then use the following code:
gPixmap *img = loadPNG("/path/to/dst.png");
gPixmap * mp = &gFBDC::getInstance()->getPixmap();
gPixmapDC mydc(img);
gPainter p(mydc);
p.mergePalette(*mp);
lb->move(ePoint(45, 100));
lb->resize(eSize(580, 580));
lb->setBlitFlags(BF_ALPHATEST);
lb->setPixmap(img);
lb->setPixmapPosition(ePoint(1, 1));
No idea if this is the best method but it does work..
Best regards,
Bjorn
-
- Neugieriger
- Beiträge: 14
- Registriert: Montag 8. März 2004, 08:50