bestmodeid.pas 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. PROGRAM BestModeID;
  2. {***********************************************************************
  3. * This is example shows how to use p96BestModeIDTagList()
  4. *
  5. * tabt (Mon Aug 28 14:07:40 1995)
  6. ***********************************************************************}
  7. {
  8. Translated to fpc pascal.
  9. 1 Mars 2001.
  10. Updated for fpc 1.0.7
  11. 08 Jan 2003.
  12. [email protected]
  13. }
  14. uses exec, amigados, agraphics, picasso96api, utility;
  15. Const
  16. template : pchar = 'Width=W/N,Height=H/N,Depth=D/N';
  17. vecarray : Array[0..2] of long = (0,0,0);
  18. fmtstrings : Array [1..(Ord(RGBFB_MaxFormats)-2)] OF pchar = (
  19. 'RGBFB_NONE',
  20. 'RGBFB_CLUT',
  21. 'RGBFB_R8G8B8',
  22. 'RGBFB_B8G8R8',
  23. 'RGBFB_R5G6B5PC',
  24. 'RGBFB_R5G5B5PC',
  25. 'RGBFB_A8R8G8B8',
  26. 'RGBFB_A8B8G8R8',
  27. 'RGBFB_R8G8B8A8',
  28. 'RGBFB_B8G8R8A8',
  29. 'RGBFB_R5G6B5',
  30. 'RGBFB_R5G5B5',
  31. 'RGBFB_B5G6R5PC',
  32. 'RGBFB_B5G5R5PC');
  33. Var
  34. DisplayID,
  35. width,
  36. height,
  37. depth : longint;
  38. rda : pRDArgs;
  39. Begin
  40. if not Assigned(P96Base) then
  41. begin
  42. writeln('Cannot open ', PICASSO96APINAME);
  43. Halt(5);
  44. end;
  45. width:=640;
  46. height:=480;
  47. depth:=24;
  48. rda:=ReadArgs (template,Addr(vecarray),Nil);
  49. If rda<>Nil Then Begin
  50. If vecarray[0]<> 0 then width := long(@vecarray[0]);
  51. If vecarray[1]<> 0 then height := long(@vecarray[1]);
  52. If vecarray[2]<> 0 then depth := long(@vecarray[2]);
  53. FreeArgs(rda);
  54. End;
  55. DisplayID:=p96BestModeIDTags([P96BIDTAG_NominalWidth, width,
  56. P96BIDTAG_NominalHeight, height,
  57. P96BIDTAG_Depth, depth,
  58. P96BIDTAG_FormatsForbidden, (RGBFF_R5G5B5 or RGBFF_R5G5B5PC or RGBFF_B5G5R5PC),
  59. TAG_DONE]);;
  60. If DisplayID>0 Then Begin
  61. Writeln ('DisplayID: ', hexstr(DisplayID,8));
  62. If DisplayID<>INVALID_ID Then Begin
  63. Writeln ('Width: ', p96GetModeIDAttr(DisplayID, P96IDA_WIDTH));
  64. Writeln ('Height: ', p96GetModeIDAttr(DisplayID, P96IDA_HEIGHT));
  65. Writeln ('Depth: ', p96GetModeIDAttr(DisplayID, P96IDA_DEPTH));
  66. Writeln ('BytesPerPixel: ', p96GetModeIDAttr(DisplayID, P96IDA_BYTESPERPIXEL));
  67. Writeln ('BitsPerPixel: ', p96GetModeIDAttr(DisplayID, P96IDA_BITSPERPIXEL));
  68. Writeln ('RGBFormat: ', fmtstrings[p96GetModeIDAttr(DisplayID,P96IDA_RGBFORMAT)+1]);
  69. If p96GetModeIDAttr(DisplayID, P96IDA_ISP96)<>0 Then
  70. Writeln ('Is P96: yes')
  71. Else
  72. Writeln ('Is P96: no');
  73. End;
  74. End Else
  75. Writeln ('DisplayID is 0.');
  76. End.