summaryrefslogtreecommitdiffstats
path: root/doc/html/tqbitmap.html
blob: ae66f818fce1c8399de36e831b397072603a2240 (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
<!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>TQBitmap 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>TQBitmap Class Reference</h1>

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


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


<p> The TQBitmap class is a monochrome off-screen paint device used
mainly for creating custom <a href="tqcursor.html">TQCursor</a> and <a href="tqbrush.html">TQBrush</a> objects, in
<a href="tqpixmap.html#setMask">TQPixmap::setMask</a>() and for <a href="tqregion.html">TQRegion</a>.
<p> A TQBitmap is a <a href="tqpixmap.html">TQPixmap</a> with a <a href="tqpixmap.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 TQBitmap is
guaranteed to always have the depth 1, unless it is
<a href="tqpixmap.html#isNull">TQPixmap::isNull</a>() which has depth 0.
<p> When drawing in a TQBitmap (or TQPixmap with depth 1), we recommend
using the  <a href="tqcolor.html">TQColor</a> objects <tt>TQt::color0</tt> and <tt>TQt::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> TQColor objects make no
sense because the <a href="tqcolor.html#pixel">TQColor::pixel</a>() value is not necessarily 0 for
black and 1 for white.
<p> The TQBitmap can be transformed (translated, scaled, sheared or
rotated) using <a href="#xForm">xForm</a>().
<p> Just like the <a href="tqpixmap.html">TQPixmap</a> class, TQBitmap is optimized by the use of
<a href="shclass.html">implicit sharing</a>, so it is very
efficient to pass TQBitmap objects as arguments.
<p> <p>See also <a href="tqpixmap.html">TQPixmap</a>, <a href="tqpainter.html#drawPixmap">TQPainter::drawPixmap</a>(), <a href="tqpaintdevice.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="TQBitmap"></a>TQBitmap::TQBitmap ()
</h3>
Constructs a null bitmap.
<p> <p>See also <a href="tqpixmap.html#isNull">TQPixmap::isNull</a>().

<h3 class=fn><a name="TQBitmap-2"></a>TQBitmap::TQBitmap ( int&nbsp;w, int&nbsp;h, bool&nbsp;clear = FALSE, <a href="tqpixmap.html#Optimization-enum">TQPixmap::Optimization</a>&nbsp;optimization = TQPixmap::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="tqcolor.html">TQColor</a> <tt>TQt::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="tqpixmap.html#Optimization-enum">TQPixmap::Optimization</a>.
<p> <p>See also <a href="tqpixmap.html#setOptimization">TQPixmap::setOptimization</a>() and <a href="tqpixmap.html#setDefaultOptimization">TQPixmap::setDefaultOptimization</a>().

<h3 class=fn><a name="TQBitmap-3"></a>TQBitmap::TQBitmap ( const&nbsp;<a href="tqsize.html">TQSize</a>&nbsp;&amp;&nbsp;size, bool&nbsp;clear = FALSE, <a href="tqpixmap.html#Optimization-enum">TQPixmap::Optimization</a>&nbsp;optimization = TQPixmap::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="tqcolor.html">TQColor</a> <tt>TQt::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="tqpixmap.html#Optimization-enum">TQPixmap::Optimization</a>.

<h3 class=fn><a name="TQBitmap-4"></a>TQBitmap::TQBitmap ( 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="tqimage.html">TQImage</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 };
        TQBitmap bm( 8, 8, arrow_bits, TRUE );
    </pre>
 

<h3 class=fn><a name="TQBitmap-5"></a>TQBitmap::TQBitmap ( const&nbsp;<a href="tqsize.html">TQSize</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="tqimage.html">TQImage</a> documentation discusses bit order of monochrome images.

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

<h3 class=fn><a name="TQBitmap-7"></a>TQBitmap::TQBitmap ( const&nbsp;<a href="tqstring.html">TQString</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="tqpixmap.html#load">TQPixmap::load</a>(). Dithering will be performed if the file format
uses more than 1 bit per pixel.
<p> <p>See also <a href="tqpixmap.html#isNull">TQPixmap::isNull</a>(), <a href="tqpixmap.html#load">TQPixmap::load</a>(), <a href="tqpixmap.html#loadFromData">TQPixmap::loadFromData</a>(), <a href="tqpixmap.html#save">TQPixmap::save</a>(), and <a href="tqpixmap.html#imageFormat">TQPixmap::imageFormat</a>().

<h3 class=fn><a href="tqbitmap.html">TQBitmap</a>&nbsp;&amp; <a name="operator-eq"></a>TQBitmap::operator= ( const&nbsp;<a href="tqbitmap.html">TQBitmap</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="tqbitmap.html">TQBitmap</a>&nbsp;&amp; <a name="operator-eq-2"></a>TQBitmap::operator= ( const&nbsp;<a href="tqpixmap.html">TQPixmap</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="tqpixmap.html#depth">TQPixmap::depth</a>()
greater than 1.

<h3 class=fn><a href="tqbitmap.html">TQBitmap</a>&nbsp;&amp; <a name="operator-eq-3"></a>TQBitmap::operator= ( const&nbsp;<a href="tqimage.html">TQImage</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="tqimage.html#depth">TQImage::depth</a>()
greater than 1.

<h3 class=fn><a href="tqbitmap.html">TQBitmap</a> <a name="xForm"></a>TQBitmap::xForm ( const&nbsp;<a href="tqwmatrix.html">TQWMatrix</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="tqpixmap.html#xForm">TQPixmap::xForm</a>(), except
that it returns a TQBitmap instead of a <a href="tqpixmap.html">TQPixmap</a>.
<p> <p>See also <a href="tqpixmap.html#xForm">TQPixmap::xForm</a>().

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>