1 .\"***************************************************************************
2 .\" Copyright 2018-2022,2023 Thomas E. Dickey *
3 .\" Copyright 2002-2015,2017 Free Software Foundation, Inc. *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a *
6 .\" copy of this software and associated documentation files (the *
7 .\" "Software"), to deal in the Software without restriction, including *
8 .\" without limitation the rights to use, copy, modify, merge, publish, *
9 .\" distribute, distribute with modifications, sublicense, and/or sell *
10 .\" copies of the Software, and to permit persons to whom the Software is *
11 .\" furnished to do so, subject to the following conditions: *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 .\" Except as contained in this notice, the name(s) of the above copyright *
25 .\" holders shall not be used in advertising or otherwise to promote the *
26 .\" sale, use or other dealings in this Software without prior written *
28 .\"***************************************************************************
30 .\" $Id: curs_bkgrnd.3x,v 1.36 2023/12/23 16:35:10 tom Exp $
31 .TH curs_bkgrnd 3X 2023-12-23 "ncurses 6.4" "Library calls"
54 manipulate background of a \fIcurses\fP window of wide characters
57 \fB#include <curses.h>
59 \fBint bkgrnd(const cchar_t *\fIwch\fP);
60 \fBint wbkgrnd(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
62 \fBvoid bkgrndset(const cchar_t *\fIwch\fP);
63 \fBvoid wbkgrndset(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
65 \fBint getbkgrnd(cchar_t *\fIwch\fP);
66 \fBint wgetbkgrnd(WINDOW *\fIwin\fP, cchar_t *\fIwch\fP);
74 (in the library's \*(``wide\*('' configuration)
77 combining a set of attributes
78 (see \fB\%curs_attr\fP(3X))
79 with a complex character called the
82 The blank character is a spacing character that populates a window's
83 character cells when their contents are erased without replacement.
84 The background's attributes are combined with all non-blank characters
85 written to the window,
86 as with the \fB\%wadd_wch\fP(3X) and \fB\%wins_wch\fP(3X) families of
89 The blank character and attributes of the background combine with
90 characters written to the window as described below.
91 The background becomes a property of the character and moves with it
92 through any scrolling and insert/delete line/character operations.
94 To the extent possible on a given terminal,
95 the attribute part of the background is displayed as the graphic
96 rendition of the character put on the screen.
98 \fB\%bkgrnd\fP and \fB\%wbkgrnd\fP set the background property of
99 \fB\%stdscr\fP or the specified window and then apply this setting to
100 every character cell in that window.
102 The rendition of every character in the window changes to the new
103 background rendition.
105 Wherever the former background character appears,
106 it changes to the new background character.
109 updates the rendition of each character cell by comparing the character,
110 non-color attributes,
112 The library applies to following procedure to each cell in the window,
113 whether or not it is blank.
116 first compares the cell's character to the previously specified blank
120 writes the new blank character to the cell.
123 then checks if the cell uses color,
125 its color pair value is nonzero.
127 it simply replaces the attributes and color pair in the cell with those
128 from the new background character.
130 If the cell uses color,
131 and its background color matches that of the current window background,
133 removes attributes that may have come from the current background and
134 adds those from the new background.
135 It finishes by setting the cell's background to use the new window
138 If the cell uses color,
139 and its background color does not match that of the current window
142 updates only the non-color attributes,
143 first removing those that may have come from the current background,
144 and then adding attributes from the new background.
147 treats a background character value of zero (0) as a blank character.
149 If the terminal does not support color,
150 or if color has not been initialized with \fB\%start_color\fP(3X),
152 ignores the new background character's color attribute.
153 .SS "bkgrndset, wbkgrndset"
154 \fB\%bkgrndset\fP and \fB\%wbkgrndset\fP manipulate the background of
155 the applicable window,
156 without updating the character cells as \fB\%bkgrnd\fP and
158 only future writes reflect the updated background.
159 .SS "getbkgrnd, wgetbkgrnd"
160 The \fB\%getbkgrnd\fP and \fB\%wgetbkgrnd\fP functions obtain the
161 background character and attribute pair of \fB\%stdscr\fP or the
162 specified window and store it via the
166 \fBbkgrndset\fP and \fBwbkgrndset\fP do not return a value.
168 The other functions return
190 \fB\%bkgrndset\fP, and
192 may be implemented as macros.
194 Unlike their counterparts in the non-\*(``wide\*('' configuration of
196 \fB\%getbkgrnd\fP and \fB\%wgetbkgrnd\fP supply the background character
197 and attribute in a modifiable
200 not as the return value.
202 X/Open Curses, Issue 4, describes these functions.
203 It specifies no error conditions for them.
205 X/Open Curses does not provide details of how the rendition is updated.
206 This implementation follows the approach used in SVr4
209 \fB\%curs_bkgd\fP(3X) describes the corresponding functions in the
210 non-\*(``wide\*('' configuration of
214 \fB\%curs_add_wch\fP(3X),
215 \fB\%curs_attr\fP(3X)