Docky transparency on 16bit screens

This forum is for general developer support questions.
softwarefailure
Posts: 112
Joined: Fri Feb 14, 2014 10:29 pm

Docky transparency on 16bit screens

Post by softwarefailure »

I have written a docky that requests DOCKYRENDERMODE_RPPA and then draws a 32bit bitmap
(containing color and alpha channel transparency information) whenever it receives
DOCKYSET_RedrawNow. I draw this bitmap using BltBitMapTags(). This is working fine but
only on 32bit screens. Once I switch Workbench to a 16bit screen, the background is
completely black. This makes sense of course because there is no room for transparency
information in a 16bit bitmap. But then I'd need some other method of passing transparency
information to AmiDock on 16bit screens.

So my question is: How should my docky handle transparency on 16bit screens? There
is scarcely any information about this in the autodoc and header files so I hope there
is somebody here who can answer this question.

Thanks!
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Docky transparency on 16bit screens

Post by xenic »

I can't solve your problem but can point out that OS4 icons have alpha channel transparency and are displayed properly on 16 bit Workbench screen. Multiview and Picshow display 32 bit images with alpha transparency properly on my 16 bit workbench screen. Some other viewers don't do so well. I think it's possible but someone else will have to tell you how it's done.
AmigaOne X1000 with 2GB memory - OS4.1 FE
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

Re: Docky transparency on 16bit screens

Post by javierdlr »

softwarefailure wrote:I have written a docky that requests DOCKYRENDERMODE_RPPA and then draws a 32bit bitmap
(containing color and alpha channel transparency information) whenever it receives
DOCKYSET_RedrawNow. I draw this bitmap using BltBitMapTags(). This is working fine but
...
And using ' IGraphics->CompositeTags()'?

Not in front of my miggy, but you can try this (it uses 'case DOCKYGET_RenderMode: *msgData = DOCKYRENDERMODE_RPPA; break;')
being 'dd->..' part of 'struct DataDocky{}'

Code: Select all

..
 picObject = IDataTypes->NewDTObject(<FILE.PNG>, PDTA_Screen,dd->scr,
                                     PDTA_DestMode,PMODE_V43, DTA_GroupID,GID_PICTURE,
                                    TAG_DONE);
..
void DockyRender(struct DockyData *dd)
{
 struct BitMap *tempBM = NULL;
 LONG lock;
 struct RenderInfo ri;

 tempBM = IP96->p96AllocBitMap(<WIDTH>, <HEIGHT>, 32, 0L, NULL, RGBFB_A8R8G8B8);
#ifdef DDEBUG
IDOS->Printf("tempBM=0x%08lx\n",tempBM);
#endif
 if( (lock = IP96->p96LockBitMap( tempBM, (UBYTE *)&ri, sizeof(ri) )) )
 {// to pass the Alpha info from the DT object to the memory (RenderInfo) of the bitmap
  IIntuition->IDoMethod(picObject, PDTM_READPIXELARRAY,ri.Memory,
                                   PBPAFMT_ARGB,ri.BytesPerRow, 0, 0, IMG_W, IMG_H);

 IP96->p96UnlockBitMap(tempBM, lock);
 }

 IGraphics->CompositeTags(COMPOSITE_Src_Over_Dest, tempBM, dd->rp->BitMap,
                          COMPTAG_SrcWidth,<WIDTH>, COMPTAG_SrcHeight,<HEIGHT>,
                          COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(dd->scaleflag),
                          COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(dd->scaleflag),
                          COMPTAG_Flags,COMPFLAG_SrcFilter,
                         TAG_DONE);

 IP96->p96FreeBitMap(tempBM);
 //tempBM = NULL;
}
..
code extracted from KeymapSwitcher.docky sources. Can't remembre how it "behaves" on 16bit screen.
softwarefailure
Posts: 112
Joined: Fri Feb 14, 2014 10:29 pm

Re: Docky transparency on 16bit screens

Post by softwarefailure »

And using ' IGraphics->CompositeTags()'?
No, as I wrote in my first post I'm using BltBitMapTags() but....
IGraphics->CompositeTags(COMPOSITE_Src_Over_Dest, tempBM, dd->rp->BitMap,
COMPTAG_SrcWidth,<WIDTH>, COMPTAG_SrcHeight,<HEIGHT>,
COMPTAG_ScaleX,COMP_FLOAT_TO_FIX(dd->scaleflag),
COMPTAG_ScaleY,COMP_FLOAT_TO_FIX(dd->scaleflag),
COMPTAG_Flags,COMPFLAG_SrcFilter,
TAG_DONE);
...I've tried it with CompositeTags() now and it doesn't work either. Everything is fine on 32bit screens, but on 16bit there is no alpha transparency but a black background.
User avatar
javierdlr
Beta Tester
Beta Tester
Posts: 389
Joined: Sun Jun 19, 2011 11:13 pm
Location: Donostia (GUIPUZCOA) - Spain
Contact:

Re: Docky transparency on 16bit screens

Post by javierdlr »

softwarefailure wrote:
And using ' IGraphics->CompositeTags()'?
..
No, as I wrote in my first post I'm using BltBitMapTags() but....
..
...I've tried it with CompositeTags() now and it doesn't work either. Everything is fine on 32bit screens, but on 16bit there is no alpha transparency but a black background.
..OK, but just before using 'CompositeTags()' I do:

Code: Select all

..
{// to pass the Alpha info from the DT object to the memory (RenderInfo) of the bitmap
  IIntuition->IDoMethod(picObject, PDTM_READPIXELARRAY,ri.Memory,
                                   PBPAFMT_ARGB,ri.BytesPerRow, 0, 0, <WIDTH>, <HEIGHT>);
..
BTW this part of code is from Guillaume Boesel (zzd10h), he helped me to load image flags in KeymapSwitcher.docky
softwarefailure
Posts: 112
Joined: Fri Feb 14, 2014 10:29 pm

Re: Docky transparency on 16bit screens

Post by softwarefailure »

OK, but just before using 'CompositeTags()' I do:
Unfortunately, this didn't work either on 16bit screens.
xenic
Posts: 1185
Joined: Sun Jun 19, 2011 1:06 am

Re: Docky transparency on 16bit screens

Post by xenic »

@softwarefailure
Sketchblock seems to display alpha channel correctly on my 16 bit WorkBench screen. I think the soucecode is still included in the archive and should still be available at OS4Depot.
AmigaOne X1000 with 2GB memory - OS4.1 FE
centaurz
Posts: 13
Joined: Sat Jun 18, 2011 2:24 pm

Re: Docky transparency on 16bit screens

Post by centaurz »

Hi,

For 16-bit screen, you have to use the separate 8-bit alpha bitmap targeted by alpha.RP field in DockyRenderDestination structure.

Here's an extract of a conversation I had with Massimo Tantignone on this subject years ago (I hope he doesn't mind me quoting it here) :
When compositing is enabled, a docky receives a DOCKYGET_SupportsComposite
query. If it returns TRUE, it will then receive a DOCKYGET_CompositeMode
query to which it can reply either DOCKYCOMPMODE_PreblendedRGB (0) or
DOCKYCOMPMODE_RawRGB (1). The former has no advantages over the previous
method, but was included for backward compatibility. The latter, however,
allows you to directly *copy* the source ARGB data to the destination
bitmap (or buffer) rather than blend it yourself. This way, it will be
AmiDock itself that does the blending (once) without the need to undo the
previous blending to get the raw RGB data.

One thing to take into account when using this method, though, is that
on a 16-bit screen you will get an actual 16-bit destination bitmap, not
32-bit as it happens when returning FALSE to DOCKYGET_SupportsComposite.
In this case, you will need to write the alpha channel separately to the
(8-bit) bitmap provided in the DockyRenderDestination's alpha.RP field.
This basically describes all the rendering contexts you can have (32-bit/16-bit screens, composited/non composited on 32-bit screens).
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: Docky transparency on 16bit screens

Post by ssolie »

centaurz wrote:This basically describes all the rendering contexts you can have (32-bit/16-bit screens, composited/non composited on 32-bit screens).
Nice info!

I've added it to the wiki at http://wiki.amigaos.net/index.php/AmiDock_and_Dockies
ExecSG Team Lead
centaurz
Posts: 13
Joined: Sat Jun 18, 2011 2:24 pm

Re: Docky transparency on 16bit screens

Post by centaurz »

@ssolie

OK. When I have time I'll try to contribute myself to this article. There is still a lot to say about setting/getting attributes, not to mention DockyProcess() stuff which is quite dodgy to use.
Post Reply