<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>libcaca documentation</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head> <body> <!-- Generated by Doxygen 1.8.11 --> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">libcaca attribute conversions</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:gafb35087f212d75b431fc501b3a777b6b"><td class="memItemLeft" align="right" valign="top">__extern uint32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gafb35087f212d75b431fc501b3a777b6b">caca_get_attr</a> (<a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> const *, int, int)</td></tr> <tr class="memdesc:gafb35087f212d75b431fc501b3a777b6b"><td class="mdescLeft"> </td><td class="mdescRight">Get the text attribute at the given coordinates. <a href="#gafb35087f212d75b431fc501b3a777b6b">More...</a><br /></td></tr> <tr class="separator:gafb35087f212d75b431fc501b3a777b6b"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga3d19c3d519489534585901e0ca0516c9"><td class="memItemLeft" align="right" valign="top">__extern int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#ga3d19c3d519489534585901e0ca0516c9">caca_set_attr</a> (<a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> *, uint32_t)</td></tr> <tr class="memdesc:ga3d19c3d519489534585901e0ca0516c9"><td class="mdescLeft"> </td><td class="mdescRight">Set the default character attribute. <a href="#ga3d19c3d519489534585901e0ca0516c9">More...</a><br /></td></tr> <tr class="separator:ga3d19c3d519489534585901e0ca0516c9"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga1a24c0bdfcbb9b722f3162f1174ba779"><td class="memItemLeft" align="right" valign="top">__extern int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#ga1a24c0bdfcbb9b722f3162f1174ba779">caca_unset_attr</a> (<a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> *, uint32_t)</td></tr> <tr class="memdesc:ga1a24c0bdfcbb9b722f3162f1174ba779"><td class="mdescLeft"> </td><td class="mdescRight">Unset flags in the default character attribute. <a href="#ga1a24c0bdfcbb9b722f3162f1174ba779">More...</a><br /></td></tr> <tr class="separator:ga1a24c0bdfcbb9b722f3162f1174ba779"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gaa60289ec6bd29bc44afc263c9c5755b2"><td class="memItemLeft" align="right" valign="top">__extern int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gaa60289ec6bd29bc44afc263c9c5755b2">caca_toggle_attr</a> (<a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> *, uint32_t)</td></tr> <tr class="memdesc:gaa60289ec6bd29bc44afc263c9c5755b2"><td class="mdescLeft"> </td><td class="mdescRight">Toggle flags in the default character attribute. <a href="#gaa60289ec6bd29bc44afc263c9c5755b2">More...</a><br /></td></tr> <tr class="separator:gaa60289ec6bd29bc44afc263c9c5755b2"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gaeec0a808344742989fd202b527993242"><td class="memItemLeft" align="right" valign="top">__extern int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gaeec0a808344742989fd202b527993242">caca_put_attr</a> (<a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> *, int, int, uint32_t)</td></tr> <tr class="memdesc:gaeec0a808344742989fd202b527993242"><td class="mdescLeft"> </td><td class="mdescRight">Set the character attribute at the given coordinates. <a href="#gaeec0a808344742989fd202b527993242">More...</a><br /></td></tr> <tr class="separator:gaeec0a808344742989fd202b527993242"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga1cd39df80cc6b537a4df18415a8605cf"><td class="memItemLeft" align="right" valign="top">__extern int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#ga1cd39df80cc6b537a4df18415a8605cf">caca_set_color_ansi</a> (<a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> *, uint8_t, uint8_t)</td></tr> <tr class="memdesc:ga1cd39df80cc6b537a4df18415a8605cf"><td class="mdescLeft"> </td><td class="mdescRight">Set the default colour pair for text (ANSI version). <a href="#ga1cd39df80cc6b537a4df18415a8605cf">More...</a><br /></td></tr> <tr class="separator:ga1cd39df80cc6b537a4df18415a8605cf"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gac031e1af3a6bce86128bb1a3050550bc"><td class="memItemLeft" align="right" valign="top">__extern int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gac031e1af3a6bce86128bb1a3050550bc">caca_set_color_argb</a> (<a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> *, uint16_t, uint16_t)</td></tr> <tr class="memdesc:gac031e1af3a6bce86128bb1a3050550bc"><td class="mdescLeft"> </td><td class="mdescRight">Set the default colour pair for text (truecolor version). <a href="#gac031e1af3a6bce86128bb1a3050550bc">More...</a><br /></td></tr> <tr class="separator:gac031e1af3a6bce86128bb1a3050550bc"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga44a5153d1839078c74fd2fbaf0d20e79"><td class="memItemLeft" align="right" valign="top">__extern uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#ga44a5153d1839078c74fd2fbaf0d20e79">caca_attr_to_ansi</a> (uint32_t)</td></tr> <tr class="memdesc:ga44a5153d1839078c74fd2fbaf0d20e79"><td class="mdescLeft"> </td><td class="mdescRight">Get DOS ANSI information from attribute. <a href="#ga44a5153d1839078c74fd2fbaf0d20e79">More...</a><br /></td></tr> <tr class="separator:ga44a5153d1839078c74fd2fbaf0d20e79"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gaccefc87375cb11220cee48d7ba7bd2e7"><td class="memItemLeft" align="right" valign="top">__extern uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gaccefc87375cb11220cee48d7ba7bd2e7">caca_attr_to_ansi_fg</a> (uint32_t)</td></tr> <tr class="memdesc:gaccefc87375cb11220cee48d7ba7bd2e7"><td class="mdescLeft"> </td><td class="mdescRight">Get ANSI foreground information from attribute. <a href="#gaccefc87375cb11220cee48d7ba7bd2e7">More...</a><br /></td></tr> <tr class="separator:gaccefc87375cb11220cee48d7ba7bd2e7"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ga0ef0d3750ad64e80a73af03393ae98db"><td class="memItemLeft" align="right" valign="top">__extern uint8_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#ga0ef0d3750ad64e80a73af03393ae98db">caca_attr_to_ansi_bg</a> (uint32_t)</td></tr> <tr class="memdesc:ga0ef0d3750ad64e80a73af03393ae98db"><td class="mdescLeft"> </td><td class="mdescRight">Get ANSI background information from attribute. <a href="#ga0ef0d3750ad64e80a73af03393ae98db">More...</a><br /></td></tr> <tr class="separator:ga0ef0d3750ad64e80a73af03393ae98db"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gac300bca11f8fd08cca06aa474bcef1fd"><td class="memItemLeft" align="right" valign="top">__extern uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gac300bca11f8fd08cca06aa474bcef1fd">caca_attr_to_rgb12_fg</a> (uint32_t)</td></tr> <tr class="memdesc:gac300bca11f8fd08cca06aa474bcef1fd"><td class="mdescLeft"> </td><td class="mdescRight">Get 12-bit RGB foreground information from attribute. <a href="#gac300bca11f8fd08cca06aa474bcef1fd">More...</a><br /></td></tr> <tr class="separator:gac300bca11f8fd08cca06aa474bcef1fd"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gaa2db22d90412331091727ccac65c95cb"><td class="memItemLeft" align="right" valign="top">__extern uint16_t </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gaa2db22d90412331091727ccac65c95cb">caca_attr_to_rgb12_bg</a> (uint32_t)</td></tr> <tr class="memdesc:gaa2db22d90412331091727ccac65c95cb"><td class="mdescLeft"> </td><td class="mdescRight">Get 12-bit RGB background information from attribute. <a href="#gaa2db22d90412331091727ccac65c95cb">More...</a><br /></td></tr> <tr class="separator:gaa2db22d90412331091727ccac65c95cb"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:gaa673f18e9b8b2e52f4e67788cc41df4d"><td class="memItemLeft" align="right" valign="top">__extern void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64</a> (uint32_t, uint8_t[8])</td></tr> <tr class="memdesc:gaa673f18e9b8b2e52f4e67788cc41df4d"><td class="mdescLeft"> </td><td class="mdescRight">Get 64-bit ARGB information from attribute. <a href="#gaa673f18e9b8b2e52f4e67788cc41df4d">More...</a><br /></td></tr> <tr class="separator:gaa673f18e9b8b2e52f4e67788cc41df4d"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <p>These functions perform conversions between attribute values. </p> <h2 class="groupheader">Function Documentation</h2> <a class="anchor" id="gafb35087f212d75b431fc501b3a777b6b"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern uint32_t caca_get_attr </td> <td>(</td> <td class="paramtype"><a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> const * </td> <td class="paramname"><em>cv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>y</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Get the internal <em>libcaca</em> attribute value of the character at the given coordinates. The attribute value has 32 significant bits, organised as follows from MSB to LSB:</p><ul> <li>3 bits for the background alpha</li> <li>4 bits for the background red component</li> <li>4 bits for the background green component</li> <li>3 bits for the background blue component</li> <li>3 bits for the foreground alpha</li> <li>4 bits for the foreground red component</li> <li>4 bits for the foreground green component</li> <li>3 bits for the foreground blue component</li> <li>4 bits for the bold, italics, underline and blink flags</li> </ul> <p>If the coordinates are outside the canvas boundaries, the current attribute is returned.</p> <p>This function never fails.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cv</td><td>A handle to the libcaca canvas. </td></tr> <tr><td class="paramname">x</td><td>X coordinate. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The requested attribute. </dd></dl> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__conio.html#ga6ab5c3562ac4a3e89a0828fb7c2bfa99">caca_conio_textbackground()</a>, <a class="el" href="group__conio.html#ga63b715cc2d095eb56c2928af04ee85b1">caca_conio_textcolor()</a>, <a class="el" href="group__caca__dither.html#gae7e10436664deb729029918c6275edb6">caca_dither_bitmap()</a>, <a class="el" href="group__caca__primitives.html#gaf7639315e8de3e0c1f3aa7fc557e155f">caca_fill_triangle()</a>, <a class="el" href="group__caca__figfont.html#gad86d0785a97d54ebe796dcda02d7900f">caca_flush_figlet()</a>, and <a class="el" href="group__caca__figfont.html#ga53d156bf4e4f7606c9f1a8f558d06ef1">caca_put_figchar()</a>.</p> </div> </div> <a class="anchor" id="ga3d19c3d519489534585901e0ca0516c9"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern int caca_set_attr </td> <td>(</td> <td class="paramtype"><a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> * </td> <td class="paramname"><em>cv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Set the default character attribute for drawing. Attributes define foreground and background colour, transparency, bold, italics and underline styles, as well as blink. String functions such as <a class="el" href="group__caca__canvas.html#gaa68d5ce7e429e58798b13af51d51c8f1" title="Print a formated string. ">caca_printf()</a> and graphical primitive functions such as <a class="el" href="group__caca__primitives.html#gabc71affc6ade0542027ae550b3c9414d" title="Draw a line on the canvas using the given character. ">caca_draw_line()</a> will use this attribute.</p> <p>The value of <em>attr</em> is either:</p><ul> <li>a 32-bit integer as returned by <a class="el" href="group__caca__attributes.html#gafb35087f212d75b431fc501b3a777b6b" title="Get the text attribute at the given coordinates. ">caca_get_attr()</a>, in which case it also contains colour information,</li> <li>a combination (bitwise OR) of style values (<em>CACA_UNDERLINE</em>, <em>CACA_BLINK</em>, <em>CACA_BOLD</em> and <em>CACA_ITALICS</em>), in which case setting the attribute does not modify the current colour information.</li> </ul> <p>To retrieve the current attribute value, use caca_get_attr(-1,-1).</p> <p>This function never fails.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cv</td><td>A handle to the libcaca canvas. </td></tr> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>This function always returns 0. </dd></dl> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__caca__dither.html#gae7e10436664deb729029918c6275edb6">caca_dither_bitmap()</a>, <a class="el" href="group__caca__primitives.html#gaf7639315e8de3e0c1f3aa7fc557e155f">caca_fill_triangle()</a>, and <a class="el" href="group__caca__figfont.html#ga53d156bf4e4f7606c9f1a8f558d06ef1">caca_put_figchar()</a>.</p> </div> </div> <a class="anchor" id="ga1a24c0bdfcbb9b722f3162f1174ba779"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern int caca_unset_attr </td> <td>(</td> <td class="paramtype"><a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> * </td> <td class="paramname"><em>cv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Unset flags in the default character attribute for drawing. Attributes define foreground and background colour, transparency, bold, italics and underline styles, as well as blink. String functions such as <a class="el" href="group__caca__canvas.html#gaa68d5ce7e429e58798b13af51d51c8f1" title="Print a formated string. ">caca_printf()</a> and graphical primitive functions such as <a class="el" href="group__caca__primitives.html#gabc71affc6ade0542027ae550b3c9414d" title="Draw a line on the canvas using the given character. ">caca_draw_line()</a> will use this attribute.</p> <p>The value of <em>attr</em> is a combination (bitwise OR) of style values (<em>CACA_UNDERLINE</em>, <em>CACA_BLINK</em>, <em>CACA_BOLD</em> and <em>CACA_ITALICS</em>). Unsetting these attributes does not modify the current colour information.</p> <p>To retrieve the current attribute value, use caca_get_attr(-1,-1).</p> <p>This function never fails.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cv</td><td>A handle to the libcaca canvas. </td></tr> <tr><td class="paramname">attr</td><td>The requested attribute values to unset. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>This function always returns 0. </dd></dl> </div> </div> <a class="anchor" id="gaa60289ec6bd29bc44afc263c9c5755b2"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern int caca_toggle_attr </td> <td>(</td> <td class="paramtype"><a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> * </td> <td class="paramname"><em>cv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Toggle flags in the default character attribute for drawing. Attributes define foreground and background colour, transparency, bold, italics and underline styles, as well as blink. String functions such as <a class="el" href="group__caca__canvas.html#gaa68d5ce7e429e58798b13af51d51c8f1" title="Print a formated string. ">caca_printf()</a> and graphical primitive functions such as <a class="el" href="group__caca__primitives.html#gabc71affc6ade0542027ae550b3c9414d" title="Draw a line on the canvas using the given character. ">caca_draw_line()</a> will use this attribute.</p> <p>The value of <em>attr</em> is a combination (bitwise OR) of style values (<em>CACA_UNDERLINE</em>, <em>CACA_BLINK</em>, <em>CACA_BOLD</em> and <em>CACA_ITALICS</em>). Toggling these attributes does not modify the current colour information.</p> <p>To retrieve the current attribute value, use caca_get_attr(-1,-1).</p> <p>This function never fails.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cv</td><td>A handle to the libcaca canvas. </td></tr> <tr><td class="paramname">attr</td><td>The requested attribute values to toggle. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>This function always returns 0. </dd></dl> </div> </div> <a class="anchor" id="gaeec0a808344742989fd202b527993242"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern int caca_put_attr </td> <td>(</td> <td class="paramtype"><a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> * </td> <td class="paramname"><em>cv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"><em>y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Set the character attribute, without changing the character's value. If the character at the given coordinates is a fullwidth character, both cells' attributes are replaced.</p> <p>The value of <em>attr</em> is either:</p><ul> <li>a 32-bit integer as returned by <a class="el" href="group__caca__attributes.html#gafb35087f212d75b431fc501b3a777b6b" title="Get the text attribute at the given coordinates. ">caca_get_attr()</a>, in which case it also contains colour information,</li> <li>a combination (bitwise OR) of style values (<em>CACA_UNDERLINE</em>, <em>CACA_BLINK</em>, <em>CACA_BOLD</em> and <em>CACA_ITALICS</em>), in which case setting the attribute does not modify the current colour information.</li> </ul> <p>This function never fails.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cv</td><td>A handle to the libcaca canvas. </td></tr> <tr><td class="paramname">x</td><td>X coordinate. </td></tr> <tr><td class="paramname">y</td><td>Y coordinate. </td></tr> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>This function always returns 0. </dd></dl> <p>References <a class="el" href="group__caca__dirty.html#ga97855769d4e2742d6e52c0466e88fe11">caca_add_dirty_rect()</a>, and <a class="el" href="group__caca__canvas.html#gaf0eacf54c042ec78a69942ebc8d7ffd5">CACA_MAGIC_FULLWIDTH</a>.</p> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__caca__figfont.html#gad86d0785a97d54ebe796dcda02d7900f">caca_flush_figlet()</a>, <a class="el" href="group__caca__importexport.html#gaf49776c6092b0d3f47624e837acaa8a6">caca_get_import_list()</a>, and <a class="el" href="group__caca__figfont.html#ga53d156bf4e4f7606c9f1a8f558d06ef1">caca_put_figchar()</a>.</p> </div> </div> <a class="anchor" id="ga1cd39df80cc6b537a4df18415a8605cf"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern int caca_set_color_ansi </td> <td>(</td> <td class="paramtype"><a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> * </td> <td class="paramname"><em>cv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"><em>fg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"><em>bg</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Set the default ANSI colour pair for text drawing. String functions such as <a class="el" href="group__caca__canvas.html#gaa68d5ce7e429e58798b13af51d51c8f1" title="Print a formated string. ">caca_printf()</a> and graphical primitive functions such as <a class="el" href="group__caca__primitives.html#gabc71affc6ade0542027ae550b3c9414d" title="Draw a line on the canvas using the given character. ">caca_draw_line()</a> will use these attributes.</p> <p>Color values are those defined in <a class="el" href="caca_8h.html" title="The libcaca public header. ">caca.h</a>, such as CACA_RED or CACA_TRANSPARENT.</p> <p>If an error occurs, 0 is returned and <b>errno</b> is set accordingly:</p><ul> <li><code>EINVAL</code> At least one of the colour values is invalid.</li> </ul> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cv</td><td>A handle to the libcaca canvas. </td></tr> <tr><td class="paramname">fg</td><td>The requested ANSI foreground colour. </td></tr> <tr><td class="paramname">bg</td><td>The requested ANSI background colour. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>0 in case of success, -1 if an error occurred. </dd></dl> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__conio.html#ga6ab5c3562ac4a3e89a0828fb7c2bfa99">caca_conio_textbackground()</a>, <a class="el" href="group__conio.html#ga63b715cc2d095eb56c2928af04ee85b1">caca_conio_textcolor()</a>, <a class="el" href="group__libcaca.html#ga00caafb33b9d7033d064a642bcad83da">caca_create_canvas()</a>, and <a class="el" href="group__caca__dither.html#gae7e10436664deb729029918c6275edb6">caca_dither_bitmap()</a>.</p> </div> </div> <a class="anchor" id="gac031e1af3a6bce86128bb1a3050550bc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern int caca_set_color_argb </td> <td>(</td> <td class="paramtype"><a class="el" href="caca_8h.html#aae0f6938d08e6e0abbcd5a8c06504ab8">caca_canvas_t</a> * </td> <td class="paramname"><em>cv</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint16_t </td> <td class="paramname"><em>fg</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint16_t </td> <td class="paramname"><em>bg</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Set the default ARGB colour pair for text drawing. String functions such as <a class="el" href="group__caca__canvas.html#gaa68d5ce7e429e58798b13af51d51c8f1" title="Print a formated string. ">caca_printf()</a> and graphical primitive functions such as <a class="el" href="group__caca__primitives.html#gabc71affc6ade0542027ae550b3c9414d" title="Draw a line on the canvas using the given character. ">caca_draw_line()</a> will use these attributes.</p> <p>Colors are 16-bit ARGB values, each component being coded on 4 bits. For instance, 0xf088 is solid dark cyan (A=15 R=0 G=8 B=8), and 0x8fff is white with 50% alpha (A=8 R=15 G=15 B=15).</p> <p>This function never fails.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">cv</td><td>A handle to the libcaca canvas. </td></tr> <tr><td class="paramname">fg</td><td>The requested ARGB foreground colour. </td></tr> <tr><td class="paramname">bg</td><td>The requested ARGB background colour. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>This function always returns 0. </dd></dl> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>.</p> </div> </div> <a class="anchor" id="ga44a5153d1839078c74fd2fbaf0d20e79"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern uint8_t caca_attr_to_ansi </td> <td>(</td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Get the ANSI colour pair for a given attribute. The returned value is an 8-bit value whose higher 4 bits are the background colour and lower 4 bits are the foreground colour.</p> <p>If the attribute has ARGB colours, the nearest colour is used. Special attributes such as <em>CACA_DEFAULT</em> and <em>CACA_TRANSPARENT</em> are not handled and are both replaced with <em>CACA_LIGHTGRAY</em> for the foreground colour and <em>CACA_BLACK</em> for the background colour.</p> <p>This function never fails. If the attribute value is outside the expected 32-bit range, higher order bits are simply ignored.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The corresponding DOS ANSI value. </dd></dl> <p>References <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a9280adda765037612d94743bdc3f346d">CACA_BLACK</a>, and <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a5e5afd66b3a4fed117f3132e4b7cd5b7">CACA_LIGHTGRAY</a>.</p> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>.</p> </div> </div> <a class="anchor" id="gaccefc87375cb11220cee48d7ba7bd2e7"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern uint8_t caca_attr_to_ansi_fg </td> <td>(</td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Get the ANSI foreground colour value for a given attribute. The returned value is either one of the <em>CACA_RED</em>, <em>CACA_BLACK</em> etc. predefined colours, or the special value <em>CACA_DEFAULT</em> meaning the media's default foreground value, or the special value <em>CACA_TRANSPARENT</em>.</p> <p>If the attribute has ARGB colours, the nearest colour is returned.</p> <p>This function never fails. If the attribute value is outside the expected 32-bit range, higher order bits are simply ignored.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The corresponding ANSI foreground value. </dd></dl> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__conio.html#ga6ab5c3562ac4a3e89a0828fb7c2bfa99">caca_conio_textbackground()</a>, and <a class="el" href="group__caca__importexport.html#ga264bcf9f821d67f33bd5ee5aa5e048a0">caca_get_export_list()</a>.</p> </div> </div> <a class="anchor" id="ga0ef0d3750ad64e80a73af03393ae98db"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern uint8_t caca_attr_to_ansi_bg </td> <td>(</td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Get the ANSI background colour value for a given attribute. The returned value is either one of the <em>CACA_RED</em>, <em>CACA_BLACK</em> etc. predefined colours, or the special value <em>CACA_DEFAULT</em> meaning the media's default background value, or the special value <em>CACA_TRANSPARENT</em>.</p> <p>If the attribute has ARGB colours, the nearest colour is returned.</p> <p>This function never fails. If the attribute value is outside the expected 32-bit range, higher order bits are simply ignored.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The corresponding ANSI background value. </dd></dl> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__conio.html#ga63b715cc2d095eb56c2928af04ee85b1">caca_conio_textcolor()</a>, and <a class="el" href="group__caca__importexport.html#ga264bcf9f821d67f33bd5ee5aa5e048a0">caca_get_export_list()</a>.</p> </div> </div> <a class="anchor" id="gac300bca11f8fd08cca06aa474bcef1fd"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern uint16_t caca_attr_to_rgb12_fg </td> <td>(</td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Get the 12-bit foreground colour value for a given attribute. The returned value is a native-endian encoded integer with each red, green and blue values encoded on 8 bits in the following order:</p><ul> <li>8-11 most significant bits: red</li> <li>4-7 most significant bits: green</li> <li>least significant bits: blue</li> </ul> <p>This function never fails. If the attribute value is outside the expected 32-bit range, higher order bits are simply ignored.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The corresponding 12-bit RGB foreground value. </dd></dl> <p>References <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a75851cb7e307bd85518cc33cfe8e9a89">CACA_DEFAULT</a>, <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a5e5afd66b3a4fed117f3132e4b7cd5b7">CACA_LIGHTGRAY</a>, and <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a5828387b58020523f4c6da94961c2f77">CACA_TRANSPARENT</a>.</p> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, and <a class="el" href="group__caca__importexport.html#ga264bcf9f821d67f33bd5ee5aa5e048a0">caca_get_export_list()</a>.</p> </div> </div> <a class="anchor" id="gaa2db22d90412331091727ccac65c95cb"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern uint16_t caca_attr_to_rgb12_bg </td> <td>(</td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Get the 12-bit background colour value for a given attribute. The returned value is a native-endian encoded integer with each red, green and blue values encoded on 8 bits in the following order:</p><ul> <li>8-11 most significant bits: red</li> <li>4-7 most significant bits: green</li> <li>least significant bits: blue</li> </ul> <p>This function never fails. If the attribute value is outside the expected 32-bit range, higher order bits are simply ignored.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The corresponding 12-bit RGB background value. </dd></dl> <p>References <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a9280adda765037612d94743bdc3f346d">CACA_BLACK</a>, <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a75851cb7e307bd85518cc33cfe8e9a89">CACA_DEFAULT</a>, and <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a5828387b58020523f4c6da94961c2f77">CACA_TRANSPARENT</a>.</p> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, and <a class="el" href="group__caca__importexport.html#ga264bcf9f821d67f33bd5ee5aa5e048a0">caca_get_export_list()</a>.</p> </div> </div> <a class="anchor" id="gaa673f18e9b8b2e52f4e67788cc41df4d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">__extern void caca_attr_to_argb64 </td> <td>(</td> <td class="paramtype">uint32_t </td> <td class="paramname"><em>attr</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"><em>argb</em>[8] </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Get the 64-bit colour and alpha values for a given attribute. The values are written as 8-bit integers in the <em>argb</em> array in the following order:</p><ul> <li><em>argb</em>[0]: background alpha value</li> <li><em>argb</em>[1]: background red value</li> <li><em>argb</em>[2]: background green value</li> <li><em>argb</em>[3]: background blue value</li> <li><em>argb</em>[4]: foreground alpha value</li> <li><em>argb</em>[5]: foreground red value</li> <li><em>argb</em>[6]: foreground green value</li> <li><em>argb</em>[7]: foreground blue value</li> </ul> <p>This function never fails. If the attribute value is outside the expected 32-bit range, higher order bits are simply ignored.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">attr</td><td>The requested attribute value. </td></tr> <tr><td class="paramname">argb</td><td>An array of 8-bit integers. </td></tr> </table> </dd> </dl> <p>References <a class="el" href="group__caca__attributes.html#ga44a5153d1839078c74fd2fbaf0d20e79">caca_attr_to_ansi()</a>, <a class="el" href="group__caca__attributes.html#ga0ef0d3750ad64e80a73af03393ae98db">caca_attr_to_ansi_bg()</a>, <a class="el" href="group__caca__attributes.html#gaccefc87375cb11220cee48d7ba7bd2e7">caca_attr_to_ansi_fg()</a>, <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__caca__attributes.html#gaa2db22d90412331091727ccac65c95cb">caca_attr_to_rgb12_bg()</a>, <a class="el" href="group__caca__attributes.html#gac300bca11f8fd08cca06aa474bcef1fd">caca_attr_to_rgb12_fg()</a>, <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a9280adda765037612d94743bdc3f346d">CACA_BLACK</a>, <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a75851cb7e307bd85518cc33cfe8e9a89">CACA_DEFAULT</a>, <a class="el" href="group__caca__attributes.html#gafb35087f212d75b431fc501b3a777b6b">caca_get_attr()</a>, <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a5e5afd66b3a4fed117f3132e4b7cd5b7">CACA_LIGHTGRAY</a>, <a class="el" href="group__caca__attributes.html#gaeec0a808344742989fd202b527993242">caca_put_attr()</a>, <a class="el" href="group__caca__attributes.html#ga3d19c3d519489534585901e0ca0516c9">caca_set_attr()</a>, <a class="el" href="group__caca__attributes.html#ga1cd39df80cc6b537a4df18415a8605cf">caca_set_color_ansi()</a>, <a class="el" href="group__caca__attributes.html#gac031e1af3a6bce86128bb1a3050550bc">caca_set_color_argb()</a>, and <a class="el" href="group__caca__attr.html#gga9db83488c6f07a5f7d773c380b3126a9a5828387b58020523f4c6da94961c2f77">CACA_TRANSPARENT</a>.</p> <p>Referenced by <a class="el" href="group__caca__attributes.html#gaa673f18e9b8b2e52f4e67788cc41df4d">caca_attr_to_argb64()</a>, <a class="el" href="group__caca__importexport.html#ga264bcf9f821d67f33bd5ee5aa5e048a0">caca_get_export_list()</a>, and <a class="el" href="group__caca__font.html#ga64f055de5dd43137d099aa30e56a5dd6">caca_render_canvas()</a>.</p> </div> </div> </div><!-- contents --> </body> </html>