1<!-- 2 **************************************************************************** 3 * Copyright 2018-2023,2024 Thomas E. Dickey * 4 * Copyright 2002-2015,2017 Free Software Foundation, Inc. * 5 * * 6 * Permission is hereby granted, free of charge, to any person obtaining a * 7 * copy of this software and associated documentation files (the * 8 * "Software"), to deal in the Software without restriction, including * 9 * without limitation the rights to use, copy, modify, merge, publish, * 10 * distribute, distribute with modifications, sublicense, and/or sell * 11 * copies of the Software, and to permit persons to whom the Software is * 12 * furnished to do so, subject to the following conditions: * 13 * * 14 * The above copyright notice and this permission notice shall be included * 15 * in all copies or substantial portions of the Software. * 16 * * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * 19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * 20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * 23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 24 * * 25 * Except as contained in this notice, the name(s) of the above copyright * 26 * holders shall not be used in advertising or otherwise to promote the * 27 * sale, use or other dealings in this Software without prior written * 28 * authorization. * 29 **************************************************************************** 30 * @Id: curs_bkgrnd.3x,v 1.42 2024/04/20 18:54:36 tom Exp @ 31--> 32<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> 33<HTML> 34<HEAD> 35<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> 36<meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts"> 37<TITLE>curs_bkgrnd 3x 2024-04-20 ncurses 6.5 Library calls</TITLE> 38<link rel="author" href="mailto:bug-ncurses@gnu.org"> 39 40</HEAD> 41<BODY> 42<H1 class="no-header">curs_bkgrnd 3x 2024-04-20 ncurses 6.5 Library calls</H1> 43<PRE> 44<STRONG><A HREF="curs_bkgrnd.3x.html">curs_bkgrnd(3x)</A></STRONG> Library calls <STRONG><A HREF="curs_bkgrnd.3x.html">curs_bkgrnd(3x)</A></STRONG> 45 46 47 48 49</PRE><H2><a name="h2-NAME">NAME</a></H2><PRE> 50 <STRONG>bkgrnd</STRONG>, <STRONG>wbkgrnd</STRONG>, <STRONG>bkgrndset</STRONG>, <STRONG>wbkgrndset</STRONG>, <STRONG>getbkgrnd</STRONG>, <STRONG>wgetbkgrnd</STRONG> - 51 manipulate background of a <EM>curses</EM> window of wide characters 52 53 54</PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE> 55 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG> 56 57 <STRONG>int</STRONG> <STRONG>bkgrnd(const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG> 58 <STRONG>int</STRONG> <STRONG>wbkgrnd(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG> 59 60 <STRONG>void</STRONG> <STRONG>bkgrndset(const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG> 61 <STRONG>void</STRONG> <STRONG>wbkgrndset(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG> 62 63 <STRONG>int</STRONG> <STRONG>getbkgrnd(cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG> 64 <STRONG>int</STRONG> <STRONG>wgetbkgrnd(WINDOW</STRONG> <STRONG>*</STRONG><EM>win</EM><STRONG>,</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG> 65 66 67</PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE> 68 The <EM>background</EM> of a <EM>curses</EM> window (in the library's "wide" 69 configuration) is a <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM> combining a set of attributes (see 70 <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>) with a complex character called the <EM>blank</EM> <EM>character.</EM> 71 72 The blank character is a spacing character that populates a window's 73 character cells when their contents are erased without replacement. 74 The background's attributes are combined with all non-blank characters 75 written to the window, as with the <STRONG><A HREF="curs_add_wch.3x.html">wadd_wch(3x)</A></STRONG> and <STRONG><A HREF="curs_ins_wch.3x.html">wins_wch(3x)</A></STRONG> 76 families of functions. 77 78 The blank character and attributes of the background combine with 79 characters written to the window as described below. The background 80 becomes a property of the character and moves with it through any 81 scrolling and insert/delete line/character operations. 82 83 To the extent possible on a given terminal, the attribute part of the 84 background is displayed as the graphic rendition of the character put 85 on the screen. 86 87 88</PRE><H3><a name="h3-bkgrnd_wbkgrnd">bkgrnd, wbkgrnd</a></H3><PRE> 89 <STRONG>bkgrnd</STRONG> and <STRONG>wbkgrnd</STRONG> set the background property of <STRONG>stdscr</STRONG> or the 90 specified window and then apply this setting to every character cell in 91 that window. 92 93 <STRONG>o</STRONG> The rendition of every character in the window changes to the new 94 background rendition. 95 96 <STRONG>o</STRONG> Wherever the former background character appears, it changes to the 97 new background character. 98 99 <EM>ncurses</EM> updates the rendition of each character cell by comparing the 100 character, non-color attributes, and colors. The library applies to 101 following procedure to each cell in the window, whether or not it is 102 blank. 103 104 <STRONG>o</STRONG> <EM>ncurses</EM> first compares the cell's character to the previously 105 specified blank character; if they match, <EM>ncurses</EM> writes the new 106 blank character to the cell. 107 108 <STRONG>o</STRONG> <EM>ncurses</EM> then checks if the cell uses color, that is, its color pair 109 value is nonzero. If not, it simply replaces the attributes and 110 color pair in the cell with those from the new background 111 character. 112 113 <STRONG>o</STRONG> If the cell uses color, and its background color matches that of 114 the current window background, <EM>ncurses</EM> removes attributes that may 115 have come from the current background and adds those from the new 116 background. It finishes by setting the cell's background to use 117 the new window background color. 118 119 <STRONG>o</STRONG> If the cell uses color, and its background color does not match 120 that of the current window background, <EM>ncurses</EM> updates only the 121 non-color attributes, first removing those that may have come from 122 the current background, and then adding attributes from the new 123 background. 124 125 <EM>ncurses</EM> treats a background character value of zero (0) as a blank 126 character. 127 128 If the terminal does not support color, or if color has not been 129 initialized with <STRONG><A HREF="curs_color.3x.html">start_color(3x)</A></STRONG>, <EM>ncurses</EM> ignores the new background 130 character's color attribute. 131 132 133</PRE><H3><a name="h3-bkgrndset_wbkgrndset">bkgrndset, wbkgrndset</a></H3><PRE> 134 <STRONG>bkgrndset</STRONG> and <STRONG>wbkgrndset</STRONG> manipulate the background of the applicable 135 window, without updating the character cells as <STRONG>bkgrnd</STRONG> and <STRONG>wbkgrnd</STRONG> do; 136 only future writes reflect the updated background. 137 138 139</PRE><H3><a name="h3-getbkgrnd_wgetbkgrnd">getbkgrnd, wgetbkgrnd</a></H3><PRE> 140 The <STRONG>getbkgrnd</STRONG> and <STRONG>wgetbkgrnd</STRONG> functions obtain the background character 141 and attribute pair of <STRONG>stdscr</STRONG> or the specified window and store it via 142 the <EM>wch</EM> pointer. 143 144 145</PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE> 146 <STRONG>bkgrndset</STRONG> and <STRONG>wbkgrndset</STRONG> do not return a value. 147 148 The other functions return <STRONG>ERR</STRONG> upon failure and <STRONG>OK</STRONG> upon success. In 149 <EM>ncurses</EM>, failure occurs if 150 151 <STRONG>o</STRONG> a <EM>WINDOW</EM> pointer <EM>win</EM> is null, or 152 153 <STRONG>o</STRONG> a <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM> pointer <EM>wch</EM> is null. 154 155 156</PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE> 157 <STRONG>bkgrnd</STRONG>, <STRONG>bkgrndset</STRONG>, and <STRONG>getbkgrnd</STRONG> may be implemented as macros. 158 159 Unlike their counterparts in the non-"wide" configuration of <EM>ncurses</EM>, 160 <STRONG>getbkgrnd</STRONG> and <STRONG>wgetbkgrnd</STRONG> supply the background character and attribute 161 in a modifiable <EM>cchar</EM><STRONG>_</STRONG><EM>t</EM> parameter, not as the return value. 162 163 164</PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE> 165 X/Open Curses, Issue 4 describes these functions. It specifies no 166 error conditions for them. 167 168 X/Open Curses does not provide details of how the rendition is updated. 169 This implementation follows the approach used in SVr4 <EM>curses</EM>. 170 171 172</PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE> 173 <STRONG><A HREF="curs_bkgd.3x.html">curs_bkgd(3x)</A></STRONG> describes the corresponding functions in the non-"wide" 174 configuration of <EM>ncurses</EM>. 175 176 <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_add_wch.3x.html">curs_add_wch(3x)</A></STRONG>, <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG> 177 178 179 180ncurses 6.5 2024-04-20 <STRONG><A HREF="curs_bkgrnd.3x.html">curs_bkgrnd(3x)</A></STRONG> 181</PRE> 182<div class="nav"> 183<ul> 184<li><a href="#h2-NAME">NAME</a></li> 185<li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li> 186<li><a href="#h2-DESCRIPTION">DESCRIPTION</a> 187<ul> 188<li><a href="#h3-bkgrnd_wbkgrnd">bkgrnd, wbkgrnd</a></li> 189<li><a href="#h3-bkgrndset_wbkgrndset">bkgrndset, wbkgrndset</a></li> 190<li><a href="#h3-getbkgrnd_wgetbkgrnd">getbkgrnd, wgetbkgrnd</a></li> 191</ul> 192</li> 193<li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li> 194<li><a href="#h2-NOTES">NOTES</a></li> 195<li><a href="#h2-PORTABILITY">PORTABILITY</a></li> 196<li><a href="#h2-SEE-ALSO">SEE ALSO</a></li> 197</ul> 198</div> 199</BODY> 200</HTML> 201