bestmodeid.pas 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. width:=640;
  41. height:=480;
  42. depth:=24;
  43. rda:=ReadArgs (template,Addr(vecarray),Nil);
  44. If rda<>Nil Then Begin
  45. If vecarray[0]<> 0 then width := long(@vecarray[0]);
  46. If vecarray[1]<> 0 then height := long(@vecarray[1]);
  47. If vecarray[2]<> 0 then depth := long(@vecarray[2]);
  48. FreeArgs(rda);
  49. End;
  50. DisplayID:=p96BestModeIDTags([P96BIDTAG_NominalWidth, width,
  51. P96BIDTAG_NominalHeight, height,
  52. P96BIDTAG_Depth, depth,
  53. P96BIDTAG_FormatsForbidden, (RGBFF_R5G5B5 or RGBFF_R5G5B5PC or RGBFF_B5G5R5PC),
  54. TAG_DONE]);;
  55. If DisplayID>0 Then Begin
  56. Writeln ('DisplayID: ', hexstr(DisplayID,8));
  57. If DisplayID<>INVALID_ID Then Begin
  58. Writeln ('Width: ', p96GetModeIDAttr(DisplayID, P96IDA_WIDTH));
  59. Writeln ('Height: ', p96GetModeIDAttr(DisplayID, P96IDA_HEIGHT));
  60. Writeln ('Depth: ', p96GetModeIDAttr(DisplayID, P96IDA_DEPTH));
  61. Writeln ('BytesPerPixel: ', p96GetModeIDAttr(DisplayID, P96IDA_BYTESPERPIXEL));
  62. Writeln ('BitsPerPixel: ', p96GetModeIDAttr(DisplayID, P96IDA_BITSPERPIXEL));
  63. Writeln ('RGBFormat: ', fmtstrings[p96GetModeIDAttr(DisplayID,P96IDA_RGBFORMAT)+1]);
  64. If p96GetModeIDAttr(DisplayID, P96IDA_ISP96)<>0 Then
  65. Writeln ('Is P96: yes')
  66. Else
  67. Writeln ('Is P96: no');
  68. End;
  69. End Else
  70. Writeln ('DisplayID is 0.');
  71. End.