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 >
Wrap
Text File
|
1993-10-12
|
38KB
|
1,370 lines
2 GRAPHICS LIBRARY
2.1 OPEN THE GRAPHICS LIBRARY
The Graphics Library must have been opened before you may use
the functions listed in this file.
/* Declare a pointer to the Graphics Library: */
struct GfxBase *GfxBase;
/* Open the Graphics Library: */
GfxBase = (struct GfxBase *)
OpenLibrary( "graphics.library", 0 );
if( !GfxBase )
exit(); /* Could NOT open the Graphics Library! */
/* ... */
/* Close the Graphics Library: */
CloseLibrary( GfxBase );
2.2 FUNCTIONS
AddBob()
This function will add a BOB to the current list of graphical
objects. Remember to remove all BOBs from the list before
your program terminates. Either use the RemBob() or RemIBob()
functions to remove a BOB.
Synopsis: AddBob( bob, rast_port );
bob: (struct Bob *) Pointer to an already initialized
Bob structure. The Bob structure must also have
been connected to an initialized VSprite
structure.
rast_port: (struct RastPort *) Pointer to the display's
RastPort. The display must have been opened before
you may add BOBs to it. NOTE! Before you may call
this function you must have declared and
initialized a GelsInfo structure, and linked it
to this RastPort.
AddVSprite()
This function will add a VSprite to the VSprite list.
Synopsis: AddVSprite( vsprite, rp );
vsprite: (struct VSprite *) Pointer to an initialized
VSprite structure.
rp: (struct RastPort *) Pointer to the RastPort.
AllocRaster()
This function reserves display memory (one BitPlane).
Synopsis: pointer = AllocRaster( width, height );
pointer (PLANEPTR) Pointer to the allocated memory or NULL
if enough memory could not be reserved.
width: (long) The width of the BitMap.
height: (long) The height of the BitMap.
AreaDraw()
This function will add a new vertex to the vector list.
Synopsis: AreaDraw( rast_port, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
x: (long) New X position.
y: (long) New Y position.
AreaEllipse()
This function will draw a filled ellipse. Remember to
allocate a temporary buffer of at least the same size as the
largest object that will be drawn.
Synopsis: AreaEllipse( rast_port, x, y, width, height );
rast_port: (struct RastPort *) Pointer to the RastPort in
which the filled ellipse should be drawn.
x: (long) X position of the filled ellipse.
y: (long) Y position of the filled ellipse.
width: (long) The width of the left or right part of
the ellipse.
height: (long) The height of the top or bottom part of
the ellipse.
AreaEnd()
This function will close, draw and fill the polygon.
Synopsis: AreaEnd( rast_port );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
AreaMove()
This function will start a new polygon.
Synopsis: AreaMove( rast_port, x, y );
rast_port: (struct RastPort *) Pointer to the RastPort that
should be affected.
x: (long) Start X position.
y: (long) Start Y position.
AskSoftStyle()
This function tells us how a specified font may be changed,
and which styles may be automatically created. Use the
function SetSoftStyle() to later change style. The reason why
you have to check if you are allowed to alter the style is
that some fonts may look very bad when altered.
Note that you should always first try to load the font with
the desired style. It is only when the desired style does not
exist you should try to modify it with the SetSoftStyle()
function.
Synopsis: a_style = AskSoftStyle( rast_port )
a_style: (UWORD) The function returns a bit field where the
allowed style bits for the checked font are set. This
value should be used as a parameter when you later
call the SetSoftStyle() function.
rast_port: (struct RastPort *) Pointer to the rastport to
which the font you want to check is connected.
AvailFonts()
This function will scan through the font directory of the
system disk, and return a complete list of available fonts.
Synopsis: missing = AvailFonts( buffer, size, type );
missing: (long) If the buffer was not big enough to store
the complete list of fonts in the extra number of
bytes needed is returned. If 0 is returned the
buffer was big enough for a complete list of fonts.
buffer: (char *) Pointer to some memory were the list of
fonts can be stored.
size: (long) The size of the buffer (in bytes).
type: (long) If you want to look for available fonts
which are already in the memory set the flag
"AFF_MEMORY". If you want to search the disk for
available fonts, set the flag "AFF_DISK". To
search both the memory and the disk set both flags
with the binary OR operator between:
"AFF_DISK | AFF_MEMORY".
BltBitMap()
This function copies parts of BitMaps directly without
worrying about overlapping layers.
Synopsis: BltBitMap( sb, sx, sy, db, dx, dy, w, h, fl, m, t );
sb: (struct BitMap *) Pointer to the "source" BitMap.
sx: (long) X offset, source.
sy: (long) Y offset, source.
db: (struct BitMap *) Pointer to the "destination"
BitMap.
dx: (long) X offset, destination.
dy: (long) Y offset, destination.
w: (long) The width of the memory area that should be
copied.
h: (long) The height of the memory area that should be
copied.
fl: (long) The four leftmost bits tells the blitter
what kind of logically operations should be done.
m: (long) You can here define a BitMap mask, and tell
the blitter which BitPlanes should be used, and
which should not. The first bit represents the
first BitPlane, the second bit the second BitPlane
and so on. If the bit is on (1) the corresponding
BitPlane will be used, else (0) the BitPlane will
not be used. To turn off BitPlane zero and two, set
the mask value to 0xFA (11111010). To use all
BitPlanes set the mask value to 0xFF (11111111).
t: (char *) If the copy overlaps and this pointer
points to some chip-memory, the memory will be used
to store the temporary area in. However, normally
you do not need to bother about this value.
BltClear()
This function clears large rectangular memory areas. This
function work together with the blitter and is therefore very
fast.
Synopsis: BltClear( pointer, bytes, flags );
pointer (char *) Pointer to the memory.
bytes: (long) The lower 16 bits tells the blitter how many
bytes per row, and the upper 16 bits how many rows.
This value is automatically calculated for you with
help of the macro RASSIZE(). Just give RASSIZE()
the correct width and height and it will return the
correct value. [RASSIZE() is defined in file
"gfx.h".]
flags: (long) Set bit 0 to force the function to wait
until the Blitter has finished with your request.
ChangeSprite()
This function changes the sprite data (image) of a sprite.
Synopsis: ChangeSprite( view_port, my_sprite, new_data );
view_port: (struct ViewPort *) Pointer to the ViewPort which
this sprite is connected to, or 0 if the sprite is
connected to the current View.
my_sprite: (struct SimpleSprite *) Pointer to your
SimpleSprite structure.
new_data: (short *) Pointer to the new sprite data.
ClearEOL()
This function will clear the area to the right of the current
position. The height of the area which is cleared is set to
fit the current font height.
Synop