Bladeren bron

* More API documentation.

tags/v0.99.beta14
Sam Hocevar sam 21 jaren geleden
bovenliggende
commit
f2e32a3583
4 gewijzigde bestanden met toevoegingen van 128 en 983 verwijderingen
  1. +9
    -878
      doc/doxygen.cfg
  2. +1
    -1
      src/bitmap.c
  3. +12
    -8
      src/caca.c
  4. +106
    -96
      src/caca.h

+ 9
- 878
doc/doxygen.cfg
Diff onderdrukt omdat het te groot bestand
Bestand weergeven


+ 1
- 1
src/bitmap.c Bestand weergeven

@@ -123,7 +123,7 @@ static void mask2shift(unsigned int mask, int *right, int *left)
/**
* \brief Create an internal bitmap object.
*
* \param bitmap The bitmap depth in bits per pixel.
* \param bpp The bitmap depth in bits per pixel.
* \param w The bitmap width in pixels.
* \param h The bitmap height in pixels.
* \param pitch The bitmap pitch in bytes.


+ 12
- 8
src/caca.c Bestand weergeven

@@ -173,11 +173,13 @@ unsigned int caca_get_height(void)
return _caca_height;
}

/**
* \brief Translate a colour value into its name.
/** \brief Translate a colour index into the colour's name.
*
* This function translates a caca_color enum into a human-readable
* description string of the associated colour.
*
* \param color The colour value.
* \return A static string containing the colour's name.
* \param color The colour value.
* \return A static string containing the colour's name.
*/
const char *caca_get_color_name(enum caca_color color)
{
@@ -268,11 +270,13 @@ void caca_set_feature(enum caca_feature feature)
}
}

/**
* \brief Translate a feature value into its name.
/** \brief Translate a feature value into the feature's name.
*
* This function translates a caca_feature enum into a human-readable
* description string of the associated feature.
*
* \param feature The feature value.
* \return A static string containing the feature's name.
* \param feature The feature value.
* \return A static string containing the feature's name.
*/
const char *caca_get_feature_name(enum caca_feature feature)
{


+ 106
- 96
src/caca.h Bestand weergeven

@@ -47,7 +47,7 @@
* \section api The libcaca API
*
* The complete \e libcaca programming interface is available from the
* caca.h file.
* caca.h header.
*
* \section env Environment variables
*
@@ -78,10 +78,10 @@
* when rendering a picture that has more colours than the usually
* available palette.
* - \c none disables dithering.
* - \c ordered2 uses a 2x2 bayer matrix for dithering.
* - \c ordered4 uses a 4x4 bayer matrix for dithering. This is the
* - \c ordered2 uses a 2x2 Bayer matrix for dithering.
* - \c ordered4 uses a 4x4 Bayer matrix for dithering. This is the
* default choice.
* - \c ordered8 uses a 8x8 bayer matrix for dithering.
* - \c ordered8 uses a 8x8 Bayer matrix for dithering.
* - \c random uses random dithering.
*/

@@ -93,115 +93,122 @@ extern "C"
{
#endif

/**
* The colour definitions to be used with caca_set_color().
/** \brief Colour definitions.
*
* This enum lists all colours that can be used with caca_set_color().
*/
enum caca_color
{
CACA_COLOR_BLACK = 0,
CACA_COLOR_BLUE = 1,
CACA_COLOR_GREEN = 2,
CACA_COLOR_CYAN = 3,
CACA_COLOR_RED = 4,
CACA_COLOR_MAGENTA = 5,
CACA_COLOR_BROWN = 6,
CACA_COLOR_LIGHTGRAY = 7,
CACA_COLOR_DARKGRAY = 8,
CACA_COLOR_LIGHTBLUE = 9,
CACA_COLOR_LIGHTGREEN = 10,
CACA_COLOR_LIGHTCYAN = 11,
CACA_COLOR_LIGHTRED = 12,
CACA_COLOR_LIGHTMAGENTA = 13,
CACA_COLOR_YELLOW = 14,
CACA_COLOR_WHITE = 15
CACA_COLOR_BLACK = 0, /**< The colour index for black. */
CACA_COLOR_BLUE = 1, /**< The colour index for blue. */
CACA_COLOR_GREEN = 2, /**< The colour index for green. */
CACA_COLOR_CYAN = 3, /**< The colour index for cyan. */
CACA_COLOR_RED = 4, /**< The colour index for red. */
CACA_COLOR_MAGENTA = 5, /**< The colour index for magenta. */
CACA_COLOR_BROWN = 6, /**< The colour index for brown. */
CACA_COLOR_LIGHTGRAY = 7, /**< The colour index for light gray. */
CACA_COLOR_DARKGRAY = 8, /**< The colour index for dark gray. */
CACA_COLOR_LIGHTBLUE = 9, /**< The colour index for blue. */
CACA_COLOR_LIGHTGREEN = 10, /**< The colour index for light green. */
CACA_COLOR_LIGHTCYAN = 11, /**< The colour index for light cyan. */
CACA_COLOR_LIGHTRED = 12, /**< The colour index for light red. */
CACA_COLOR_LIGHTMAGENTA = 13, /**< The colour index for light magenta. */
CACA_COLOR_YELLOW = 14, /**< The colour index for yellow. */
CACA_COLOR_WHITE = 15 /**< The colour index for white. */
};

/** \ingroup convenience */
const char *caca_get_color_name(enum caca_color);

/**
* The internal libcaca features.
/** \brief Internal features.
*
* This enum lists all possible internal libcaca features such as the
* rendering method or the dithering mode.
*/
enum caca_feature
{
/* Properties of background characters */
CACA_BACKGROUND = 0x10,
CACA_BACKGROUND_BLACK = 0x11,
CACA_BACKGROUND_SOLID = 0x12,
#define CACA_BACKGROUND_MIN 0x11
#define CACA_BACKGROUND_MAX 0x12
CACA_BACKGROUND = 0x10, /**< Properties of background characters. */
CACA_BACKGROUND_BLACK = 0x11, /**< Draw only black backgrounds. */
CACA_BACKGROUND_SOLID = 0x12, /**< Draw coloured solid backgorunds. */
#define CACA_BACKGROUND_MIN 0x11 /**< First background property */
#define CACA_BACKGROUND_MAX 0x12 /**< Last background property */

/* Antialiasing features */
CACA_ANTIALIASING = 0x20,
CACA_ANTIALIASING_NONE = 0x21,
CACA_ANTIALIASING_PREFILTER = 0x22,
#define CACA_ANTIALIASING_MIN 0x21
#define CACA_ANTIALIASING_MAX 0x22
CACA_ANTIALIASING = 0x20, /**< Antialiasing features. */
CACA_ANTIALIASING_NONE = 0x21, /**< No antialiasing. */
CACA_ANTIALIASING_PREFILTER = 0x22, /**< Prefilter antialiasing. */
#define CACA_ANTIALIASING_MIN 0x21 /**< First antialiasing feature. */
#define CACA_ANTIALIASING_MAX 0x22 /**< Last antialiasing feature. */

/* Dithering methods */
CACA_DITHERING = 0x30,
CACA_DITHERING_NONE = 0x31,
CACA_DITHERING_ORDERED2 = 0x32,
CACA_DITHERING_ORDERED4 = 0x33,
CACA_DITHERING_ORDERED8 = 0x34,
CACA_DITHERING_RANDOM = 0x35,
#define CACA_DITHERING_MIN 0x31
#define CACA_DITHERING_MAX 0x35
CACA_DITHERING = 0x30, /**< Dithering methods */
CACA_DITHERING_NONE = 0x31, /**< No dithering. */
CACA_DITHERING_ORDERED2 = 0x32, /**< Ordered 2x2 Bayer dithering. */
CACA_DITHERING_ORDERED4 = 0x33, /**< Ordered 4x4 Bayer dithering. */
CACA_DITHERING_ORDERED8 = 0x34, /**< Ordered 8x8 Bayer dithering. */
CACA_DITHERING_RANDOM = 0x35, /**< Random dithering. */
#define CACA_DITHERING_MIN 0x31 /**< First dithering feature. */
#define CACA_DITHERING_MAX 0x35 /**< Last dithering feature. */

/* Unknown feature */
CACA_UNKNOWN_FEATURE = 0xffff
CACA_UNKNOWN_FEATURE = 0xffff /**< Unknown feature. */
};

/** \ingroup convenience */
const char *caca_get_feature_name(enum caca_feature);

/* Backwards compatibility */
/*
* Backwards compatibility macros
*/
#ifndef _DOXYGEN_SKIP_ME
#define caca_dithering caca_feature
#define caca_set_dithering caca_set_feature
#define caca_get_dithering_name caca_get_feature_name
#define CACA_DITHER_NONE CACA_DITHERING_NONE
#define CACA_DITHER_ORDERED CACA_DITHERING_ORDERED8
#define CACA_DITHER_RANDOM CACA_DITHERING_RANDOM
#endif

/**
* The event types returned by caca_get_event().
/** \brief User events.
*
* This enum lists all possible event types returned by caca_get_event().
*/
enum caca_event
{
CACA_EVENT_NONE = 0x00000000,
CACA_EVENT_KEY_PRESS = 0x01000000,
CACA_EVENT_KEY_RELEASE = 0x02000000,
CACA_EVENT_MOUSE_CLICK = 0x04000000
CACA_EVENT_NONE = 0x00000000, /**< No event. */
CACA_EVENT_KEY_PRESS = 0x01000000, /**< A key was pressed. */
CACA_EVENT_KEY_RELEASE = 0x02000000, /**< A key was released. */
CACA_EVENT_MOUSE_CLICK = 0x04000000 /**< A mouse button was clicked. */
};

/**
* The special key values returned by caca_get_event().
/** \brief Special key values.
*
* This enum lists special key values returned by caca_get_event() for
* which there is no ASCII equivalent.
*/
enum caca_key
{
CACA_KEY_UP = 273,
CACA_KEY_DOWN = 274,
CACA_KEY_LEFT = 275,
CACA_KEY_RIGHT = 276,
CACA_KEY_UP = 273, /**< The up arrow key. */
CACA_KEY_DOWN = 274, /**< The down arrow key. */
CACA_KEY_LEFT = 275, /**< The left arrow key. */
CACA_KEY_RIGHT = 276, /**< The right arrow key. */

CACA_KEY_F1 = 282,
CACA_KEY_F2 = 283,
CACA_KEY_F3 = 284,
CACA_KEY_F4 = 285,
CACA_KEY_F5 = 286,
CACA_KEY_F6 = 287,
CACA_KEY_F7 = 288,
CACA_KEY_F8 = 289,
CACA_KEY_F9 = 290,
CACA_KEY_F10 = 291,
CACA_KEY_F11 = 292,
CACA_KEY_F12 = 293,
CACA_KEY_F13 = 294,
CACA_KEY_F14 = 295,
CACA_KEY_F15 = 296
CACA_KEY_F1 = 282, /**< The F1 key. */
CACA_KEY_F2 = 283, /**< The F2 key. */
CACA_KEY_F3 = 284, /**< The F3 key. */
CACA_KEY_F4 = 285, /**< The F4 key. */
CACA_KEY_F5 = 286, /**< The F5 key. */
CACA_KEY_F6 = 287, /**< The F6 key. */
CACA_KEY_F7 = 288, /**< The F7 key. */
CACA_KEY_F8 = 289, /**< The F8 key. */
CACA_KEY_F9 = 290, /**< The F9 key. */
CACA_KEY_F10 = 291, /**< The F10 key. */
CACA_KEY_F11 = 292, /**< The F11 key. */
CACA_KEY_F12 = 293, /**< The F12 key. */
CACA_KEY_F13 = 294, /**< The F13 key. */
CACA_KEY_F14 = 295, /**< The F14 key. */
CACA_KEY_F15 = 296 /**< The F15 key. */
};

/*
* Basic functions
*/
/** \defgroup basic Basic functions
* \@{ */
int caca_init(void);
void caca_set_delay(unsigned int);
enum caca_feature caca_get_feature(enum caca_feature);
@@ -211,15 +218,15 @@ unsigned int caca_get_width(void);
unsigned int caca_get_height(void);
void caca_refresh(void);
void caca_end(void);
/** \@} */

/*
* Events
*/
/** \defgroup event Event handling functions
* \@{ */
unsigned int caca_get_event(void);
/** \@} */

/*
* Character graphics
*/
/** \defgroup char Character printing functions
* \@{ */
void caca_set_color(enum caca_color, enum caca_color);
enum caca_color caca_get_fg_color(void);
enum caca_color caca_get_bg_color(void);
@@ -227,10 +234,10 @@ void caca_putchar(int, int, char);
void caca_putstr(int, int, const char *);
void caca_printf(int, int, const char *, ...);
void caca_clear(void);
/** \@} */

/*
* Graphics primitives
*/
/** \defgroup prim Primitives drawing functions
* \@{ */
void caca_draw_line(int, int, int, int, char);
void caca_draw_polyline(const int x[], const int y[], int, char);
void caca_draw_thin_line(int, int, int, int);
@@ -248,16 +255,16 @@ void caca_fill_box(int, int, int, int, char);
void caca_draw_triangle(int, int, int, int, int, int, char);
void caca_draw_thin_triangle(int, int, int, int, int, int);
void caca_fill_triangle(int, int, int, int, int, int, char);
/** \@} */

/*
* Maths
*/
/** \defgroup math Mathematical functions
* \@{ */
int caca_rand(int, int);
unsigned int caca_sqrt(unsigned int);
/** \@} */

/*
* Sprite handling
*/
/** \defgroup sprite Sprite handling functions
* \@{ */
struct caca_sprite;
struct caca_sprite * caca_load_sprite(const char *);
int caca_get_sprite_frames(const struct caca_sprite *);
@@ -267,10 +274,10 @@ int caca_get_sprite_dx(const struct caca_sprite *, int);
int caca_get_sprite_dy(const struct caca_sprite *, int);
void caca_draw_sprite(int, int, const struct caca_sprite *, int);
void caca_free_sprite(struct caca_sprite *);
/** \@} */

/*
* Bitmap handling
*/
/** \defgroup bitmap Bitmap handling functions
* \@{ */
struct caca_bitmap;
struct caca_bitmap *caca_create_bitmap(unsigned int, unsigned int,
unsigned int, unsigned int,
@@ -281,6 +288,9 @@ void caca_set_bitmap_palette(struct caca_bitmap *,
unsigned int b[], unsigned int a[]);
void caca_draw_bitmap(int, int, int, int, const struct caca_bitmap *, void *);
void caca_free_bitmap(struct caca_bitmap *);
/** \@} */

/** \defgroup convenience Convenience functions */

#ifdef __cplusplus
}


Laden…
Annuleren
Opslaan