Changeset 257


Ignore:
Timestamp:
Dec 18, 2003, 1:11:52 AM (18 years ago)
Author:
Sam Hocevar
Message:
  • src/: + Doxygenated public functions.
Location:
libcaca/trunk/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/src/bitmap.c

    r253 r257  
    121121}
    122122
     123/**
     124 * \brief Create an internal bitmap object.
     125 *
     126 * \param bitmap The bitmap depth in bits per pixel.
     127 * \param w The bitmap width in pixels.
     128 * \param h The bitmap height in pixels.
     129 * \param pitch The bitmap pitch in bytes.
     130 * \param rmask The bitmask for red values.
     131 * \param gmask The bitmask for green values.
     132 * \param bmask The bitmask for blue values.
     133 * \param amask The bitmask for alpha values.
     134 * \return A bitmap object or NULL upon error.
     135 */
    123136struct caca_bitmap *caca_create_bitmap(unsigned int bpp, unsigned int w,
    124137                                       unsigned int h, unsigned int pitch,
     
    175188}
    176189
     190/**
     191 * \brief Set the palette of an 8bpp bitmap object.
     192 *
     193 * \param bpp The bitmap object.
     194 * \param red An array of 256 red values.
     195 * \param green An array of 256 green values.
     196 * \param blue An array of 256 blue values.
     197 * \param alpha An array of 256 alpha values.
     198 * \return void
     199 */
    177200void caca_set_bitmap_palette(struct caca_bitmap *bitmap,
    178201                             unsigned int red[], unsigned int green[],
     
    205228}
    206229
     230/**
     231 * \brief Free the memory associated with a bitmap.
     232 *
     233 * \param bitmap The bitmap object to be freed.
     234 * \return void
     235 */
    207236void caca_free_bitmap(struct caca_bitmap *bitmap)
    208237{
     
    299328}
    300329
     330/**
     331 * \brief Draw a bitmap on the screen.
     332 *
     333 * \param x1 X coordinate of the upper-left corner of the drawing area.
     334 * \param y1 Y coordinate of the upper-left corner of the drawing area.
     335 * \param x2 X coordinate of the lower-right corner of the drawing area.
     336 * \param y2 Y coordinate of the lower-right corner of the drawing area.
     337 * \param bitmap The bitmap object to be drawn.
     338 * \param pixels A pointer to the bitmap's pixels.
     339 * \return void
     340 */
    301341void caca_draw_bitmap(int x1, int y1, int x2, int y2,
    302342                      const struct caca_bitmap *bitmap, void *pixels)
  • libcaca/trunk/src/box.c

    r246 r257  
    3535#include "caca_internals.h"
    3636
     37/**
     38 * \brief Draw a box on the screen using the given character.
     39 *
     40 * \param x1 X coordinate of the upper-left corner of the box.
     41 * \param y1 Y coordinate of the upper-left corner of the box.
     42 * \param x2 X coordinate of the lower-right corner of the box.
     43 * \param y2 Y coordinate of the lower-right corner of the box.
     44 * \param c Character to draw the box outline with.
     45 * \return void
     46 */
    3747void caca_draw_box(int x1, int y1, int x2, int y2, char c)
    3848{
     
    4353}
    4454
     55/**
     56 * \brief Draw a thin box on the screen.
     57 *
     58 * \param x1 X coordinate of the upper-left corner of the box.
     59 * \param y1 Y coordinate of the upper-left corner of the box.
     60 * \param x2 X coordinate of the lower-right corner of the box.
     61 * \param y2 Y coordinate of the lower-right corner of the box.
     62 * \return void
     63 */
    4564void caca_draw_thin_box(int x1, int y1, int x2, int y2)
    4665{
     
    96115}
    97116
     117/**
     118 * \brief Fill a box on the screen using the given character.
     119 *
     120 * \param x1 X coordinate of the upper-left corner of the box.
     121 * \param y1 Y coordinate of the upper-left corner of the box.
     122 * \param x2 X coordinate of the lower-right corner of the box.
     123 * \param y2 Y coordinate of the lower-right corner of the box.
     124 * \param c Character to fill the box with.
     125 * \return void
     126 */
    98127void caca_fill_box(int x1, int y1, int x2, int y2, char c)
    99128{
  • libcaca/trunk/src/caca.c

    r251 r257  
    5858#endif
    5959
     60/**
     61 * \brief Initialise libcaca.
     62 *
     63 * \return 0 upon success, a non-zero value if an error occurs.
     64 */
    6065int caca_init(void)
    6166{
     
    126131}
    127132
     133/**
     134 * \brief Get the screen width.
     135 *
     136 * \return The screen width, in character cells.
     137 */
    128138unsigned int caca_get_width(void)
    129139{
     
    131141}
    132142
     143/**
     144 * \brief Get the screen height.
     145 *
     146 * \return The screen height, in character cells.
     147 */
    133148unsigned int caca_get_height(void)
    134149{
     
    136151}
    137152
     153/**
     154 * \brief Translate a colour value into its name.
     155 *
     156 * \param color The colour value.
     157 * \return A static string containing the colour's name.
     158 */
    138159const char *caca_get_color_name(enum caca_color color)
    139160{
     
    164185}
    165186
     187/**
     188 * \brief Get the current value of a feature.
     189 *
     190 * \param feature The requested feature.
     191 * \return The current value of the feature.
     192 */
    166193enum caca_feature caca_get_feature(enum caca_feature feature)
    167194{
     
    180207}
    181208
     209/**
     210 * \brief Set a feature.
     211 *
     212 * \param feature The wanted feature.
     213 * \return void
     214 */
    182215void caca_set_feature(enum caca_feature feature)
    183216{
     
    213246}
    214247
     248/**
     249 * \brief Translate a feature value into its name.
     250 *
     251 * \param feature The feature value.
     252 * \return A static string containing the feature's name.
     253 */
    215254const char *caca_get_feature_name(enum caca_feature feature)
    216255{
     
    233272}
    234273
     274/**
     275 * \brief Uninitialise libcaca.
     276 *
     277 * \return void
     278 */
    235279void caca_end(void)
    236280{
  • libcaca/trunk/src/caca.h

    r256 r257  
    227227 */
    228228void caca_draw_line(int, int, int, int, char);
    229 void caca_draw_polyline(const int[], const int[], int, char);
     229void caca_draw_polyline(const int x[], const int y[], int, char);
    230230void caca_draw_thin_line(int, int, int, int);
    231 void caca_draw_thin_polyline(const int[], const int[], int);
     231void caca_draw_thin_polyline(const int x[], const int y[], int);
    232232
    233233void caca_draw_circle(int, int, int, char);
     
    271271                                       unsigned int, unsigned int,
    272272                                       unsigned int, unsigned int);
    273 void caca_set_bitmap_palette(struct caca_bitmap *, unsigned int[],
    274                              unsigned int[], unsigned int[], unsigned int[]);
     273void caca_set_bitmap_palette(struct caca_bitmap *,
     274                             unsigned int r[], unsigned int g[],
     275                             unsigned int b[], unsigned int a[]);
    275276void caca_draw_bitmap(int, int, int, int, const struct caca_bitmap *, void *);
    276277void caca_free_bitmap(struct caca_bitmap *);
  • libcaca/trunk/src/conic.c

    r246 r257  
    4444static void ellipsepoints(int, int, int, int, char);
    4545
     46/**
     47 * \brief Draw a circle on the screen using the given character.
     48 *
     49 * \param x Center X coordinate.
     50 * \param y Center Y coordinate.
     51 * \param r Circle radius.
     52 * \param c Character to draw the circle outline with.
     53 * \return void
     54 */
    4655void caca_draw_circle(int x, int y, int r, char c)
    4756{
     
    5867}
    5968
     69/**
     70 * \brief Fill an ellipse on the screen using the given character.
     71 *
     72 * \param xo Center X coordinate.
     73 * \param yo Center Y coordinate.
     74 * \param a Ellipse X radius.
     75 * \param b Ellipse Y radius.
     76 * \param c Character to fill the ellipse with.
     77 * \return void
     78 */
    6079void caca_fill_ellipse(int xo, int yo, int a, int b, char c)
    6180{
     
    103122}
    104123
     124/**
     125 * \brief Draw an ellipse on the screen using the given character.
     126 *
     127 * \param xo Center X coordinate.
     128 * \param yo Center Y coordinate.
     129 * \param a Ellipse X radius.
     130 * \param b Ellipse Y radius.
     131 * \param c Character to draw the ellipse outline with.
     132 * \return void
     133 */
    105134void caca_draw_ellipse(int xo, int yo, int a, int b, char c)
    106135{
     
    145174}
    146175
     176/**
     177 * \brief Draw a thin ellipse on the screen.
     178 *
     179 * \param xo Center X coordinate.
     180 * \param yo Center Y coordinate.
     181 * \param a Ellipse X radius.
     182 * \param b Ellipse Y radius.
     183 * \return void
     184 */
    147185void caca_draw_thin_ellipse(int xo, int yo, int a, int b)
    148186{
  • libcaca/trunk/src/graphics.c

    r251 r257  
    9393static enum caca_color _caca_bgcolor = CACA_COLOR_BLACK;
    9494
     95/**
     96 * \brief Set the default colour pair.
     97 *
     98 * \param fgcolor The desired foreground colour.
     99 * \param bgcolor The desired background colour.
     100 * \return void
     101 */
    95102void caca_set_color(enum caca_color fgcolor, enum caca_color bgcolor)
    96103{
     
    112119}
    113120
     121/**
     122 * \brief Get the current foreground colour.
     123 *
     124 * \return The current foreground colour.
     125 */
    114126enum caca_color caca_get_fg_color(void)
    115127{
     
    117129}
    118130
     131/**
     132 * \brief Get the current background colour.
     133 *
     134 * \return The current background colour.
     135 */
    119136enum caca_color caca_get_bg_color(void)
    120137{
     
    122139}
    123140
     141/**
     142 * \brief Print a character at given coordinates.
     143 *
     144 * \param x The X coordinate of the character.
     145 * \param y The Y coordinate of the character.
     146 * \param c The character to print.
     147 * \return void
     148 */
    124149void caca_putchar(int x, int y, char c)
    125150{
     
    148173}
    149174
     175/**
     176 * \brief Print a string at given coordinates.
     177 *
     178 * \param x The X coordinate of the string.
     179 * \param y The Y coordinate of the string.
     180 * \param s The string to print.
     181 * \return void
     182 */
    150183void caca_putstr(int x, int y, const char *s)
    151184{
     
    193226}
    194227
     228/**
     229 * \brief Format a string at given coordinates.
     230 *
     231 * \param x The X coordinate of the string.
     232 * \param y The Y coordinate of the string.
     233 * \param format The format string to print.
     234 * \param ... Arguments to the format string.
     235 * \return void
     236 */
    195237void caca_printf(int x, int y, const char *format, ...)
    196238{
     
    220262}
    221263
     264/**
     265 * \brief Clear the screen.
     266 *
     267 * \return void
     268 */
    222269void caca_clear(void)
    223270{
     
    419466}
    420467
     468/**
     469 * \brief Set the refresh delay.
     470 *
     471 * \param usec The refresh delay in microseconds.
     472 * \return void
     473 */
    421474void caca_set_delay(unsigned int usec)
    422475{
     
    424477}
    425478
     479/**
     480 * \brief Get the average rendering time.
     481 *
     482 * \return The render time in microseconds.
     483 */
    426484unsigned int caca_get_rendertime(void)
    427485{
     
    449507}
    450508
     509/**
     510 * \brief Flush pending changes and redraw the screen.
     511 *
     512 * \return void
     513 */
    451514void caca_refresh(void)
    452515{
  • libcaca/trunk/src/io.c

    r251 r257  
    5454static int keys = 0;
    5555
     56/**
     57 * \brief Get the next mouse or keyboard input event.
     58 *
     59 * \return The next event in the queue, or 0 if no event is pending.
     60 */
    5661unsigned int caca_get_event(void)
    5762{
  • libcaca/trunk/src/line.c

    r246 r257  
    7777}
    7878
     79/**
     80 * \brief Draw a polyline on the screen using the given character and
     81 *        coordinate arrays. The first and last points are not connected,
     82 *        so in order to draw a polygon you need to specify the starting
     83 *        point at the end of the list as well.
     84 *
     85 * \param x Array of X coordinates. Must have \p n + 1 elements.
     86 * \param y Array of Y coordinates. Must have \p n + 1 elements.
     87 * \param n Number of lines to draw.
     88 * \param c Character to draw the lines with.
     89 * \return void
     90 */
    7991void caca_draw_polyline(const int x[], const int y[], int n, char c)
    8092{
     
    114126}
    115127
     128/**
     129 * \brief Draw a thin polyline on the screen using the given coordinate
     130 *        arrays and with ASCII art. The first and last points are not
     131 *        connected, so in order to draw a polygon you need to specify the
     132 *        starting point at the end of the list as well.
     133 *
     134 * \param x Array of X coordinates. Must have \p n + 1 elements.
     135 * \param y Array of Y coordinates. Must have \p n + 1 elements.
     136 * \param n Number of lines to draw.
     137 * \return void
     138 */
    116139void caca_draw_thin_polyline(const int x[], const int y[], int n)
    117140{
     
    196219 * \param x X coordinate of the point.
    197220 * \param y Y coordinate of the point.
    198  * \return b The clipping bits for the given point.
     221 * \return The clipping bits for the given point.
    199222 */
    200223static uint8_t clip_bits(int x, int y)
  • libcaca/trunk/src/math.c

    r205 r257  
    3535#include "caca_internals.h"
    3636
     37/**
     38 * \brief Generate a random integer within a range.
     39 *
     40 * \param min The lower bound of the integer range.
     41 * \param max The upper bound of the integer range.
     42 * \return A random integer comprised between \p min and \p max, inclusive.
     43 */
    3744int caca_rand(int min, int max)
    3845{
     
    4047}
    4148
     49/**
     50 * \brief Approximate a square root, using Newton's method to avoid
     51 *        costly floating point calculations.
     52 *
     53 * \param a A positive integer.
     54 * \return The approximate square root of \p a.
     55 */
    4256unsigned int caca_sqrt(unsigned int a)
    4357{
  • libcaca/trunk/src/sprite.c

    r246 r257  
    5151};
    5252
     53/**
     54 * \brief Allocate a sprite loaded from a file.
     55 *
     56 * \param file The filename.
     57 * \return The sprite, or NULL if an error occured.
     58 */
    5359struct caca_sprite *caca_load_sprite(const char *file)
    5460{
     
    166172}
    167173
     174/**
     175 * \brief Return the number of frames in a sprite.
     176 *
     177 * \param sprite The sprite.
     178 * \return The number of frames.
     179 */
    168180int caca_get_sprite_frames(const struct caca_sprite *sprite)
    169181{
     
    174186}
    175187
     188/**
     189 * \brief Return the width of a sprite.
     190 *
     191 * \param sprite The sprite.
     192 * \param f The frame index.
     193 * \return The width of the given frame of the sprite.
     194 */
    176195int caca_get_sprite_width(const struct caca_sprite *sprite, int f)
    177196{
     
    185204}
    186205
     206/**
     207 * \brief Return the height of a sprite.
     208 *
     209 * \param sprite The sprite.
     210 * \param f The frame index.
     211 * \return The height of the given frame of the sprite.
     212 */
    187213int caca_get_sprite_height(const struct caca_sprite *sprite, int f)
    188214{
     
    196222}
    197223
     224/**
     225 * \brief Return the X coordinate of a sprite's handle.
     226 *
     227 * \param sprite The sprite.
     228 * \param f The frame index.
     229 * \return The X coordinate of the given frame's handle.
     230 */
    198231int caca_get_sprite_dx(const struct caca_sprite *sprite, int f)
    199232{
     
    207240}
    208241
     242/**
     243 * \brief Return the Y coordinate of a sprite's handle.
     244 *
     245 * \param sprite The sprite.
     246 * \param f The frame index.
     247 * \return The Y coordinate of the given frame's handle.
     248 */
    209249int caca_get_sprite_dy(const struct caca_sprite *sprite, int f)
    210250{
     
    218258}
    219259
     260/**
     261 * \brief Draw a sprite's specific frame at the given coordinates. If the
     262 *        frame does not exist, nothing is displayed.
     263 *
     264 * \param x The X coordinate.
     265 * \param y The Y coordinate.
     266 * \param sprite The sprite.
     267 * \param f The frame index.
     268 * \return void
     269 */
    220270void caca_draw_sprite(int x, int y, const struct caca_sprite *sprite, int f)
    221271{
     
    252302}
    253303
     304/**
     305 * \brief Free the memory associated with a sprite.
     306 *
     307 * \param sprite The sprite to be freed.
     308 * \return void
     309 */
    254310void caca_free_sprite(struct caca_sprite *sprite)
    255311{
  • libcaca/trunk/src/triangle.c

    r246 r257  
    3535#include "caca_internals.h"
    3636
     37/**
     38 * \brief Draw a triangle on the screen using the given character.
     39 *
     40 * \param x1 X coordinate of the first point.
     41 * \param y1 Y coordinate of the first point.
     42 * \param x2 X coordinate of the second point.
     43 * \param y2 Y coordinate of the second point.
     44 * \param x3 X coordinate of the third point.
     45 * \param y3 Y coordinate of the third point.
     46 * \param c Character to draw the triangle outline with.
     47 * \return void
     48 */
    3749void caca_draw_triangle(int x1, int y1, int x2, int y2, int x3, int y3, char c)
    3850{
     
    4254}
    4355
     56/**
     57 * \brief Draw a thin triangle on the screen.
     58 *
     59 * \param x1 X coordinate of the first point.
     60 * \param y1 Y coordinate of the first point.
     61 * \param x2 X coordinate of the second point.
     62 * \param y2 Y coordinate of the second point.
     63 * \param x3 X coordinate of the third point.
     64 * \param y3 Y coordinate of the third point.
     65 * \return void
     66 */
    4467void caca_draw_thin_triangle(int x1, int y1, int x2, int y2, int x3, int y3)
    4568{
     
    4972}
    5073
     74/**
     75 * \brief Fill a triangle on the screen using the given character.
     76 *
     77 * \param x1 X coordinate of the first point.
     78 * \param y1 Y coordinate of the first point.
     79 * \param x2 X coordinate of the second point.
     80 * \param y2 Y coordinate of the second point.
     81 * \param x3 X coordinate of the third point.
     82 * \param y3 Y coordinate of the third point.
     83 * \param c Character to fill the triangle with.
     84 * \return void
     85 */
    5186void caca_fill_triangle(int x1, int y1, int x2, int y2, int x3, int y3, char c)
    5287{
Note: See TracChangeset for help on using the changeset viewer.