Drawing a datatype in Docky

3 posts / 0 new
Last post
jaokim
jaokim's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-06-02 15:27
Drawing a datatype in Docky

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?

  1. struct DockyRenderDestination
  2. {
  3. uint32 renderMode; // enum enDockyRenderMode
  4. struct DockySize renderSize;
  5.  
  6. UBYTE pad[4]; // for future extension
  7.  
  8. union
  9. {
  10. UBYTE *map; // currently unused
  11. struct RastPort *RP; // RP->BitMap is of type RGBFB_ALPHA8
  12. } alpha;
  13.  
  14. union
  15. {
  16. UBYTE *RGB;
  17. struct RastPort *RP;
  18. } render;
  19. };

Am I supposed to use the RGB pointer? and what do i do with it?

I'm currently doing this to draw the datatype:

  1. pictureObject = IDataTypes->NewDTObject("ram:mypic.png",
  2. PDTA_Screen, screen, /*<- screen from AmiDock dockyset_screen */
  3. NULL);
  4.  
  5. IDataTypes->ObtainDTDrawInfo(pictureObject, NULL);
  6. IDataTypes->DrawDTObject(rastPort, pictureObject,
  7. 0,0,
  8. size.width, size.height,0,0,NULL)
  9. 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.

thomas
thomas's picture
Offline
Last seen: 3 months 1 week ago
Joined: 2011-05-16 14:23
I have successfully drawn a

I have successfully drawn a datatype (a picture) in a Docky. It is however in 256 color mode.

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.

jaokim
jaokim's picture
Offline
Last seen: 1 month 1 week ago
Joined: 2011-06-02 15:27
As simple as that! It works,

As simple as that!
It works, thanks a bunch!

Log in or register to post comments