Changeset 268 for libcaca/trunk/src/graphics.c
- Timestamp:
- Dec 23, 2003, 2:27:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/src/graphics.c
r265 r268 1 1 /* 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 11 * 12 * 13 * 14 * 15 * 16 * 17 * 18 * 19 * 20 */ 21 22 /** 23 * 24 * 25 * 26 * 27 * 2 * libcaca ASCII-Art library 3 * Copyright (c) 2002, 2003 Sam Hocevar <sam@zoy.org> 4 * All Rights Reserved 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 19 * 02111-1307 USA 20 */ 21 22 /** \file graphics.c 23 * \version \$Id$ 24 * \author Sam Hocevar <sam@zoy.org> 25 * \brief Character drawing functions 26 * 27 * This file contains character and string drawing functions. 28 28 */ 29 29 … … 100 100 static enum caca_color _caca_bgcolor = CACA_COLOR_BLACK; 101 101 102 /** 103 * \brief Set the default colour pair. 104 * 105 * \param fgcolor The desired foreground colour. 106 * \param bgcolor The desired background colour. 107 * \return void 102 /** \brief Set the default colour pair. 103 * 104 * This function sets the default colour pair. String functions such as 105 * caca_printf() and graphical primitive functions such as caca_draw_line() 106 * will use these colour pairs. 107 * 108 * \param fgcolor The requested foreground colour. 109 * \param bgcolor The requested background colour. 108 110 */ 109 111 void caca_set_color(enum caca_color fgcolor, enum caca_color bgcolor) … … 142 144 } 143 145 144 /** 145 * \brief Get the current foreground colour. 146 * 147 * \return The current foreground colour. 146 /** \brief Get the current foreground colour. 147 * 148 * This function returns the current foreground colour that was set with 149 * caca_set_color(). 150 * 151 * \return The current foreground colour. 148 152 */ 149 153 enum caca_color caca_get_fg_color(void) … … 152 156 } 153 157 154 /** 155 * \brief Get the current background colour. 156 * 157 * \return The current background colour. 158 /** \brief Get the current background colour. 159 * 160 * This function returns the current background colour that was set with 161 * caca_set_color(). 162 * 163 * \return The current background colour. 158 164 */ 159 165 enum caca_color caca_get_bg_color(void) … … 162 168 } 163 169 164 /** 165 * \brief Print a character at given coordinates. 166 * 167 * \param x The X coordinate of the character. 168 * \param y The Y coordinate of the character. 169 * \param c The character to print. 170 * \return void 170 /** \brief Print a character. 171 * 172 * This function prints a character at the given coordinates, using the 173 * default foreground and background values. If the coordinates are outside 174 * the screen boundaries, nothing is printed. 175 * 176 * \param x X coordinate. 177 * \param y Y coordinate. 178 * \param c The character to print. 171 179 */ 172 180 void caca_putchar(int x, int y, char c) … … 213 221 } 214 222 215 /** 216 * \brief Print a string at given coordinates. 217 * 218 * \param x The X coordinate of the string. 219 * \param y The Y coordinate of the string. 220 * \param s The string to print. 221 * \return void 223 /** \brief Print a string. 224 * 225 * This function prints a string at the given coordinates, using the 226 * default foreground and background values. The coordinates may be outside 227 * the screen boundaries (eg. a negative Y coordinate) and the string will 228 * be cropped accordingly if it is too long. 229 * 230 * \param x X coordinate. 231 * \param y Y coordinate. 232 * \param s The string to print. 222 233 */ 223 234 void caca_putstr(int x, int y, const char *s) … … 291 302 } 292 303 293 /** 294 * \brief Format a string at given coordinates. 295 * 296 * \param x The X coordinate of the string. 297 * \param y The Y coordinate of the string. 298 * \param format The format string to print. 299 * \param ... Arguments to the format string. 300 * \return void 304 /** \brief Format a string. 305 * 306 * This function formats a string at the given coordinates, using the 307 * default foreground and background values. The coordinates may be outside 308 * the screen boundaries (eg. a negative Y coordinate) and the string will 309 * be cropped accordingly if it is too long. The syntax of the format 310 * string is the same as for the C printf() function. 311 * 312 * \param x X coordinate. 313 * \param y Y coordinate. 314 * \param format The format string to print. 315 * \param ... Arguments to the format string. 301 316 */ 302 317 void caca_printf(int x, int y, const char *format, ...) … … 327 342 } 328 343 329 /** 330 * \brief Clear the screen. 331 * 332 * \return void 344 /** \brief Clear the screen. 345 * 346 * This function clears the screen using a black background. 333 347 */ 334 348 void caca_clear(void) … … 638 652 } 639 653 640 /** 641 * \brief Set the refresh delay. 642 * 643 * \param usec The refresh delay in microseconds. 644 * \return void 654 /** \brief Set the refresh delay. 655 * 656 * This function sets the refresh delay in microseconds. The refresh delay 657 * is used by caca_refresh() to achieve constant framerate. See the 658 * caca_refresh() documentation for more details. 659 * 660 * If the argument is zero, constant framerate is disabled. This is the 661 * default behaviour. 662 * 663 * \param usec The refresh delay in microseconds. 645 664 */ 646 665 void caca_set_delay(unsigned int usec) … … 649 668 } 650 669 651 /** 652 * \brief Get the average rendering time. 653 * 654 * \return The render time in microseconds. 670 /** \brief Get the average rendering time. 671 * 672 * This function returns the average rendering time, which is the average 673 * measured time between two caca_refresh() calls, in microseconds. If 674 * constant framerate was activated by calling caca_set_delay(), the average 675 * rendering time will not be considerably shorter than the requested delay 676 * even if the real rendering time was shorter. 677 * 678 * \return The render time in microseconds. 655 679 */ 656 680 unsigned int caca_get_rendertime(void) … … 679 703 } 680 704 681 /** 682 * \brief Flush pending changes and redraw the screen. 683 * 684 * \return void 705 /** \brief Flush pending changes and redraw the screen. 706 * 707 * This function flushes all graphical operations and prints them to the 708 * screen. Nothing will show on the screen caca_refresh() is not called. 709 * 710 * If caca_set_delay() was called with a non-zero value, caca_refresh() 711 * will use that value to achieve constant framerate: if two consecutive 712 * calls to caca_refresh() are within a time range shorter than the value 713 * set with caca_set_delay(), the second call will wait a bit before 714 * performing the screen refresh. 685 715 */ 686 716 void caca_refresh(void)
Note: See TracChangeset
for help on using the changeset viewer.