source: trunk/doc/html/qbitmap.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 11.6 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qbitmap.cpp:42 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QBitmap Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<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>
33
34<p>The QBitmap class provides monochrome (1-bit depth) pixmaps.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qbitmap-h.html">qbitmap.h</a>&gt;</tt>
37<p>Inherits <a href="qpixmap.html">QPixmap</a>.
38<p><a href="qbitmap-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QBitmap"><b>QBitmap</b></a> ()</li>
42<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>
43<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>
44<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>
45<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>
46<li class=fn><a href="#QBitmap-6"><b>QBitmap</b></a> ( const&nbsp;QBitmap&nbsp;&amp;&nbsp;bitmap )</li>
47<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>
48<li class=fn>QBitmap &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QBitmap&nbsp;&amp;&nbsp;bitmap )</li>
49<li class=fn>QBitmap &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap )</li>
50<li class=fn>QBitmap &amp; <a href="#operator-eq-3"><b>operator=</b></a> ( const&nbsp;QImage&nbsp;&amp;&nbsp;image )</li>
51<li class=fn>QBitmap <a href="#xForm"><b>xForm</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;matrix ) const</li>
52</ul>
53<hr><a name="details"></a><h2>Detailed Description</h2>
54
55
56The QBitmap class provides monochrome (1-bit depth) pixmaps.
57<p>
58
59
60<p> The QBitmap class is a monochrome off-screen paint device used
61mainly for creating custom <a href="qcursor.html">QCursor</a> and <a href="qbrush.html">QBrush</a> objects, in
62<a href="qpixmap.html#setMask">QPixmap::setMask</a>() and for <a href="qregion.html">QRegion</a>.
63<p> A QBitmap is a <a href="qpixmap.html">QPixmap</a> with a <a href="qpixmap.html#depth">depth</a>
64of 1. If a pixmap with a depth greater than 1 is assigned to a
65bitmap, the bitmap will be dithered automatically. A QBitmap is
66guaranteed to always have the depth 1, unless it is
67<a href="qpixmap.html#isNull">QPixmap::isNull</a>() which has depth 0.
68<p> When drawing in a QBitmap (or QPixmap with depth 1), we recommend
69using the <a href="qcolor.html">QColor</a> objects <tt>Qt::color0</tt> and <tt>Qt::color1</tt>.
70Painting with <tt>color0</tt> sets the bitmap bits to 0, and painting
71with <tt>color1</tt> sets the bits to 1. For a bitmap, 0-bits indicate
72background (or transparent) and 1-bits indicate foreground (or
73opaque). Using the <tt>black</tt> and <tt>white</tt> QColor objects make no
74sense because the <a href="qcolor.html#pixel">QColor::pixel</a>() value is not necessarily 0 for
75black and 1 for white.
76<p> The QBitmap can be transformed (translated, scaled, sheared or
77rotated) using <a href="#xForm">xForm</a>().
78<p> Just like the <a href="qpixmap.html">QPixmap</a> class, QBitmap is optimized by the use of
79<a href="shclass.html">implicit sharing</a>, so it is very
80efficient to pass QBitmap objects as arguments.
81<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>.
82
83<hr><h2>Member Function Documentation</h2>
84<h3 class=fn><a name="QBitmap"></a>QBitmap::QBitmap ()
85</h3>
86Constructs a null bitmap.
87<p> <p>See also <a href="qpixmap.html#isNull">QPixmap::isNull</a>().
88
89<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 )
90</h3>
91Constructs a bitmap with width <em>w</em> and height <em>h</em>.
92<p> The contents of the bitmap is uninitialized if <em>clear</em> is FALSE;
93otherwise it is filled with pixel value 0 (the <a href="qcolor.html">QColor</a> <tt>Qt::color0</tt>).
94<p> The optional <em>optimization</em> argument specifies the optimization
95setting for the bitmap. The default optimization should be used in
96most cases. Games and other pixmap-intensive applications may
97benefit from setting this argument; see <a href="qpixmap.html#Optimization-enum">QPixmap::Optimization</a>.
98<p> <p>See also <a href="qpixmap.html#setOptimization">QPixmap::setOptimization</a>() and <a href="qpixmap.html#setDefaultOptimization">QPixmap::setDefaultOptimization</a>().
99
100<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 )
101</h3>
102This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
103<p> Constructs a bitmap with the size <em>size</em>.
104<p> The contents of the bitmap is uninitialized if <em>clear</em> is FALSE;
105otherwise it is filled with pixel value 0 (the <a href="qcolor.html">QColor</a> <tt>Qt::color0</tt>).
106<p> The optional <em>optimization</em> argument specifies the optimization
107setting for the bitmap. The default optimization should be used in
108most cases. Games and other pixmap-intensive applications may
109benefit from setting this argument; see <a href="qpixmap.html#Optimization-enum">QPixmap::Optimization</a>.
110
111<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 )
112</h3>
113Constructs a bitmap with width <em>w</em> and height <em>h</em> and sets the
114contents to <em>bits</em>.
115<p> The <em>isXbitmap</em> flag should be TRUE if <em>bits</em> was generated by
116the X11 bitmap program. The X bitmap bit order is little endian.
117The <a href="qimage.html">QImage</a> documentation discusses bit order of monochrome images.
118<p> Example (creates an arrow bitmap):
119<pre>
120 uchar arrow_bits[] = { 0x3f, 0x1f, 0x0f, 0x1f, 0x3b, 0x71, 0xe0, 0xc0 };
121 QBitmap bm( 8, 8, arrow_bits, TRUE );
122 </pre>
123
124
125<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 )
126</h3>
127This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
128<p> Constructs a bitmap with the size <em>size</em> and sets the contents to
129<em>bits</em>.
130<p> The <em>isXbitmap</em> flag should be TRUE if <em>bits</em> was generated by
131the X11 bitmap program. The X bitmap bit order is little endian.
132The <a href="qimage.html">QImage</a> documentation discusses bit order of monochrome images.
133
134<h3 class=fn><a name="QBitmap-6"></a>QBitmap::QBitmap ( const&nbsp;<a href="qbitmap.html">QBitmap</a>&nbsp;&amp;&nbsp;bitmap )
135</h3>
136Constructs a bitmap that is a copy of <em>bitmap</em>.
137
138<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 )
139</h3>
140Constructs a bitmap from the file <em>fileName</em>. If the file does
141not exist or is of an unknown format, the bitmap becomes a null
142bitmap.
143<p> The parameters <em>fileName</em> and <em>format</em> are passed on to
144<a href="qpixmap.html#load">QPixmap::load</a>(). Dithering will be performed if the file format
145uses more than 1 bit per pixel.
146<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>().
147
148<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 )
149</h3>
150Assigns the bitmap <em>bitmap</em> to this bitmap and returns a
151reference to this bitmap.
152
153<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 )
154</h3>
155This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
156<p> Assigns the pixmap <em>pixmap</em> to this bitmap and returns a
157reference to this bitmap.
158<p> Dithering will be performed if the pixmap has a <a href="qpixmap.html#depth">QPixmap::depth</a>()
159greater than 1.
160
161<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 )
162</h3>
163This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
164<p> Converts the image <em>image</em> to a bitmap and assigns the result to
165this bitmap. Returns a reference to the bitmap.
166<p> Dithering will be performed if the image has a <a href="qimage.html#depth">QImage::depth</a>()
167greater than 1.
168
169<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
170</h3>
171Returns a transformed copy of this bitmap by using <em>matrix</em>.
172<p> This function does exactly the same as <a href="qpixmap.html#xForm">QPixmap::xForm</a>(), except
173that it returns a QBitmap instead of a <a href="qpixmap.html">QPixmap</a>.
174<p> <p>See also <a href="qpixmap.html#xForm">QPixmap::xForm</a>().
175
176<!-- eof -->
177<hr><p>
178This file is part of the <a href="index.html">Qt toolkit</a>.
179Copyright &copy; 1995-2007
180<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
181<table width=100% cellspacing=0 border=0><tr>
182<td>Copyright &copy; 2007
183<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
184<td align=right><div align=right>Qt 3.3.8</div>
185</table></div></address></body>
186</html>
Note: See TracBrowser for help on using the repository browser.