~ubuntu-branches/ubuntu/lucid/fpc/lucid-proposed

« back to all changes in this revision

Viewing changes to fpcsrc/packages/amunits/examples/otherlibs/bestmodeid.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-10-09 23:29:00 UTC
  • mfrom: (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081009232900-553f61m37jkp6upv
Tags: 2.2.2-4
[ Torsten Werner ]
* Update ABI version in fpc-depends automatically.
* Remove empty directories from binary package fpc-source.

[ Mazen Neifer ]
* Removed leading path when calling update-alternatives to remove a Linitian
  error.
* Fixed clean target.
* Improved description of packages. (Closes: #498882)

Show diffs side-by-side

added added

removed removed

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