I have successfully drawn a datatype (a picture) in a Docky. It is however in 256 color mode. I am sending enDockyRenderMode.DOCKYRENDERMODE_RP as answer to DOCKYGET_RenderMode.
I assume I'm supposed to answer with DOCKYRENDERMODE_RGB or any of the other instead. But this is where I'm at loss.
1. How do I know which DOCKYRENDERMODE to send? I've found some way to get my current screenmode, but how do I map it to the corrent DOCKYRENDERMODE? I'm naïvely looking for some define or enum having RGB ARGB or RGBA in its name, but I can't find any, nor any appropriate fields (like in DrawInfo). I also looked at the bitdepth, and if it was more than 8 I simply send an _RGB mode. But then I face my 2nd problem:
2. How do I use what I receive from AmiDock via DOCKYSET_RenderDestination?
struct DockyRenderDestination { uint32 renderMode; // enum enDockyRenderMode struct DockySize renderSize; UBYTE pad[4]; // for future extension union { UBYTE *map; // currently unused struct RastPort *RP; // RP->BitMap is of type RGBFB_ALPHA8 } alpha; union { UBYTE *RGB; struct RastPort *RP; } render; };
Am I supposed to use the RGB pointer? and what do i do with it?
I'm currently doing this to draw the datatype:
pictureObject = IDataTypes->NewDTObject("ram:mypic.png", PDTA_Screen, screen, /*<- screen from AmiDock dockyset_screen */ NULL); IDataTypes->ObtainDTDrawInfo(pictureObject, NULL); IDataTypes->DrawDTObject(rastPort, pictureObject, 0,0, size.width, size.height,0,0,NULL) IDataTypes->ReleaseDTDrawInfo(pictureObject, handle);
And it doesn't work when I just changed the render mode I returned. So I guess I am doing something wrong.
Do I understand it right, that the picture file has more than 256 colors but it is rendered in 256 colors?
If so, then IMHO you don't need to change anything. Just add PDTA_DestMode,PMODE_V43 to the NewDTObject call.
You might also want to add DTA_GroupID,GID_PICTURE in order to restrict the file type to pictures.
As simple as that!
It works, thanks a bunch!