See the reference manual or help file for complete descriptions.
3D Functions
Functions with * are new in Fastgraph 6.01.
int fg_3Daxisangle (double x, double y, double z, int angle);
* Rotates the viewer's orientation by the specified angle around an arbitrary.
int fg_3Daxisangleobject (double x, double y, double z, int angle);
* Rotates an object by the specified angle around an arbitrary axis.
int fg_3Dbehindviewer (double x, double y, double z, double tolerance);
* Determines if the point is visible from the viewer's current position and orientation.
void fg_3Dgetmatrix (double *matrix, int flag);
* Retrieves one of Fastgraph's internal matrices (see fg_3Dsetmatrix()).
void fg_3Dgetpov (double *x, double *y, double *z, double *x_out, double *y_out, double *z_out);
* Returns the viewer's position and unit vector in direction of view.
void fg_3Dline (double x1, double y1, double z1, double x2, double y2, double z2);
Draws a line defined in 3D space.
int fg_3Dlookat (double x1, double y1, double z1, double x2, double y2, double z2);
* Defines the viewer's position and orientation.
void fg_3Dmove (double x, double y, double z);
* Specify viewer position without changing the rotation.
void fg_3Dmoveforward (double amount);
* Move viewer's position forward or backward.
void fg_3Dmoveforwardobject (double amount);
* Move an object forward or backward.
void fg_3Dmoveobject (double x, double y, double z);
* Specify object position without changing its orientation.
void fg_3Dmoveright (double amount);
* Move viewer's position to the right or left.
void fg_3Dmoverightobject (double amount);
* Move an object to the right or the left.
void fg_3Dmoveup (double amount);
* Move viewer's position up or down.
void fg_3Dmoveupobject (double amount);
* Move an object up or down
void fg_3Dpolygon(double *vertices, int n);
Draws a polygon with n vertices, defined in world space.
void fg_3Dpov (double x, double y, double z, int x_angle, int y_angle,int z_angle);
Establish the point of view (position and direction)
void fg_3Drenderstate (int flags);
Rendering flags:FG_LINEAR_TM,FG_PERSPECTIVE_TM, FG_WIREFRAME, FG_ZBUFFER, FG_ZCLIP
(Flags override default: solid polygons with backface removal, no z clipping)
void fg_3Droll (int angle);
* Rotate around the forward (Z) axis.
void fg_3Drollobject (int angle);
* Rotate an object around it's Z axis.
int fg_3Drotate (double x_out, double y_out, double z_out);
* Specify an absolute rotation without changing the viewer's position.
int fg_3Drotateobject (double x_out, double y_out, double z_out);
* Rotate an object without changing its position.
void fg_3Drotateright (int angle);
* Rotate the view to the right or left.
void fg_3Drotaterightobject (int angle);
* Rotate an object to the right or the left.
void fg_3Drotateup (int angle);
* Rotate the view up or down.
void fg_3Drotateupobject (int angle);
* Rotate an object up or down.
void fg_3Dsetmatrix (double *matrix, int flag, int update);
* Manipulate an internal 3D matrix directly. (See fg_3Dgetmatrix())
void fg_3Dsetobject (double x, double y, double z, int x_angle,int y_angle, int z_angle);
Move and translate an object defined in object space.
void fg_3Dsetzclip (double z_near, double z_far);
Set z clipping limits.
void fg_3Dshade(double *xyz_array, char *rgb_array, int n);
Draw a gouraud shaded polygon in world space.
void fg_3Dshadeobject(double *xyz_array, char *rgb_array, int n);
Draw a gouraud shaded polygon in object space.
void fg_3Dtexturemap(double *xyz_array, int *uv_array, int n);
Draw a world space textured polygon with n vertices.
void fg_3Dtexturemapobject(double *xyz_array, int *uv_array, int n);
Draw an object space textured polygon with n vertices.
void fg_3Dviewport (int minx, int maxx, int miny, int maxy, double ratio);
Establish viewport extents and rendering ratio.
int fg_tmdefine (void *texture, int width, int height);
Assign a handle to a texture map.
void fg_tmevict (void);
* Flush textures from video memory to system memory (DirectX 6 or above)
void fg_tmfree (int handle);
Pass -1 to free all texture handles.
int fg_tminit (int maxTextures);
Initialize texture handling.
void fg_tmselect (int handle);
Specify active texture.
void fg_tmspan (int npixels);
Perspective texture calculation interval. Default is 32 pixels.
void fg_tmtransparency (int state);
0=no transparent pixels(default) 1=transparent pixels (color 0 is transparent).
int fg_zballoc (int width, int height);
Allocate z buffer and return handle. Size should match viewport.
void fg_zbframe (void);
Update z buffer. Call once each frame.
void fg_zbfree (int handle);
Free the z buffer.
void fg_zbopen (int);
Open the z buffer.
Bitmap functions, 256-color
Note: Bitmaps can be clipped, unclipped, flipped, normal, transparent
or non-transparent. Different versions of the functions are supplied for speed
reasons. This could all be done in one function with flags passed to it,
but it would be a tiny bit slower. Some of these functions have
been in Fastgraph since 1988. Back in those days, we had to squeeze
every possible cycle out of an 8088. It was optimize or die. The
functions have been updated to use the Pentium dual pipeline. They are
lightning fast.
void fg_clpimage (void *bitmap, int width, int height);
Draw a clipped, transparent bitmap.
void fg_cut (void *bitmap, void *section, int xpos, int ypos, int width, int sec_width, int sec_height);
Extract a bitmap section from a larger bitmap.
void fg_drwimage (void *bitmap, int width, int height);
Draw an unclipped, transparent bitmap.
void fg_flpimage (void *bitmap, int width, int height);
Draw an clipped, transparent bitmap flipped around vertical axis.
void fg_getimage (void *bitmap, int width, int height);
Retrieve a 256 color bitmap from a virtual buffer.
void fg_invert (void *bitmap, int width, int height);
Change orientation of bitmap (top-down to bottom-up or vice versa).
void fg_paste (void *bitmap, void *section, int xpos, int ypos, int width,
int sec_width, int sec_height);
Insert a bitmap into another bitmap.
void fg_putimage (void *bitmap, int width, int height);
Draw a non-transparent, unclipped bitmap.
void fg_revimage (void *bitmap, int width, int height);
Draw a transparent, unclipped bitmap flipped around vertical axis.
void fg_rotate (void *source, void *dest, int width, int height, int angle);
Rotate a bitmap.
void fg_scale (void *source, void *dest, int sw, int sh, int dw, int dh);
Scale a bitmap.
void fg_shear (void *source, void *dest, int width, int height, int new_size, int type);
Shear (stretch) a bitmap.
Bitmap functions, direct color (high/true color)
Direct color bitmaps (DCBs) can be 16 or 24 bits. If they are 16 bits, the RGB
pixel format can be 5/5/5 or 5/6/5. If a driver requires a different high
color format than your bitmap was created in, use fg_gethcbpp() and fg_transdcb()
to detect and translate.
fg_clipdcb (void *bitmap, int width, int height);
Draw a transparent, clipped DCB.
fg_cutdcb (void *bitmap, void *section, int xpos, int ypos, int width, int sec_width, int sec_height);
Extract a DCB section from a larger DCB.
fg_drawdcb (void *bitmap, int width, int height);
Draw an unclipped, transparent DCB.
fg_flipdcb (void *bitmap, int width, int height);
Draw an clipped, transparent DCB flipped around vertical axis.
fg_getdcb (void *bitmap, int width, int height);
Retrieve a DCB from a virtual buffer.
fg_invdcb (void *bitmap, int width, int height);
Change orientation of DCB (top-down to bottom-up or vice versa).
fg_pastedcb (void *bitmap, void *section, int xpos, int ypos, int width,
int sec_width, int sec_height);
Insert a DCB into another DCB.
fg_putdcb (void *bitmap, int width, int height);
Draw a non-transparent, unclipped DCB.
fg_revdcb (void *bitmap, int width, int height);
Draw a transparent, unclipped bitmap flipped around vertical axis.
fg_rotdcb (void *source, void *dest, int width, int height, int angle);
Rotate a DCB.
fg_scaledcb (void *source, void *dest, int sw, int sh, int dw, int dh);
Scale a DCB.
fg_sheardcb (void *source, void *dest, int width, int height, int new_size, int type);
Shear (stretch) a bitmap.
fg_transdcb (void *source, void *dest, int source_depth,int dest_depth, int size);
Translate a DCB to another color depth.
Bitmap functions, general
long fg_imagesiz (int width, int height);
Calculate the size of an array needed for a bitmap at this color depth.
void fg_rotsize (int width, int height, int angle, int *new_width, int *new_height);
Determine the dimensions of a bitmap when rotated by a given angle.
Bitmap functions, monochrome
Monochrome bitmaps are small and fast. They are useful for fonts, masks,
and a surprising number of other effects.
void fg_clipmap (void *bitmap, int width, int height);
Draw a clipped, transparent monochrome bitmap.
void fg_drawmap (void *bitmap, int width, int height);
Draw an unclipped, transparent monochrome bitmap.
void fg_getmap (void *bitmap, int width, int height);
Retrieve a monochrome bitmap.
Clipboard
int fg_clip2vb (int minx, int maxx, int miny, int maxy, int flags);
Copy an image from the Windows clipboard.
int fg_vb2clip (int minx, int maxx, int miny, int maxy);
Copy an image to the Windows clipboard.
Colors and palettes
This stuff can be really aggravating under Windows. Remember, a 256-color Windows
palette reserves the first 10 and last 10 palette entries. Whose idea was that?
int fg_colors (void);
Return the display driver's color depth in bits per pixel.
HPALETTE fg_defpal (void);
Create a logical palette containing Fastgraph's default colors.
int fg_getcolor (void);
Return the current color index, as defined by the most recent call fg_setcolor().
void fg_getdacs (int start, int count, void *values);
Retrieve the red, green, and blue color components of a consecutive group of colors in the active logical or virtual palette.
void fg_getrgb (int number, int *red, int *green, int *blue);
Return the red, green, and blue color components for a specified color.
HPALETTE fg_logpal (int start, int count, void *values);
Create a 256-color logical palette.
void fg_mapdacs (void *source, void *dest, int count);
Translate RGB color components from the "0 to 63" range to the "0 to 255" range.
int fg_maprgb (int red, int green, int blue);
Convert RGB color components into a high color or true color equivalent.
void fg_realize (HPALETTE hPal);
Activate (realizes) a logical palette created with fg_defpal() or fg_logpal().
void fg_setcolor (int);
Set the active color.
void fg_setdacs (int start, int count, void *values);
Define RGB values for a consecutive group of colors in the active logical palette.
void fg_setrgb (int number, int red, int green, int blue);
Define RGB values for a specified color in the active logical palette.
void fg_unmaprgb (int color, int *red, int *green, int *blue);
Extract RGB values from a 16-bit or 32-bit color.
Coordinate systems and conversion routines
void fg_getview (int *view_minx, int *view_maxx, int *view_miny, int *view_maxy,
int *minx, int *maxx, int *miny, int *maxy);
Return the viewport extremes in viewport units and screen space units.
void fg_getworld (double *xmin, double *xmax, double *ymin, double *ymax);
Return the current world space limits.
void fg_initw (void);
Initialize world space.
void fg_setview (int view_minx, int view_maxx, int view_miny, int view_maxy,
int minx, int maxx, int miny, int maxy);
Define a viewport
void fg_setworld (double xmin, double xmax, double ymin, double ymax);
Define the world space coordinates that correspond to the edges of the active virtual buffer.
int fg_xclient (int x);
Translate screen space x to client area x.
int fg_xscreen (double x);
Translate world space x to screen space x.
int fg_xvb (int x);
Translate client area x to screen space x.
int fg_xview (int x);
Translate viewport x to screen space x.
double fg_xworld (int x);
Translate screen space x to world space x.
int fg_yclient (int y);
Translate screen space y to client area y.
int fg_yscreen (double y);
Translate world space y to screen space y.
int fg_yvb (int y);
Translate client area y to screen space y.
int fg_yview (int y);
Translate viewport y to screen space y.
double fg_yworld (int y);
Translate screen space y to world space y.
DirectX functions
void fg_ddapply (void);
Apply Fastgraph's DirectX settings defined through fg_ddsetobj().
int fg_ddflip (void);
Do a hardware page flip, using DirectDraw.
int fg_ddflipnw (void);
DirectDraw page flip, without waiting for the vertical retrace.
void fg_ddframe (int state);
Establish beginning or end of a Direct3D rendering sequence.
void fg_ddfreedc (HDC hdc);
Release a device context and unlock the DirectDraw surface.
HDC fg_ddgetdc (void);
Create a device context and lock the associated DirectDraw surface.
int fg_ddgetobj (int code);
Return a pointer to the requested DirectDraw object.
int fg_ddgetversion(void);
* Returns the DirectX version number Fastgraph is using on this system.
int fg_ddlock (void);
Lock a DirectDraw surface and return its address.
void fg_ddsetblt(int flag);
* Establishes Fastgraph's blitting strategy. Default is use DirectX for blitting.
void fg_ddsetobj (void *object, int code);
Define a pointer to an externally created DirectX object.
void fg_ddsetup (int width, int height, int depth, int buffers);
Define the video mode and other DirectX information for full screen programs.
void fg_ddsetversion(int min, int max);
* Establish preferred version(s) of DirectX. Default is highest version available on system.
int fg_ddstatus (void);
Checks if DirectDraw is available. (0=success).
void fg_ddunlock (void);
Unlock the DirectDraw surface.
void fg_gdiflip (void);
Make the GDI drawing surface the visible surface in a DirectX page flipping environment.
int fg_gethcbpp (void);
Return the high-color RGB pixel format. (15 = 5/5/5, 16=5/6/5).
Fonts and character display
void fg_fontdc (HDC hdc);
Define the text device context (can be client area or virtual buffer).
void fg_fontload (int fontID);
Load one of the Windows stock fonts.
void fg_logfont (HFONT hfont);
Make the requested logical font the current font.
void fg_justify (int xjust, int yjust);
Define justification settings for strings displayed with fg_print().
void fg_print (char *string, int n);
Displays a character string.
int fg_getxjust (void);
Return the horizontal justification.
int fg_getyjust (void);
Return the vertical justification.
Graphics primitives (2D drawing functions)
All of these functions are clipped, except fg_putpixel(), fg_rect(), fg_rectx(),
and fg_paint(). Use fg_point(), fg_clprect(), fg_clprectx(), and fg_flood() if
you need clipping. (The unclipped functions are slightly faster). Use fg_move(x,y)
to specify the starting point for things like lines, arcs and circles.
void fg_arc (int radius, int start_angle, int end_angle);
Draw a circular arc.
void fg_box (int minx, int maxx, int miny, int maxy);
Draw a hollow rectangle.
void fg_boxdepth (int xdepth, int ydepth);
Thickness of lines used in fg_box().
void fg_boxx (int minx, int maxx, int miny, int maxy);
Draw a hollow rectangle, xor'd. (Useful for selecting, dragging).
void fg_circle (int radius);
Draw a hollow circle.
void fg_circlef (int radius);
Draw a filled circle
void fg_clprect (int minx, int maxx, int miny, int maxy);
Draw a solid, clipped rectangle.
void fg_clprectx (int minx, int maxx, int miny, int maxy);
Draw a solid, clipped, xor'd rectangle.
void fg_dash (int ix, int iy, int pattern);
Draw a dashed line.
void fg_dashrel (int ix, int iy, int pattern);
Draw a relative dashed line.
void fg_draw (int ix, int iy);
Draw a line.
void fg_drawrel (int ix, int iy);
Draw a relative line.
void fg_drawrelx (int ix, int iy);
Draw a relative line, xor'd.
void fg_drawx (int ix, int iy);
Draw an xor'd line.
void fg_drect (int minx, int maxx, int miny, int maxy, void *pattern);
Draw a dithered rectangle.
void fg_ellipse (int horiz, int vert);
Draw a hollow ellipse.
void fg_ellipsef (int horiz, int vert);
Draw a solid ellipse.
void fg_flood (int x, int y);
Flood-fill an enclosed area.
int fg_getpixel (int x, int y);
Return the color of the pixel at x,y.
int fg_getxbox (void);
Return pixel width of sides of a hollow box.
int fg_getybox (void);
Return pixel width of top, bottom of a hollow box.
int fg_getxpos (void);
Return the current x position.
int fg_getypos (void);
Return the current y position.
int fg_inside (int *vertex_array, int n, int ix, int iy);
Is a point inside a polygon?
void fg_move (int x, int y);
Move to the specified position.
void fg_moverel (int x, int y);
Move relative to the current position.
void fg_paint (int x, int y);
Flood fill, without clipping. (Be careful with this one!)
void fg_point (int x, int y);
Draw a pixel in the current color.
void fg_pointx (int x, int y);
Draw an xor'd pixel in the curent color.
void fg_polyedge (int edge_flag);
Draw right and bottom edges of polygon? 0=excluded, 1=included.
void fg_polyfill (int *vertex_array, void *work_array, int n);
Draw a filled convex polygon with optional backface removal.
void fg_polygon (int *ix_array, int *ix_array, int n);
Draw a hollow convex polygon.
void fg_polyline (int *vertex_array, int n);
Draw a hollow convex polygon.
void fg_polyoff (int x, int y);
Define offset applied to each polygon vertex for fg_inside(), fg_polyfill(), and fg_polyline(). (Default=0).
void fg_putpixel (int x, int y);
Draw a pixel in the current color, ignoring clipping.
void fg_rect (int minx, int maxx, int miny, int maxy);
Draw a solid rectangle.
void fg_rectx (int minx, int maxx, int miny, int maxy);
Draw a solid xor'd rectangle.
Image files
void fg_imagebuf (void *buffer, unsigned int size);
Specifies the size and address of internal buffer for image files. (Default=4k, larger is faster).
int fg_makebmp (int minx, int maxx, int miny, int maxy, int depth, char *filename);
Make a BMP file.
int fg_makepcx (int minx, int maxx, int miny, int maxy, int depth, char *filename);
Make a PCX file.
int fg_showavi (char *filename, int count, int flags);
Play an AVI file.
int fg_showbmp (char *filename, int flags);
Show a BMP file.
int fg_showflic (char *filename, int count, int flags);
Show a flic file.
int fg_showjpeg (char *filename, int flags);
Show a jpeg file.
int fg_showpcx (char *filename, int flags);
Show a PCX file.
Image processing functions
These are new in Fastgraph 6.0. Try them! They are nice.
int fg_blend (int foreground, int background);
Compute an alpha-blended color value using the current opacity setting.
int fg_blend50 (int foreground, int background);
Compute a 50% alpha-blended color value.
void fg_blenddcb (void *foreground, void *background, void *blended, int size);
Compute an alpha-blended bitmap using the current opacity setting.
void fg_blendvar (void *foreground, void *background, void *opacity, void *blended, int size);
Compute an alpha-blended bitmap using an opacity bitmap.
void fg_blendvb (void *foreground, void *background, int width, int height);
Compute an alpha-blended area of a virtual buffer using the current opacity setting.
void fg_blendvbv (void *foreground, void *background, void *opacity, int width, int height);
Compute an alpha-blended area of a virtual buffer using an opacity bitmap.
void fg_contdcb (void *source, void *dest, int lower, int upper, int size);
Apply a contrast enhancement transform to a DCB.
void fg_contrgb (void *values, int lower, int upper, int count);
Apply a contrast enhancement transform to RGB data.
void fg_contvb (int lower, int upper, int width, int height);
Apply a contrast enhancement transform to an area of a virtual buffer.
void fg_gammadcb (void *source, void *dest, double gamma, int size);
Apply a gamma correction transform to a DCB.
void fg_gammargb (void *values, double gamma, int count);
Apply a gamma correction transform to RGB data.
void fg_gammavb (double gamma, int width, int height);
Apply a gamma correction transform to an area of a virtual buffer.
void fg_graydcb (void *source, void *dest, int size);
Apply a grayscale transform to a DCB.
void fg_grayrgb (void *values, int count);
Apply a grayscale transform to RGB data.
void fg_grayvb (int width, int height);
Apply a grayscale transform to an area of a virtual buffer.
void fg_opacity (int opacity);
Define the opacity value used by the alpha blending functions.
void fg_photodcb (void *source, void *dest, int size);
Apply a photo-inversion transform to a
void fg_photorgb (void *values, int count);
Apply a photo-inversion transform to RGB data.
void fg_photovb (int width, int height);
Apply a photo-inversion transform to an area of a virtual buffer.
Initialization
Some of these functions appear elsewhere in this list. We included them
here, because they are pretty important.
HPALETTE fg_defpal (void);
Create a logical palette containing Fastgraph's default colors.
void fg_ddsetup (int width, int height, int depth, int buffers);
Define the video mode and other DirectX information for full screen programs.
HDC fg_getdc (void);
Return the handle to the device context.
HPALETTE fg_logpal (int start, int count, void *values);
Create a 256-color logical palette.
int fg_modeset (int width, int height, int depth, int style);
Define the full-screen display resolution and color depth.
int fg_modetest (int width, int height, int depth);
Are the requested display resolution and color depth available?
int fg_mouseini (void);
Initialize Fastgraph's mouse handling.
void fg_realize (HPALETTE hPal);
Activate (realizes) a logical palette created with fg_defpal() or fg_logpal().
void fg_setdc (HDC hdc);
Establishes a device context.
int fg_vballoc (int width, int height);
Allocate a virtual buffer.
void fg_vbinit (void);
Initialize virtual buffers.
int fg_zballoc (int width, int height);
Allocate z buffer.
Keyboard and mouse support
int fg_kbtest (int scan_code);
Is the spedifiec key pressed?
void fg_mousecur (HCURSOR hcur);
Change the mouse cursor.
int fg_mouseini (void);
Initialize Fastgraph's mouse handling.
void fg_mouselim (int minx, int maxx, int miny, int maxy);
Limit the area of mouse movement.
void fg_mousemov (int x, int y);
Move the mouse.
void fg_mousepos (int *x, int *y);
Where is the mouse now?
HCURSOR fg_mouseptr (void *masks, int xoffset, int yoffset);
Define a new mouse cursor.
void fg_mousesiz (int pixels);
Cursor size may be either 16 (default) or 32 pixels.
void fg_mousevis (int state);
Mouse cursor is invisible when state is 0.
Low-level AVI functions
Use fg_showavi() if you just want to show an AVI file. These functions are helpful
if you want to show one frame at a time, or if you want to create an AVI file.
void fg_avidone (void *context);
Close the AVI file.
int fg_aviframe (void *context, void *bitmap);
Write one frame of an AVI file. See fg_avimake().
int fg_avihead (char *filename, void *header);
Read an AVI file header.
int fg_avimake (char *filename, void *context, int compressor,int width, int height, int depth, int quality, int rate);
Create an empty AVI file that will be built with fg_aviframe().
int fg_aviopen (char *filename, void *context);
Open an AVI file for reading.
int fg_avipal (char *filename, void *palette);
Retrieve palette information from an AVI file.
int fg_aviplay (void *context, int frames, int flags);
Plays one or more frames in an AVI file.
void fg_avisize (void *header, int *width, int *height);
Get AVI file dimensions.
int fg_aviskip (void *context, int frames);
Advance one or more frames in an AVI file.
Low-level flic functions
Use fg_showflic() if you just want to show an flc/fli file.
void fg_flicdone (void *context);
Close the flic file.
int fg_flichead (char *filename, void *header);
Read the flic file header.
int fg_flicopen (char *filename, void *context);
Open a flic file.
int fg_flicplay (void *context, int frames, int flags);
Play one or more frames of a flic file.
void fg_flicsize (void *header, int *width, int *height);
Retrieve the size of the flic file.
int fg_flicskip (void *context, int frames);
Advance one or more frames in a flic file.
Low-level image file functions
int fg_bmphead (char *filename, void *header);
Read a BMP header.
int fg_bmppal (char *filename, void *palette);
Read a BMP palette.
void fg_bmpsize (void *header, int *width, int *height);
Retrieve dimensions of BMP file.
int fg_jpeghead (char * filename, void *header);
Read a jpeg header.
void fg_jpegsize (void *header, int *width, int *height);
Retrieve dimensions of jpeg file.
int fg_pcxhead (char * filename, void *header);
Read a PCX header.
int fg_pcxpal (char *filename, void *palette);
Read a PCX palette.
void fg_pcxrange (void *header, int *xmin, int *xmax, int *ymin, int *ymax);
Return image extents of a PCX file.
void fg_pcxsize (void *header, int *width, int *height);
Retrieve dimensions of PCX file.
Miscellaneous functions
long fg_getclock (void);
Return the system time.
UINT fg_measure (void);
Return the approximate number of delay units per clock tick. (See fg_stall()).
void fg_scroll (int minx, int maxx, int miny, int maxy, int jump, int type);
Vertically scroll a region of the active virtual buffer.
void fg_stall (int delay_units);
Pause execution for a period of time.
void fg_version (int *major, int *minor);
Return version of Fastgraph
void fg_waitfor (int ticks);
Wait for the specified number of clock ticks.
Printing
int fg_printer (int message);
Issue a printer request.
void fg_vbprint (int minx, int maxx, int miny, int maxy, int xmin, int xmax, int ymin, int ymax, int units);
Print an area of the virtual buffer on the default printer, with scaling.
Software characters
Stroked fonts have been in Fastgraph since 1988. They are
interesting, but not commonly used.
void fg_setangle (double angle);
Angle of rotation for software characters.
void fg_setratio (double ratio);
Define the aspect ratio for software characters.
void fg_setsize (int size);
Define the size of software characters.
void fg_setsizew (double size);
Define the size of software characters in world space.
void fg_swchar (char *string, int n, int justify);
Display a string of software characters.
double fg_swlength (char *string, int n);
Compute length of a string of software characters.
void fg_swtext (char *string, int n, int justify);
Display a string of software characters.
Termination
These functions are also listed elsewhere. They are kind of
important. Be sure you call them as needed.
void fg_tmfree (int handle);
Pass -1 to free all texture handles.
void fg_vbclose (void);
Close the active virtual buffer.
void fg_vbfin (void);
Terminate the virtual buffer system.
void fg_vbfree (int handle);
Free a virtual buffer.
void fg_zbfree (int handle);
Free a z buffer.
Virtual buffer functions
A virtual buffer is just a surface you can write graphics to. Usually it is in
system RAM, but if you are using DirectDraw in page flipping mode, you can have
a virtual buffer on a hardware page in video memory.
int fg_clip2vb (int minx, int maxx, int miny, int maxy, int flags);
Copy an image from the Windows clipboard.
void fg_copypage (int source, int dest);
Copy a whole virtual buffer.
void fg_erase (void);
Erase the active virtual buffer.
void fg_fillpage (void);
Fill the active virtual buffer with the active color.
int fg_getdepth (void);
Return the virtual buffer color depth.
void fg_getclip (int *minx, int *maxx, int *miny, int *maxy);
Get the clipping limits of the active virtual buffer.
int fg_getmaxx (void);
Return the right edge x coordinate of the virtual buffer.
int fg_getmaxy (void);
Return the bottom y coordinate of the virtual buffer.
void fg_setclip (int xmin, int xmax, int ymin, int ymax);
Set the clipping limits of the active virtual buffer.
void fg_setclipw (double xmin, double xmax, double ymin, double ymax);
Set the world space clipping limits of the active virtual buffer.
void fg_tcdefine (int index, int attribute);
Define transparency attribute of a color index. (0=non-transparent).
int fg_vb2clip (int minx, int maxx, int miny, int maxy);
Copy an image to the Windows clipboard.
long fg_vbaddr (int handle);
Return the address of a virtual buffer.
int fg_vballoc (int width, int height);
Allocate a virtual buffer.
void fg_vbclose (void);
Close all virtual buffers. (Call before fg_vbfin()).
void fg_vbcolors (void);
copies the logical palette into the active virtual buffer's color table. (Call once.)
void fg_vbcopy (int minx, int maxx, int miny, int maxy, int newx, int newy, int source, int dest);
Copy a rectangular area. Note: destination is lower left corner.
int fg_vbdefine (hugeptr buffer, int width, int height);
Create a virtual buffer from an array. (Use fg_vballoc() instead).
void fg_vbdepth (int depth);
Specify the color depth.
void fg_vbfin (void);
Terminate the virtual buffer system.
void fg_vbfree (int handle);
Free a virtual buffer.
int fg_vbhandle (void);
Return the handle of the active virtual buffer.
void fg_vbinit (void);
Initialize the virtual buffer system.
int fg_vbopen (int handle);
Open a virtual buffer.
void fg_vbpaste (int minx, int maxx, int miny, int maxy, int newx, int newy);
Paste an area of a virtual buffer to the client area. Note: destination is bottom left corner.
void fg_vbprint (int minx, int maxx, int miny, int maxy, int xmin, int xmax, int ymin, int ymax, int units);
Print an area of the virtual buffer on the default printer, with scaling.
void fg_vbscale (int minx, int maxx, int miny, int maxy, int xmin, int xmax, int ymin, int ymax);
Copy an area of a virtual buffer into the client area, scaling as necessary to fit.
long fg_vbsize (int width, int height);
Return bytes needed for a virtual buffer at this size at the current color depth.
void fg_vbtccopy (int minx, int maxx, int miny, int maxy, int newx, int newy, int source, int dest);
Copy a rectangular area, with transparency set by fg_tcdefine().
void fg_vbtzcopy (int minx, int maxx, int miny, int maxy, int newx,int newy, int source, int dest);
Copy a rectangular area, with transparency, color 0 is transparent.
void fg_vbundef (int handle);
Release a handle associated with a virtual buffer.
World space functions (2D)
The graphics primitives are just like the 2D drawing functions,
except they take floating-point arguments. You define a "world
space" to have any extents, and these functions will draw in
a virtual buffer in proportion to the world space limits.
void fg_arcw (double radius, int start_angle, int end_angle);
Draw a circular arc.
void fg_boxw (double xmin, double xmax, double ymin, double ymax);
Draw a hollow rectangle.
void fg_boxxw (double minx, double maxx, double miny, double maxy);
Draw a hollow rectangle, xor'd. (Useful for selecting, dragging).
void fg_circlefw (double radius);
Draw a filled circle
void fg_circlew (double radius);
Draw a hollow circle
void fg_clprectw (double minx, double maxx, double miny, double maxy);
Draw a solid, clipped rectangle.
void fg_dashrw (double x, double y, int pattern);
Draw a relative dashed line.
void fg_dashw (double x, double y, int pattern);
Draw a dashed line.
void fg_drawrw (double x, double y);
Draw a relative line.
void fg_drawrxw (double x, double y);
Draw a relative line, xor'd.
void fg_draww (double x, double y);
Draw a line.
void fg_drawxw (double x, double y);
Draw an xor'd line.
void fg_drectw (double xmin, double xmax, double ymin, double ymax, void *pattern);
Draw a dithered rectangle.
void fg_ellipsew (double horiz, double vert);
Draw a hollow ellipse.
void fg_ellipsfw (double horiz, double vert);
Draw a filled ellipse.
void fg_floodw (double x, double y);
Flood-fill an enclosed area (with clipping).
void fg_initw (void);
Initialize 2D world space.
void fg_moverw (double x, double y);
Move relative to the current position.
void fg_movew (double x, double y);
Move to the specified position.
void fg_paintw (double x, double y);
Unclipped flood fill. (Be careful!)
void fg_pointw (double x, double y);
Draw a pixel in the current color.
void fg_pointxw (double x, double y);
Draw an xor'd pixel in the current color.
void fg_polygonw (double *x_array, double *y_array, int n);
Draw a hollow convex polygon.
void fg_rectw (double xmin, double xmax, double ymin, double ymax);
Draw a solid rectangle.
void fg_setworld (double xmin, double xmax, double ymin, double ymax);
Establish world space limits
Low-level 3D functions
Some of these functions are used internally by Fastgraph. Other
functions, like the texture map functions, are not commonly
used. We recommend you use the fg_tmdefine()/fg_tmselect() strategy
for texture maps because it is compatible with Direct3D. The only
one of these functions that you will probably find useful is
fg_trig().
void fg_3Dproject (double *, int *, int);
void fg_3Dtransform (double *, double *, int);
void fg_3Dtransformobject (double *, double *, int);
int fg_3Dzclip (double *, double *, int);
int fg_3Dzcliprgb (double *, double *, char *, char *, int);
int fg_3Dzcliptm (double *, double *, int *, int *, int);
void fg_drawz (int, int, double, double);
void fg_gouraud (int *, char *, int);
void fg_gouraudz (int *, char *, double *, int);
void fg_polyfilz (int *, double *, int);
void fg_texmap (int *, int *, int);
void fg_texmapp (int *, int *, double *, int);
void fg_texmappz (int *, int *, double *, int);
void fg_texmapz (int *, int *, double *, int);
void fg_trig (int angle, double *cosine, double *sine);
Angle is degrees times 10. (3600 is a full circle).
void fg_3Dupvector (double x, double y, double z);
* Modify the Up vector.
Other low-level functions
These functions are used internally by Fastgraph.
long fg_getline (int);
void fg_reduce (int, int, void *);
Legacy functions
These functions are supplied for compatibility with older versions
of Fastgraph. We don't recommend using them.
void fg_clipmask (void *, int, int);
void fg_defcolor (int, int);
void fg_dispfile (char *, int, int);
void fg_display (void *, int, int);
void fg_displayp (void *, int, int);
void fg_drawmask (void *, int, int);
int fg_findrgb (int, int, int);
long fg_fixed (double);
long fg_fixmul (long, long);
void fg_fixtrig (int, longptr, longptr);
void fg_flipmask (void *, int, int);
double fg_float (long);
void fg_getblock (void *, int, int, int, int);
int fg_gethpage (void);
int fg_getindex (int);
int fg_getlines (void);
int fg_getpage (void);
long fg_fixdiv (long, long);
void fg_jpegbuf (void *, UINT);
int fg_jpegmem (void *);
int fg_loadpcx (char *, int);
void fg_locate (int, int);
int fg_makeppr (int, int, int, int, char *);
int fg_makespr (int, int, int, int, char *);
long fg_memavail (void);
void fg_move3d (longptr, long, long, long, int);
void fg_pack (void *, void *, int, int);
long fg_pagesize (int, int);
void fg_project (longptr, longptr, int *, int);
void fg_putblock (void *, int, int, int, int);
void fg_restore (int, int, int, int);
void fg_restorew (double, double, double, double);
void fg_revmask (void *, int, int);
void fg_rotate3d (longptr, int, int, int, int);
void fg_save (int, int, int, int);
void fg_savew (double, double, double, double);
void fg_setalpha (int);
void fg_sethpage (int);
void fg_setpage (int);
int fg_showppr (char *, int);
int fg_showspr (char *, int);
void fg_tcmask (int);
void fg_tcxfer (int, int, int, int, int, int, int, int);
void fg_text (char *, int);
void fg_texture (void *, int);
void fg_transfer (int, int, int, int, int, int, int, int);
void fg_unpack (void *, void *, int);
void fg_view3d (int, int, int, int, long);
void fg_where (int *, int *);
int fg_xalpha (int);
int fg_xconvert (int);
int fg_yalpha (int);
int fg_yconvert (int);
|