You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qbitmap.html

187 lines
11 KiB

<!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>