]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_bkgrnd.3x
ncurses 6.4 - patch 20231217
[ncurses.git] / man / curs_bkgrnd.3x
1 .\"***************************************************************************
2 .\" Copyright 2018-2022,2023 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.35 2023/12/16 23:00:21 tom Exp $
31 .TH curs_bkgrnd 3X 2023-12-16 "ncurses 6.4" "Library calls"
32 .ie \n(.g \{\
33 .ds `` \(lq
34 .ds '' \(rq
35 .\}
36 .el \{\
37 .ie t .ds `` ``
38 .el   .ds `` ""
39 .ie t .ds '' ''
40 .el   .ds '' ""
41 .\}
42 .
43 .de bP
44 .ie n  .IP \(bu 4
45 .el    .IP \(bu 2
46 ..
47 .SH NAME
48 \fB\%bkgrnd\fP,
49 \fB\%wbkgrnd\fP,
50 \fB\%bkgrndset\fP,
51 \fB\%wbkgrndset\fP,
52 \fB\%getbkgrnd\fP,
53 \fB\%wgetbkgrnd\fP \-
54 manipulate background of a \fIcurses\fP window of wide characters
55 .SH SYNOPSIS
56 .nf
57 \fB#include <curses.h>
58 .PP
59 \fBint bkgrnd(const cchar_t *\fIwch\fP);
60 \fBint wbkgrnd(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
61 .PP
62 \fBvoid bkgrndset(const cchar_t *\fIwch\fP);
63 \fBvoid wbkgrndset(WINDOW *\fIwin\fP, const cchar_t *\fIwch\fP);
64 .PP
65 \fBint getbkgrnd(cchar_t *\fIwch\fP);
66 \fBint wgetbkgrnd(WINDOW *\fIwin\fP, cchar_t *\fIwch\fP);
67 .fi
68 .SH DESCRIPTION
69 The
70 .I background
71 of a
72 .I curses
73 window
74 (in the library's \*(``wide\*('' configuration)
75 is a
76 .I \%cchar_t
77 combining a set of attributes
78 (see \fB\%curs_attr\fP(3X))
79 with a complex character called the
80 .I "blank character."
81 .PP
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
87 functions.
88 .PP
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.
93 .PP
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.
97 .SS "bkgrnd, wbkgrnd"
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.
101 .bP
102 The rendition of every character in the window changes to the new
103 background rendition.
104 .bP
105 Wherever the former background character appears,
106 it changes to the new background character.
107 .PP
108 .I \%ncurses
109 updates the rendition of each character cell by comparing the character,
110 non-color attributes,
111 and colors.
112 The library applies to following procedure to each cell in the window,
113 whether or not it is blank.
114 .bP
115 .I \%ncurses
116 first compares the cell's character to the previously specified blank
117 character;
118 if they match,
119 .I \%ncurses
120 writes the new blank character to the cell.
121 .bP
122 .I \%ncurses
123 then checks if the cell uses color,
124 that is,
125 its color pair value is nonzero.
126 If not,
127 it simply replaces the attributes and color pair in the cell with those
128 from the new background character.
129 .bP
130 If the cell uses color,
131 and its background color matches that of the current window background,
132 .I \%ncurses
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
136 background color.
137 .bP
138 If the cell uses color,
139 and its background color does not match that of the current window
140 background,
141 .I \%ncurses
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.
145 .PP
146 .I \%ncurses
147 treats a background character value of zero (0) as a blank character.
148 .PP
149 If the terminal does not support color,
150 or if color has not been initialized with \fB\%start_color\fP(3X),
151 .I \%ncurses
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
157 \fB\%wbkgrnd\fP do;
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
163 .I wch
164 pointer.
165 .SH RETURN VALUE
166 \fBbkgrndset\fP and \fBwbkgrndset\fP do not return a value.
167 .PP
168 The other functions return
169 .B ERR
170 upon failure and
171 .B OK
172 upon success.
173 In
174 .I \%ncurses,
175 failure occurs if
176 .bP
177 a
178 .I \%WINDOW
179 pointer
180 .I win
181 is null, or
182 .bP
183 a
184 .I \%cchar_t
185 pointer
186 .I wch
187 is null.
188 .SH NOTES
189 \fB\%bkgrnd\fP,
190 \fB\%bkgrndset\fP, and
191 \fB\%getbkgrnd\fP
192 may be available as macros.
193 .PP
194 Unlike their counterparts in the non-\*(``wide\*('' configuration of
195 .I \%ncurses,
196 \fB\%getbkgrnd\fP and \fB\%wgetbkgrnd\fP supply the background character
197 and attribute in a modifiable
198 .I \%cchar_t
199 parameter,
200 not as the return value.
201 .SH PORTABILITY
202 X/Open Curses, Issue 4, describes these functions.
203 It specifies no error conditions for them.
204 .PP
205 X/Open Curses does not provide details of how the rendition is updated.
206 This implementation follows the approach used in SVr4
207 .I curses.
208 .SH SEE ALSO
209 \fB\%curs_bkgd\fP(3X) describes the corresponding functions in the
210 non-\*(``wide\*('' configuration of
211 .I \%ncurses.
212 .PP
213 \fB\%curses\fP(3X),
214 \fB\%curs_add_wch\fP(3X),
215 \fB\%curs_attr\fP(3X)