]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_bkgd.3x
ncurses 6.1 - patch 20190406
[ncurses.git] / man / curs_bkgd.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: curs_bkgd.3x,v 1.28 2018/12/09 00:45:05 tom Exp $
30 .de bP
31 .ie n  .IP \(bu 4
32 .el    .IP \(bu 2
33 ..
34 .TH curs_bkgd 3X ""
35 .SH NAME
36 \fBbkgdset\fR, \fBwbkgdset\fR,
37 \fBbkgd\fR, \fBwbkgd\fR,
38 \fBgetbkgd\fR \- \fBcurses\fR window background manipulation routines
39 .SH SYNOPSIS
40 \fB#include <curses.h>\fR
41 .PP
42 \fBvoid bkgdset(chtype \fP\fIch\fP\fB);\fR
43 .br
44 \fBvoid wbkgdset(WINDOW *\fP\fIwin, chtype \fP\fIch\fP\fB);\fR
45 .br
46 \fBint bkgd(chtype \fP\fIch\fP\fB);\fR
47 .br
48 \fBint wbkgd(WINDOW *\fP\fIwin\fP\fB, chtype \fP\fIch\fP\fB);\fR
49 .br
50 \fBchtype getbkgd(WINDOW *\fP\fIwin\fP\fB);\fR
51 .br
52 .SH DESCRIPTION
53 .SS bkgdset
54 The \fBbkgdset\fR and \fBwbkgdset\fR routines manipulate the
55 background of the named window.
56 The window background is a \fBchtype\fR consisting of
57 any combination of attributes (i.e., rendition) and a character.
58 The attribute part of the background is combined (OR'ed) with all non-blank
59 characters that are written into the window with \fBwaddch\fR.
60 Both the character and attribute parts of the background are combined with
61 the blank characters.
62 The background becomes a property of the
63 character and moves with the character through any scrolling and
64 insert/delete line/character operations.
65 .PP
66 To the extent possible on a particular terminal,
67 the attribute part of the background is displayed
68 as the graphic rendition of the character put on the screen.
69 .SS bkgd
70 .PP
71 The \fBbkgd\fR and \fBwbkgd\fR functions
72 set the background property of the current or specified window
73 and then apply this setting to every character position in that window.
74 According to X/Open Curses, it should do this:
75 .PP
76 .bP
77 The rendition of every character on the screen is changed to
78 the new background rendition.
79 .bP
80 Wherever the former background character
81 appears, it is changed to the new background character.
82 .PP
83 Neither X/Open Curses nor the SVr4 manual pages give details about
84 the way the rendition of characters on the screen is updated when
85 \fBbkgd\fP or \fBwbkgd\fP is used to change the background character.
86 .PP
87 This implementation, like SVr4 curses, does not store the background
88 and window attribute contributions to each cell separately.
89 It updates the rendition by comparing the character, non-color attributes and
90 colors contained in the background.
91 For each cell in the window, whether or not it is blank:
92 .bP
93 The library first compares the \fIcharacter\fP,
94 and if it matches the current character part of the background,
95 it replaces that with the new background character.
96 .bP
97 The library then checks if the cell uses color,
98 i.e., its color pair value is nonzero.
99 If not, it simply replaces the attributes and color pair in the
100 cell with those from the new background character.
101 .bP
102 If the cell uses color,
103 and that matches the color in the current background,
104 the library removes attributes
105 which may have come from the current background 
106 and adds attributes from the new background.
107 It finishes by setting the cell
108 to use the color from the new background.
109 .bP
110 If the cell uses color,
111 and that does not match the color in the current background,
112 the library updates only the non-color attributes,
113 first removing those which may have come from the current background,
114 and then adding attributes from the new background.
115 .SS getbkgd
116 .PP
117 The \fBgetbkgd\fR function returns the given window's current background
118 character/attribute pair.
119 .SH RETURN VALUE
120 .PP
121 These functions are described in the XSI Curses standard, Issue 4.
122 It specifies that \fBbkgd\fR and \fBwbkgd\fR return \fBERR\fR on failure,
123 but gives no failure conditions.
124 .PP
125 The routines \fBbkgd\fR and \fBwbkgd\fR return the integer \fBOK\fR,
126 unless the library has not been initialized.
127 .PP
128 In contrast,
129 the SVr4.0 manual says \fBbkgd\fR and \fBwbkgd\fR may return \fBOK\fP
130 "or a non-negative integer if \fBimmedok\fR is set",
131 which refers to the return value from \fBwrefresh\fP
132 (used to implement the immediate repainting).
133 The SVr4 curses \fBwrefresh\fP returns the number of characters
134 written to the screen during the refresh.
135 This implementation does not do that.
136 .SH NOTES
137 .PP
138 Note that \fBbkgdset\fR and \fBbkgd\fR may be macros.
139 .PP
140 X/Open Curses mentions that the character part of the background must
141 be a single-byte value.
142 This implementation, like SVr4, checks to ensure that,
143 and will reuse the old background character if the check fails.
144 .SH PORTABILITY
145 .PP
146 These functions are described in the XSI Curses standard, Issue 4
147 (X/Open Curses).
148 .SH SEE ALSO
149 .na
150 .PP
151 \fBcurses\fR(3X),
152 \fBcurs_addch\fR(3X),
153 \fBcurs_attr\fR(3X),
154 \fBcurs_outopts\fR(3X)