Datatypes appeared in 3.0.
Here is an example which tells datatypes to dither the loaded image into the screen's pixel format and/or palette:
/* compile with vc +aos68k dtview.c -o dtview -lauto -lamiga */
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/datatypes.h>
#include <datatypes/pictureclass.h>
#include <clib/alib_protos.h>
int main (void)
{
int rc = RETURN_FAIL;
static struct {
char *file;
char *pubscreen;
} args = {NULL};
struct RDArgs *rdargs = ReadArgs ("FILE/A,PUBSCREEN/K", (APTR)&args, NULL);
if (rdargs)
{
struct Screen *scr = LockPubScreen (args.pubscreen);
if (scr)
{
Object *dto = NewDTObject (args.file,
DTA_GroupID, GID_PICTURE,
PDTA_Remap, TRUE,
PDTA_Screen, scr,
PDTA_DestMode, PMODE_V43,
TAG_END);
if (dto)
{
struct BitMapHeader *bmhd = NULL;
struct BitMap *bm = NULL;
DoMethod (dto, DTM_PROCLAYOUT, NULL, TRUE);
GetDTAttrs (dto,
PDTA_BitMapHeader, &bmhd,
PDTA_DestBitMap, &bm,
TAG_END);
if (bmhd && bm)
{
struct Window *win = OpenWindowTags (NULL,
WA_Title, FilePart(args.file),
WA_InnerWidth, bmhd->bmh_Width,
WA_InnerHeight, bmhd->bmh_Height,
WA_Flags, WFLG_CLOSEGADGET | WFLG_DRAGBAR | WFLG_DEPTHGADGET | WFLG_ACTIVATE | WFLG_NOCAREREFRESH,
WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_VANILLAKEY,
TAG_END);
if (win)
{
BOOL cont = TRUE;
BltBitMapRastPort (bm, 0, 0, win->RPort,
win->BorderLeft, win->BorderTop,
win->GZZWidth, win->GZZHeight,
ABC | ABNC);
do {
struct IntuiMessage *imsg;
if (Wait ((1L << win->UserPort->mp_SigBit) | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C)
cont = FALSE;
while ((imsg = (struct IntuiMessage *) GetMsg (win->UserPort)))
{
switch (imsg->Class)
{
case IDCMP_VANILLAKEY:
if (imsg->Code == 0x1b) /* Esc */
cont = FALSE;
break;
case IDCMP_CLOSEWINDOW:
cont = FALSE;
break;
}
ReplyMsg ((struct Message *) imsg);
}
}
while (cont);
CloseWindow (win);
rc = RETURN_OK;
}
}
DisposeDTObject (dto);
}
UnlockPubScreen (NULL, scr);
}
FreeArgs (rdargs);
}
if (rc != RETURN_OK)
PrintFault (IoErr(), NULL);
return (rc);
}