Debian Codegraph @

upstream/debian-unstable/man3/bkgrnd.3ncurses

raw
1 .\"***************************************************************************
2 .\" Copyright 2018-2024,2025 Thomas E. Dickey *
3 .\" Copyright 2002-2015,2017 Free Software Foundation, Inc. *
4 .\" *
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: *
12 .\" *
13 .\" The above copyright notice and this permission notice shall be included *
14 .\" in all copies or substantial portions of the Software. *
15 .\" *
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. *
23 .\" *
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 *
27 .\" authorization. *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_bkgrnd.3x,v 1.60 2025/08/23 22:39:20 tom Exp $
31 .TH bkgrnd 3NCURSES 2025-08-23 "ncurses 6.6" "Library calls"
32 .de bP
33 .ie n .IP \(bu 4
34 .el .IP \(bu 2
35 ..
36 .SH NAME
37 \fB\%bkgrnd\fP,
38 \fB\%wbkgrnd\fP,
39 \fB\%bkgrndset\fP,
40 \fB\%wbkgrndset\fP,
41 \fB\%getbkgrnd\fP,
42 \fB\%wgetbkgrnd\fP \-
43 manipulate background of a \fIcurses\fP window of wide characters
44 .SH SYNOPSIS
45 .nf
46 \fB#include <curses.h>
47 .PP
48 \fBint bkgrnd(const cchar_t *\fIwch\fP);
49 \fBint wbkgrnd(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
50 .PP
51 \fBvoid bkgrndset(const cchar_t *\fIwch\fP);
52 \fBvoid wbkgrndset(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
53 .PP
54 \fBint getbkgrnd(cchar_t *\fIwch\fP);
55 \fBint wgetbkgrnd(WINDOW *\fIwin\fP, cchar_t *\fIwch\fP);
56 .fi
57 .SH DESCRIPTION
58 Every
59 .I curses
60 window has a
61 .I "background character"
62 property:
63 in the library's wide configuration,
64 it is a
65 .I curses
66 complex character
67 .RI \%( cchar_t )
68 that combines a set of attributes
69 (and,
70 if colors are enabled,
71 a color pair identifier)
72 with a character code.
73 When erasing
74 (parts of)
75 a window,
76 .I curses
77 replaces the erased cells with the background character.
78 .PP
79 .I curses
80 also uses the background character when writing characters to a
81 populated window.
82 .bP
83 The attribute part of the background character combines with all
84 non-blank character cells in the window,
85 as populated by the \fB\%wadd_wch\fP(3NCURSES) and \fB\%wins_wch\fP(3NCURSES)
86 families of functions
87 (and those that call them).
88 .bP
89 Both the character code and attributes of the background character
90 combine with blank character cells in the window.
91 .PP
92 The background character's set of attributes becomes a property
93 of the character cell
94 and move with it through any scrolling
95 and insert/delete line/character operations.
96 To the extent possible on the terminal type,
97 .I curses
98 displays the attributes of the background character
99 as the graphic rendition of a character cell on the display.
100 .SS "bkgrnd, wbkgrnd"
101 .B \%bkgrnd
102 and
103 .B \%wbkgrnd
104 set the background property of
105 .B \%stdscr
106 or the specified window and then apply this setting to
107 every character cell in that window.
108 .bP
109 The rendition of every character in the window changes to the new
110 background rendition.
111 .bP
112 Wherever the former background character appears,
113 it changes to the new background character.
114 .PP
115 .I \%ncurses
116 updates the rendition of each character cell by comparing the character,
117 non-color attributes,
118 and color pair selection.
119 The library applies to following procedure to each cell in the window,
120 whether or not it is blank.
121 .bP
122 .I \%ncurses
123 first compares the cell's character to the previously specified
124 background character;
125 if they match,
126 .I \%ncurses
127 writes the new background character to the cell.
128 .bP
129 .I \%ncurses
130 then checks whether the cell uses color;
131 that is,
132 its color pair value is nonzero.
133 If not,
134 it simply replaces the attributes and color pair in the cell with those
135 from the new background character.
136 .bP
137 If the cell uses color,
138 and its background color matches that of the current window background,
139 .I \%ncurses
140 removes attributes that may have come from the current background and
141 adds those from the new background.
142 It finishes by setting the cell's background to use the new window
143 background color.
144 .bP
145 If the cell uses color,
146 and its background color does not match that of the current window
147 background,
148 .I \%ncurses
149 updates only the non-color attributes,
150 first removing those that may have come from the current background,
151 and then adding attributes from the new background.
152 .PP
153 If the new background's character is non-spacing,
154 .I \%ncurses
155 reuses the old background character,
156 except for one special case:
157 .I \%ncurses
158 treats a background character code of zero (0) as a space.
159 .PP
160 If the terminal does not support color,
161 or if color has not been initialized with \fB\%start_color\fP(3NCURSES),
162 .I \%ncurses
163 ignores the new background character's color pair selection.
164 .SS "bkgrndset, wbkgrndset"
165 .B \%bkgrndset
166 and
167 .B \%wbkgrndset
168 manipulate the background of the applicable window,
169 without updating the character cells as
170 .B \%bkgrnd
171 and
172 .B \%wbkgrnd
173 do;
174 only future writes reflect the updated background.
175 .SS "getbkgrnd, wgetbkgrnd"
176 .B \%getbkgrnd
177 and
178 .B \%wgetbkgrnd
179 respectively obtain
180 .BR \%stdscr 's
181 or the given window's background character,
182 attributes,
183 and color pair,
184 and store it in their
185 .I wch
186 argument.
187 .SH RETURN VALUE
188 .B \%bkgrndset
189 and
190 .B \%wbkgrndset
191 do not return a value.
192 .PP
193 Functions returning an
194 .I int
195 return
196 .B ERR
197 upon failure and
198 .B OK
199 upon success.
200 In
201 .IR \%ncurses ","
202 failure occurs if
203 .bP
204 the
205 .I curses
206 screen has not been initialized,
207 .bP
208 .I win
209 is
210 .IR NULL ","
211 or
212 .bP
213 .I wch
214 is
215 .IR NULL "."
216 .SH NOTES
217 .BR \%bkgrnd ","
218 .BR \%bkgrndset ","
219 and
220 .B \%getbkgrnd
221 may be implemented as macros.
222 .PP
223 Unlike their counterparts in the non-wide-character configuration of
224 .IR \%ncurses ","
225 .B \%getbkgrnd
226 and
227 .B \%wgetbkgrnd
228 store the background character in a modifiable
229 .I \%cchar_t
230 parameter,
231 rather than supplying it as the return value.
232 .SH PORTABILITY
233 X/Open Curses Issue\ 4 describes these functions.
234 It specifies no error conditions for them.
235 .PP
236 X/Open Curses does not provide details of how the rendition is updated.
237 .I \%ncurses
238 follows the approach used in SVr4
239 .IR curses 's
240 non-wide functions for manipulating the window background.
241 .SH HISTORY
242 X/Open Curses Issue\ 4 (1995) initially specified these functions.
243 .SH SEE ALSO
244 \fB\%bkgd\fP(3NCURSES) describes the corresponding functions in the
245 non-wide-character configuration of
246 .IR \%ncurses "."
247 .PP
248 \fB\%ncurses\fP(3NCURSES),
249 \fB\%add_wch\fP(3NCURSES),
250 \fB\%attr\fP(3NCURSES)