home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD2.bin / bbs / dev / cmanual-3.0.lha / CManual / Amiga / Appendices / FunctionsAndLibraries / GraphicsLibrary.doc < prev    next >
Text File  |  1993-10-12  |  38KB  |  1,370 lines

  1. 2    GRAPHICS LIBRARY
  2.  
  3. 2.1  OPEN THE GRAPHICS LIBRARY
  4.  
  5. The Graphics Library must have been opened before you may use
  6. the functions listed in this file.
  7.  
  8.  
  9.   /* Declare a pointer to the Graphics Library: */
  10.   struct GfxBase *GfxBase;
  11.  
  12.   /* Open the Graphics Library: */
  13.   GfxBase = (struct GfxBase *)
  14.     OpenLibrary( "graphics.library", 0 );
  15.   
  16.   if( !GfxBase )
  17.     exit(); /* Could NOT open the Graphics Library! */
  18.  
  19.  
  20.   /* ... */
  21.  
  22.  
  23.   /* Close the Graphics Library: */
  24.   CloseLibrary( GfxBase );
  25.  
  26.  
  27.  
  28. 2.2  FUNCTIONS
  29.  
  30. AddBob()
  31.  
  32.   This function will add a BOB to the current list of graphical
  33.   objects. Remember to remove all BOBs from the list before
  34.   your program terminates. Either use the RemBob() or RemIBob()
  35.   functions to remove a BOB.
  36.  
  37.   Synopsis:  AddBob( bob, rast_port );
  38.  
  39.   bob:       (struct Bob *) Pointer to an already initialized
  40.              Bob structure. The Bob structure must also have
  41.              been connected to an initialized VSprite
  42.              structure.
  43.  
  44.   rast_port: (struct RastPort *) Pointer to the display's
  45.              RastPort. The display must have been opened before
  46.              you may add BOBs to it. NOTE! Before you may call
  47.              this function you must have declared and
  48.              initialized a GelsInfo structure, and linked it
  49.              to this RastPort.
  50.  
  51.  
  52.  
  53. AddVSprite()
  54.  
  55.   This function will add a VSprite to the VSprite list.
  56.  
  57.   Synopsis: AddVSprite( vsprite, rp );
  58.  
  59.   vsprite:  (struct VSprite *) Pointer to an initialized
  60.             VSprite structure.
  61.  
  62.   rp:       (struct RastPort *) Pointer to the RastPort.
  63.  
  64.  
  65.  
  66. AllocRaster()
  67.  
  68.   This function reserves display memory (one BitPlane).
  69.  
  70.   Synopsis: pointer = AllocRaster( width, height );
  71.  
  72.   pointer   (PLANEPTR) Pointer to the allocated memory or NULL
  73.             if enough memory could not be reserved.
  74.  
  75.   width:    (long) The width of the BitMap.
  76.  
  77.   height:   (long) The height of the BitMap.
  78.  
  79.  
  80.  
  81. AreaDraw()
  82.  
  83.   This function will add a new vertex to the vector list. 
  84.  
  85.   Synopsis:  AreaDraw( rast_port, x, y );
  86.  
  87.   rast_port: (struct RastPort *) Pointer to the RastPort that
  88.              should be affected.
  89.  
  90.   x:         (long) New X position.
  91.  
  92.   y:         (long) New Y position.
  93.  
  94.  
  95.  
  96. AreaEllipse()
  97.  
  98.   This function will draw a filled ellipse. Remember to
  99.   allocate a temporary buffer of at least the same size as the
  100.   largest object that will be drawn.
  101.  
  102.   Synopsis:  AreaEllipse( rast_port, x, y, width, height );
  103.  
  104.   rast_port: (struct RastPort *) Pointer to the RastPort in
  105.              which the filled ellipse should be drawn.
  106.  
  107.   x:         (long) X position of the filled ellipse.
  108.  
  109.   y:         (long) Y position of the filled ellipse.
  110.  
  111.   width:     (long) The width of the left or right part of
  112.              the ellipse.
  113.  
  114.   height:    (long) The height of the top or bottom part of
  115.              the ellipse.
  116.  
  117.  
  118.  
  119. AreaEnd()
  120.  
  121.   This function will close, draw and fill the polygon.
  122.  
  123.   Synopsis:  AreaEnd( rast_port );
  124.  
  125.   rast_port: (struct RastPort *) Pointer to the RastPort that
  126.              should be affected.
  127.  
  128.  
  129.  
  130. AreaMove()
  131.  
  132.   This function will start a new polygon.
  133.  
  134.   Synopsis:  AreaMove( rast_port, x, y );
  135.  
  136.   rast_port: (struct RastPort *) Pointer to the RastPort that
  137.              should be affected.
  138.  
  139.   x:         (long) Start X position.
  140.  
  141.   y:         (long) Start Y position.
  142.  
  143.  
  144.  
  145. AskSoftStyle()
  146.  
  147.   This function tells us how a specified font may be changed,
  148.   and which styles may be automatically created. Use the
  149.   function SetSoftStyle() to later change style. The reason why
  150.   you have to check if you are allowed to alter the style is
  151.   that some fonts may look very bad when altered.
  152.   
  153.   Note that you should always first try to load the font with
  154.   the desired style. It is only when the desired style does not
  155.   exist you should try to modify it with the SetSoftStyle()
  156.   function.
  157.  
  158.   Synopsis:  a_style = AskSoftStyle( rast_port )
  159.  
  160.   a_style:   (UWORD) The function returns a bit field where the
  161.              allowed style bits for the checked font are set. This
  162.              value should be used as a parameter when you later
  163.              call the SetSoftStyle() function.
  164.  
  165.   rast_port: (struct RastPort *) Pointer to the rastport to
  166.              which the font you want to check is connected.
  167.  
  168.  
  169.  
  170. AvailFonts()
  171.  
  172.   This function will scan through the font directory of the
  173.   system disk, and return a complete list of available fonts.
  174.  
  175.   Synopsis: missing = AvailFonts( buffer, size, type );
  176.  
  177.   missing:  (long) If the buffer was not big enough to store
  178.             the complete list of fonts in the extra number of
  179.             bytes needed is returned. If 0 is returned the
  180.             buffer was big enough for a complete list of fonts.
  181.  
  182.   buffer:   (char *) Pointer to some memory were the list of
  183.             fonts can be stored.
  184.           
  185.   size:     (long) The size of the buffer (in bytes).
  186.  
  187.   type:     (long) If you want to look for available fonts
  188.             which are already in the memory set the flag
  189.             "AFF_MEMORY". If you want to search the disk for
  190.             available fonts, set the flag "AFF_DISK". To
  191.             search both the memory and the disk set both flags
  192.             with the binary OR operator between:
  193.             "AFF_DISK | AFF_MEMORY".
  194.  
  195.  
  196.  
  197. BltBitMap()
  198.  
  199.   This function copies parts of BitMaps directly without
  200.   worrying about overlapping layers.
  201.  
  202.   Synopsis: BltBitMap( sb, sx, sy, db, dx, dy, w, h, fl, m, t );
  203.  
  204.   sb:       (struct BitMap *) Pointer to the "source" BitMap.
  205.  
  206.   sx:       (long) X offset, source.
  207.  
  208.   sy:       (long) Y offset, source.
  209.  
  210.   db:       (struct BitMap *) Pointer to the "destination"
  211.             BitMap.
  212.  
  213.   dx:       (long) X offset, destination.
  214.  
  215.   dy:       (long) Y offset, destination.
  216.  
  217.   w:        (long) The width of the memory area that should be
  218.             copied.
  219.  
  220.   h:        (long) The height of the memory area that should be
  221.             copied.
  222.  
  223.   fl:       (long) The four leftmost bits tells the blitter
  224.             what kind of logically operations should be done.
  225.  
  226.   m:        (long) You can here define a BitMap mask, and tell
  227.             the blitter which BitPlanes should be used, and
  228.             which should not. The first bit represents the
  229.             first BitPlane, the second bit the second BitPlane
  230.             and so on. If the bit is on (1) the corresponding
  231.             BitPlane will be used, else (0) the BitPlane will
  232.             not be used. To turn off BitPlane zero and two, set
  233.             the mask value to 0xFA (11111010). To use all
  234.             BitPlanes set the mask value to 0xFF (11111111).
  235.  
  236.   t:        (char *) If the copy overlaps and this pointer
  237.             points to some chip-memory, the memory will be used
  238.             to store the temporary area in. However, normally
  239.             you do not need to bother about this value.
  240.  
  241.  
  242.  
  243. BltClear()
  244.  
  245.   This function clears large rectangular memory areas. This
  246.   function work together with the blitter and is therefore very
  247.   fast.
  248.  
  249.   Synopsis: BltClear( pointer, bytes, flags );
  250.  
  251.   pointer   (char *) Pointer to the memory.
  252.  
  253.   bytes:    (long) The lower 16 bits tells the blitter how many
  254.             bytes per row, and the upper 16 bits how many rows.
  255.             This value is automatically calculated for you with
  256.             help of the macro RASSIZE(). Just give RASSIZE()
  257.             the correct width and height and it will return the
  258.             correct value. [RASSIZE() is defined in file
  259.             "gfx.h".]
  260.  
  261.   flags:    (long) Set bit 0 to force the function to wait
  262.             until the Blitter has finished with your request.
  263.  
  264.  
  265.  
  266. ChangeSprite()
  267.  
  268.   This function changes the sprite data (image) of a sprite.
  269.  
  270.   Synopsis:  ChangeSprite( view_port, my_sprite, new_data );
  271.  
  272.   view_port: (struct ViewPort *) Pointer to the ViewPort which
  273.              this sprite is connected to, or 0 if the sprite is
  274.              connected to the current View.
  275.  
  276.   my_sprite: (struct SimpleSprite *) Pointer to your
  277.              SimpleSprite structure.
  278.  
  279.   new_data:  (short *) Pointer to the new sprite data.
  280.   
  281.  
  282.  
  283. ClearEOL()
  284.  
  285.   This function will clear the area to the right of the current
  286.   position. The height of the area which is cleared is set to
  287.   fit the current font height.
  288.   
  289.   Synop