gint/include/gray.h

141 lines
2.6 KiB
C

//---
//
// gint core/drawing module: gray
//
// Runs the gray engine and handles drawing for the dual-buffer system.
//
//---
#ifndef _GRAY_H
#define _GRAY_H 1
#include <display.h>
//---
// Engine control.
//---
/*
gray_runs()
Returns 1 if the gray engine is running, 0 otherwise.
*/
int gray_runs(void);
/*
gray_start()
Starts the gray engine. The control of the screen is transferred to the
gray engine.
*/
void gray_start(void);
/*
gray_stop()
Stops the gray engine. The monochrome display system takes control of
the video ram.
*/
void gray_stop(void);
/*
gray_lightVRAM()
Returns the module's light gray vram address.
*/
void *gray_lightVRAM(void);
/*
gray_darkVRAM()
Returns the module's dark gray vram address.
*/
void *gray_darkVRAM(void);
/*
gray_getDelays()
Returns the gray engine delays. Pointers are not set if NULL.
*/
void gray_getDelays(int *light, int *dark);
/*
gray_setDelays()
Changes the gray engine delays. Usually you don't need to call this,
because the engine has its default values.
Finding values that give proper grays is quite the hard part of the
gray engine. Usual values are about 1000, with light being between 75
and 90% of dark.
Typical values:
values stability stripes colors
---------------------------------------------------------
860, 1298 excellent worst static good
912, 1343 bad none very good (default)
993, 1609 medium light fast good
1325, 1607 bad light fast excellent
---------------------------------------------------------
*/
void gray_setDelays(int light, int dark);
//---
// Global drawing functions.
//---
/*
gupdate()
Swaps the vram buffer sets.
*/
void gupdate(void);
/*
gclear()
Clears the video ram.
*/
void gclear(void);
/*
gclear_area()
Clears an area of the video ram. End points (x1, y1) and (x2, y2) are
included.
*/
void gclear_area(int x1, int y1, int x2, int y2);
/*
greverse_area()
Reverses an area of the vram. End points (x1, y1) and (x2, y2) are
included.
*/
void greverse_area(int x1, int y1, int x2, int y2);
//---
// Local drawing functions.
//---
/*
gpixel()
Puts a pixel in the vram.
*/
void gpixel(int x, int y, enum Color color);
/*
gline()
Draws a line in the vram. Automatically optimizes special cases.
*/
void gline(int x1, int y1, int x2, int y2, enum Color color);
/*
gimage()
Displays a gray image in the vram.
*/
void gimage(int x, int y, struct Image *image);
/*
gimage_part()
Draws a portion of a gray image, defined by its bounding rectangle.
Point (left, top) is included, but (left + width, top + height) is
excluded.
*/
void gimage_part(int x, int y, struct Image *image, int left, int top,
int width, int height);
#endif // _GRAY_H