summaryrefslogtreecommitdiffstats
path: root/doc/html/qbitmap.html
blob: 59dabe5bf45c6107e1583bcb6df30244f44fd6fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qbitmap.cpp:42 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QBitmap Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QBitmap Class Reference</h1>

<p>The QBitmap class provides monochrome (1-bit depth) pixmaps.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qbitmap-h.html">qbitmap.h</a>&gt;</tt>
<p>Inherits <a href="qpixmap.html">QPixmap</a>.
<p><a href="qbitmap-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QBitmap"><b>QBitmap</b></a> ()</li>
<li class=fn><a href="#QBitmap-2"><b>QBitmap</b></a> ( int&nbsp;w, int&nbsp;h, bool&nbsp;clear = FALSE, QPixmap::Optimization&nbsp;optimization = QPixmap::DefaultOptim )</li>
<li class=fn><a href="#QBitmap-3"><b>QBitmap</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;size, bool&nbsp;clear = FALSE, QPixmap::Optimization&nbsp;optimization = QPixmap::DefaultOptim )</li>
<li class=fn><a href="#QBitmap-4"><b>QBitmap</b></a> ( int&nbsp;w, int&nbsp;h, const&nbsp;uchar&nbsp;*&nbsp;bits, bool&nbsp;isXbitmap = FALSE )</li>
<li class=fn><a href="#QBitmap-5"><b>QBitmap</b></a> ( const&nbsp;QSize&nbsp;&amp;&nbsp;size, const&nbsp;uchar&nbsp;*&nbsp;bits, bool&nbsp;isXbitmap = FALSE )</li>
<li class=fn><a href="#QBitmap-6"><b>QBitmap</b></a> ( const&nbsp;QBitmap&nbsp;&amp;&nbsp;bitmap )</li>
<li class=fn><a href="#QBitmap-7"><b>QBitmap</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0 )</li>
<li class=fn>QBitmap &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QBitmap&nbsp;&amp;&nbsp;bitmap )</li>
<li class=fn>QBitmap &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap )</li>
<li class=fn>QBitmap &amp; <a href="#operator-eq-3"><b>operator=</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image )</li>
<li class=fn>QBitmap <a href="#xForm"><b>xForm</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;matrix ) const</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QBitmap class provides monochrome (1-bit depth) pixmaps.
<p> 


<p> The QBitmap class is a monochrome off-screen paint device used
mainly for creating custom <a href="qcursor.html">QCursor</a> and <a href="qbrush.html">QBrush</a> objects, in
<a href="qpixmap.html#setMask">QPixmap::setMask</a>() and for <a href="qregion.html">QRegion</a>.
<p> A QBitmap is a <a href="qpixmap.html">QPixmap</a> with a <a href="qpixmap.html#depth">depth</a>
of 1. If a pixmap with a depth greater than 1 is assigned to a
bitmap, the bitmap will be dithered automatically. A QBitmap is
guaranteed to always have the depth 1, unless it is
<a href="qpixmap.html#isNull">QPixmap::isNull</a>() which has depth 0.
<p> When drawing in a QBitmap (or QPixmap with depth 1), we recommend
using the  <a href="qcolor.html">QColor</a> objects <tt>Qt::color0</tt> and <tt>Qt::color1</tt>.
Painting with <tt>color0</tt> sets the bitmap bits to 0, and painting
with <tt>color1</tt> sets the bits to 1. For a bitmap, 0-bits indicate
background (or transparent) and 1-bits indicate foreground (or
opaque). Using the <tt>black</tt> and <tt>white</tt> QColor objects make no
sense because the <a href="qcolor.html#pixel">QColor::pixel</a>() value is not necessarily 0 for
black and 1 for white.
<p> The QBitmap can be transformed (translated, scaled, sheared or
rotated) using <a href="#xForm">xForm</a>().
<p> Just like the <a href="qpixmap.html">QPixmap</a> class, QBitmap is optimized by the use of
<a href="shclass.html">implicit sharing</a>, so it is very
efficient to pass QBitmap objects as arguments.
<p> <p>See also <a href="qpixmap.html">QPixmap</a>, <a href="qpainter.html#drawPixmap">QPainter::drawPixmap</a>(), <a href="qpaintdevice.html#bitBlt">bitBlt</a>(), <a href="shclass.html">Shared Classes</a>, <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.

<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QBitmap"></a>QBitmap::QBitmap ()
</h3>
Constructs a null bitmap.
<p> <p>See also <a href="qpixmap.html#isNull">QPixmap::isNull</a>().

<h3 class=fn><a name="QBitmap-2"></a>QBitmap::QBitmap ( int&nbsp;w, int&nbsp;h, bool&nbsp;clear = FALSE, <a href="qpixmap.html#Optimization-enum">QPixmap::Optimization</a>&nbsp;optimization = QPixmap::DefaultOptim )
</h3>
Constructs a bitmap with width <em>w</em> and height <em>h</em>.
<p> The contents of the bitmap is uninitialized if <em>clear</em> is FALSE;
otherwise it is filled with pixel value 0 (the <a href="qcolor.html">QColor</a> <tt>Qt::color0</tt>).
<p> The optional <em>optimization</em> argument specifies the optimization
setting for the bitmap. The default optimization should be used in
most cases. Games and other pixmap-intensive applications may
benefit from setting this argument; see <a href="qpixmap.html#Optimization-enum">QPixmap::Optimization</a>.
<p> <p>See also <a href="qpixmap.html#setOptimization">QPixmap::setOptimization</a>() and <a href="qpixmap.html#setDefaultOptimization">QPixmap::setDefaultOptimization</a>().

<h3 class=fn><a name="QBitmap-3"></a>QBitmap::QBitmap ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;size, bool&nbsp;clear = FALSE, <a href="qpixmap.html#Optimization-enum">QPixmap::Optimization</a>&nbsp;optimization = QPixmap::DefaultOptim )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Constructs a bitmap with the size <em>size</em>.
<p> The contents of the bitmap is uninitialized if <em>clear</em> is FALSE;
otherwise it is filled with pixel value 0 (the <a href="qcolor.html">QColor</a> <tt>Qt::color0</tt>).
<p> The optional <em>optimization</em> argument specifies the optimization
setting for the bitmap. The default optimization should be used in
most cases. Games and other pixmap-intensive applications may
benefit from setting this argument; see <a href="qpixmap.html#Optimization-enum">QPixmap::Optimization</a>.

<h3 class=fn><a name="QBitmap-4"></a>QBitmap::QBitmap ( int&nbsp;w, int&nbsp;h, const&nbsp;uchar&nbsp;*&nbsp;bits, bool&nbsp;isXbitmap = FALSE )
</h3>
Constructs a bitmap with width <em>w</em> and height <em>h</em> and sets the
contents to <em>bits</em>.
<p> The <em>isXbitmap</em> flag should be TRUE if <em>bits</em> was generated by
the X11 bitmap program. The X bitmap bit order is little endian.
The <a href="qimage.html">QImage</a> documentation discusses bit order of monochrome images.
<p> Example (creates an arrow bitmap):
<pre>
        uchar arrow_bits[] = { 0x3f, 0x1f, 0x0f, 0x1f, 0x3b, 0x71, 0xe0, 0xc0 };
        QBitmap bm( 8, 8, arrow_bits, TRUE );
    </pre>
 

<h3 class=fn><a name="QBitmap-5"></a>QBitmap::QBitmap ( const&nbsp;<a href="qsize.html">QSize</a>&nbsp;&amp;&nbsp;size, const&nbsp;uchar&nbsp;*&nbsp;bits, bool&nbsp;isXbitmap = FALSE )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Constructs a bitmap with the size <em>size</em> and sets the contents to
<em>bits</em>.
<p> The <em>isXbitmap</em> flag should be TRUE if <em>bits</em> was generated by
the X11 bitmap program. The X bitmap bit order is little endian.
The <a href="qimage.html">QImage</a> documentation discusses bit order of monochrome images.

<h3 class=fn><a name="QBitmap-6"></a>QBitmap::QBitmap ( const&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;&amp;&nbsp;bitmap )
</h3>
Constructs a bitmap that is a copy of <em>bitmap</em>.

<h3 class=fn><a name="QBitmap-7"></a>QBitmap::QBitmap ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0 )
</h3>
Constructs a bitmap from the file <em>fileName</em>. If the file does
not exist or is of an unknown format, the bitmap becomes a null
bitmap.
<p> The parameters <em>fileName</em> and <em>format</em> are passed on to
<a href="qpixmap.html#load">QPixmap::load</a>(). Dithering will be performed if the file format
uses more than 1 bit per pixel.
<p> <p>See also <a href="qpixmap.html#isNull">QPixmap::isNull</a>(), <a href="qpixmap.html#load">QPixmap::load</a>(), <a href="qpixmap.html#loadFromData">QPixmap::loadFromData</a>(), <a href="qpixmap.html#save">QPixmap::save</a>(), and <a href="qpixmap.html#imageFormat">QPixmap::imageFormat</a>().

<h3 class=fn><a href="qbitmap.html">QBitmap</a>&nbsp;&amp; <a name="operator-eq"></a>QBitmap::operator= ( const&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;&amp;&nbsp;bitmap )
</h3>
Assigns the bitmap <em>bitmap</em> to this bitmap and returns a
reference to this bitmap.

<h3 class=fn><a href="qbitmap.html">QBitmap</a>&nbsp;&amp; <a name="operator-eq-2"></a>QBitmap::operator= ( const&nbsp;<a href="qpixmap.html">QPixmap</a>&nbsp;&amp;&nbsp;pixmap )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Assigns the pixmap <em>pixmap</em> to this bitmap and returns a
reference to this bitmap.
<p> Dithering will be performed if the pixmap has a <a href="qpixmap.html#depth">QPixmap::depth</a>()
greater than 1.

<h3 class=fn><a href="qbitmap.html">QBitmap</a>&nbsp;&amp; <a name="operator-eq-3"></a>QBitmap::operator= ( const&nbsp;<a href="qimage.html">QImage</a>&nbsp;&amp;&nbsp;image )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Converts the image <em>image</em> to a bitmap and assigns the result to
this bitmap. Returns a reference to the bitmap.
<p> Dithering will be performed if the image has a <a href="qimage.html#depth">QImage::depth</a>()
greater than 1.

<h3 class=fn><a href="qbitmap.html">QBitmap</a> <a name="xForm"></a>QBitmap::xForm ( const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;matrix ) const
</h3>
Returns a transformed copy of this bitmap by using <em>matrix</em>.
<p> This function does exactly the same as <a href="qpixmap.html#xForm">QPixmap::xForm</a>(), except
that it returns a QBitmap instead of a <a href="qpixmap.html">QPixmap</a>.
<p> <p>See also <a href="qpixmap.html#xForm">QPixmap::xForm</a>().

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>