home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #1 / Amiga Plus CD - 2000 - No. 1.iso / Tools / GraKa / Picasso96Develop / Examples / BestModeID.c next >
Encoding:
C/C++ Source or Header  |  1999-12-03  |  2.0 KB  |  72 lines

  1. /***********************************************************************
  2. * This is example shows how to use p96BestModeIDTagList()
  3. *
  4. * tabt (Mon Aug 28 14:07:40 1995)
  5. ***********************************************************************/
  6.  
  7. #include <proto/exec.h>
  8. #include <proto/dos.h>
  9. #include    <proto/graphics.h>
  10. #include <proto/picasso96.h>
  11.  
  12. #include <stdio.h>
  13.  
  14. char template[]="Width=W/N,Height=H/N,Depth=D/N";
  15.  
  16. char    *fmtstrings[RGBFB_MaxFormats] = {
  17.     "RGBFB_NONE",
  18.     "RGBFB_CLUT",
  19.     "RGBFB_R8G8B8",
  20.     "RGBFB_B8G8R8",
  21.     "RGBFB_R5G6B5PC",
  22.     "RGBFB_R5G5B5PC",
  23.     "RGBFB_A8R8G8B8",
  24.     "RGBFB_A8B8G8R8",
  25.     "RGBFB_R8G8B8A8",
  26.     "RGBFB_B8G8R8A8",
  27.     "RGBFB_R5G6B5",
  28.     "RGBFB_R5G5B5",
  29.     "RGBFB_B5G6R5PC",
  30.     "RGBFB_B5G5R5PC"
  31. };
  32.  
  33. LONG array[]={    0, 0, 0, FALSE    };
  34.  
  35. struct Library *P96Base;
  36.  
  37. void main(int argc,char **argv)
  38. {
  39.     if(P96Base=OpenLibrary("Picasso96API.library",2)){
  40.         struct RDArgs *rda;
  41.  
  42.         ULONG    DisplayID;
  43.         LONG width=640, height=480, depth=24;
  44.         
  45.         if(rda=ReadArgs(template,array,NULL)){
  46.             if(array[0])    width =*((LONG *)array[0]);
  47.             if(array[1])    height=*((LONG *)array[1]);
  48.             if(array[2])    depth =*((LONG *)array[2]);
  49.             FreeArgs(rda);
  50.         }
  51.     
  52.         if(DisplayID=p96BestModeIDTags(
  53.                                         P96BIDTAG_NominalWidth, width,
  54.                                         P96BIDTAG_NominalHeight, height,
  55.                                         P96BIDTAG_Depth, depth,
  56.                                         P96BIDTAG_FormatsForbidden, (RGBFF_R5G5B5|RGBFF_R5G5B5PC|RGBFF_B5G5R5PC),
  57.                                         TAG_DONE)){
  58.             printf("DisplayID: %lx\n", DisplayID);
  59.             if(DisplayID != INVALID_ID){
  60.                 printf("Width: %ld\n", p96GetModeIDAttr(DisplayID, P96IDA_WIDTH));
  61.                 printf("Height: %ld\n", p96GetModeIDAttr(DisplayID, P96IDA_HEIGHT));
  62.                 printf("Depth: %ld\n", p96GetModeIDAttr(DisplayID, P96IDA_DEPTH));
  63.                 printf("BytesPerPixel: %ld\n", p96GetModeIDAttr(DisplayID, P96IDA_BYTESPERPIXEL));
  64.                 printf("BitsPerPixel: %ld\n", p96GetModeIDAttr(DisplayID, P96IDA_BITSPERPIXEL));
  65.                 printf("RGBFormat: %s\n", fmtstrings[p96GetModeIDAttr(DisplayID,P96IDA_RGBFORMAT)]);
  66.                 printf("Is P96: %s\n", p96GetModeIDAttr(DisplayID, P96IDA_ISP96) ? "yes" : "no");
  67.             }
  68.         }
  69.         CloseLibrary(P96Base);
  70.     }
  71. }
  72.