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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Qt Toolkit - QBitmap Class</title><style type="text/css"><!--
h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }
--></style>
</head><body bgcolor="#ffffff">
<table width="100%">
<tr><td><a href="index.html">
<img width="100" height="100" src="qtlogo.png"
alt="Home" border="0"><img width="100"
height="100" src="face.png" alt="Home" border="0">
</a><td valign=top><div align=right><img src="dochead.png" width="472" height="27"><br>
<a href="classes.html"><b>Classes</b></a>
-<a href="annotated.html">Annotated</a>
- <a href="hierarchy.html">Tree</a>
-<a href="functions.html">Functions</a>
-<a href="index.html">Home</a>
-<a href="topicals.html"><b>Structure</b></a>
</div>
</table>
<h1 align=center>QBitmap Class Reference</h1><br clear="all">
<p>
The QBitmap class provides monochrome (1 bit depth) pixmaps.
<a href="#details">More...</a>
<p>
<code>#include <<a href="qbitmap-h.html">qbitmap.h</a>></code>
<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><div class="fn"><a href="#353e84"><b>QBitmap</b></a>()</div>
<li><div class="fn"><a href="#12bed2"><b>QBitmap</b></a>(intw, inth, boolclear=FALSE, QPixmap::Optimization=QPixmap::DefaultOptim)</div>
<li><div class="fn"><a href="#2c4ff2"><b>QBitmap</b></a>(constQSize&, boolclear=FALSE, QPixmap::Optimization=QPixmap::DefaultOptim)</div>
<li><div class="fn"><a href="#c9b25d"><b>QBitmap</b></a>(intw, inth, constuchar*bits, boolisXbitmap=FALSE)</div>
<li><div class="fn"><a href="#29fa2b"><b>QBitmap</b></a>(constQSize&, constuchar*bits, boolisXbitmap=FALSE)</div>
<li><div class="fn"><a href="#9ee1bb"><b>QBitmap</b></a>(constQBitmap&)</div>
<li><div class="fn"><a href="#28e426"><b>QBitmap</b></a>(constQString&fileName, constchar*format=0)</div>
<li><div class="fn">QBitmap&<a href="#6d398d"><b>operator=</b></a>(constQBitmap&)</div>
<li><div class="fn">QBitmap&<a href="#57c2bf"><b>operator=</b></a>(constQPixmap&)</div>
<li><div class="fn">QBitmap&<a href="#cd1e18"><b>operator=</b></a>(constQImage&)</div>
<li><div class="fn">QBitmap<a href="#33c04b"><b>xForm</b></a>(constQWMatrix&)const</div>
</ul>
<hr><h2><a name="details"></a>Detailed Description</h2>
The QBitmap class provides monochrome (1 bit depth) pixmaps.
<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#68a75d">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#3c91c2">QPixmap::depth</a>() of 1.
If a pixmap with a depth greater than 1 is assigned to a bitmap, the
bitmap will be automatically dithered. A QBitmap is guaranteed to always
have the depth 1, unless it is <a href="qpixmap.html#7803c4">QPixmap::isNull</a>() (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 <code>Qt::color0</code> and <code>Qt::color1.</code> Painting with <code>color0</code> sets the bitmap bits to 0, and painting with <code>color1</code> sets the
bits to 1. For a bitmap, 0-bits indicate background (or white) and
1-bits indicate foreground (or black). Using the <code>black</code> and <code>white</code>
QColor objects make no sense, because the <a href="qcolor.html#4cec2b">QColor::pixel</a>()
value is not necessarily 0 for black and 1 for white.
<p>Just like the QPixmap 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>See also <a href="qpixmap.html">QPixmap</a>, <a href="qpainter.html#c64b89">QPainter::drawPixmap</a>(), <a href="qpaintdevice.html#35ae2e">bitBlt</a>() and <a href="shclass.html">Shared Classes</a>
<p>Examples:
<a href="cursor-cursor-cpp.html#QBitmap">cursor/cursor.cpp</a>
<hr><h2>Member Function Documentation</h2>
<h3 class="fn"><a name="353e84"></a>QBitmap::QBitmap()</h3>
<p>Constructs a null bitmap.
<p>See also <a href="qpixmap.html#7803c4">QPixmap::isNull</a>().
<h3 class="fn"><a name="28e426"></a>QBitmap::QBitmap(const<a href="qstring.html">QString</a>&fileName, constchar*format=0)</h3>
<p>Constructs a pixmap from the file <em>fileName.</em> If the file does not
exist, or is of an unknown format, the pixmap becomes a null pixmap.
<p>The parameters are passed on to <a href="qpixmap.html#a728cf">QPixmap::load</a>(). Dithering will be
performed if the file format uses more than 1 bit per pixel.
<p>See also <a href="qpixmap.html#7803c4">QPixmap::isNull</a>(), <a href="qpixmap.html#a728cf">QPixmap::load</a>(), <a href="qpixmap.html#79475e">QPixmap::loadFromData</a>(), <a href="qpixmap.html#a38b1c">QPixmap::save</a>() and <a href="qpixmap.html#360626">QPixmap::imageFormat</a>().
<h3 class="fn"><a name="9ee1bb"></a>QBitmap::QBitmap(constQBitmap&bitmap)</h3>
<p>Constructs a bitmap which is a copy of <em>bitmap.</em>
<h3 class="fn"><a name="12bed2"></a>QBitmap::QBitmap(intw, inth, boolclear=FALSE, <a href="qpixmap.html#Optimization">QPixmap::Optimization</a>optimization=QPixmap::DefaultOptim)</h3>
<p>Constructs a bitmap with <em>w</em> width and <em>h</em> height.
<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> <code>Qt::color0).</code>
<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.
<p>See also <a href="qpixmap.html#41f5cf">QPixmap::setOptimization</a>() and <a href="qpixmap.html#7675b8">QPixmap::setDefaultOptimization</a>().
<h3 class="fn"><a name="c9b25d"></a>QBitmap::QBitmap(intw, inth, constuchar*bits, boolisXbitmap=FALSE)</h3>
<p>Constructs a bitmap with <em>w</em> width and <em>h</em> height and sets the contents
to <em>bits.</em>
<p>The <em>isXbitmap</em> 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 };
<a href="qbitmap.html">QBitmap</a> bm( 8, 8, arrow_bits, TRUE );
</pre>
<h3 class="fn"><a name="2c4ff2"></a>QBitmap::QBitmap(const<a href="qsize.html">QSize</a>&size, boolclear=FALSE, <a href="qpixmap.html#Optimization">QPixmap::Optimization</a>optimization=QPixmap::DefaultOptim)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn"><a name="29fa2b"></a>QBitmap::QBitmap(const<a href="qsize.html">QSize</a>&size, constuchar*bits, boolisXbitmap=FALSE)</h3>
<p>This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
<h3 class="fn">QBitmap&<a name="cd1e18"></a>QBitmap::operator=(const<a href="qimage.html">QImage</a>&image)</h3>
<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#682415">QImage::depth</a>() greater than 1.
<h3 class="fn">QBitmap&<a name="57c2bf"></a>QBitmap::operator=(const<a href="qpixmap.html">QPixmap</a>&pixmap)</h3>
<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#3c91c2">QPixmap::depth</a>() greater than 1.
<h3 class="fn">QBitmap&<a name="6d398d"></a>QBitmap::operator=(constQBitmap&bitmap)</h3>
<p>Assigns the bitmap <em>bitmap</em> to this bitmap and returns a reference to this
bitmap.
<h3 class="fn">QBitmap<a name="33c04b"></a>QBitmap::xForm(const<a href="qwmatrix.html">QWMatrix</a>&matrix)const</h3>
<p>Returns a transformed copy of this bitmap, using <em>matrix.</em>
<p>This function does exactly the same as <a href="qpixmap.html#ff5fcf">QPixmap::xForm</a>(), except that
it returns a QBitmap instead of a <a href="qpixmap.html">QPixmap</a>.
<p>See also <a href="qpixmap.html#ff5fcf">QPixmap::xForm</a>().
<hr><p>
Search the documentation, FAQ, qt-interest archive and more (uses
<a href="http://www.trolltech.com">www.trolltech.com</a>):<br>
<form method=post action="http://www.trolltech.com/search.cgi">
<input type=hidden name="version" value="2.3.2"><nobr>
<input size="50" name="search"><input type=submit value="Search">
</nobr></form><hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>,
copyright © 1995-2001
<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 2001 Trolltech<td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a>
<td align="right"><div align="right">Qt version 2.3.2</div>
</table></div></address></body></html>
|