summaryrefslogtreecommitdiffstats
path: root/doc/html/tqpixmap.html
blob: 5942414d993d21e5a6ce9f84f26d95ed86f4d73a (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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
<!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/tqpixmap.cpp:53 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQPixmap 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>TQPixmap Class Reference</h1>

<p>The TQPixmap class is an off-screen, pixel-based paint device.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqpixmap-h.html">tqpixmap.h</a>&gt;</tt>
<p>Inherits <a href="tqpaintdevice.html">TQPaintDevice</a> and <a href="ntqt.html">TQt</a>.
<p>Inherited by <a href="tqbitmap.html">TQBitmap</a> and <a href="tqcanvaspixmap.html">TQCanvasPixmap</a>.
<p><a href="tqpixmap-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn>enum <a href="#ColorMode-enum"><b>ColorMode</b></a> { Auto, Color, Mono }</li>
<li class=fn>enum <a href="#Optimization-enum"><b>Optimization</b></a> { DefaultOptim, NoOptim, MemoryOptim = NoOptim, NormalOptim, BestOptim }</li>
<li class=fn><a href="#TQPixmap"><b>TQPixmap</b></a> ()</li>
<li class=fn><a href="#TQPixmap-2"><b>TQPixmap</b></a> ( const&nbsp;TQImage&nbsp;&amp;&nbsp;image )</li>
<li class=fn><a href="#TQPixmap-3"><b>TQPixmap</b></a> ( int&nbsp;w, int&nbsp;h, int&nbsp;depth = -1, Optimization&nbsp;optimization = DefaultOptim )</li>
<li class=fn><a href="#TQPixmap-4"><b>TQPixmap</b></a> ( const&nbsp;TQSize&nbsp;&amp;&nbsp;size, int&nbsp;depth = -1, Optimization&nbsp;optimization = DefaultOptim )</li>
<li class=fn><a href="#TQPixmap-5"><b>TQPixmap</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0, ColorMode&nbsp;mode = Auto )</li>
<li class=fn><a href="#TQPixmap-6"><b>TQPixmap</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;conversion_flags )</li>
<li class=fn><a href="#TQPixmap-7"><b>TQPixmap</b></a> ( const&nbsp;char&nbsp;*&nbsp;xpm[] )</li>
<li class=fn><a href="#TQPixmap-8"><b>TQPixmap</b></a> ( const&nbsp;TQByteArray&nbsp;&amp;&nbsp;img_data )</li>
<li class=fn><a href="#TQPixmap-9"><b>TQPixmap</b></a> ( const&nbsp;TQPixmap&nbsp;&amp;&nbsp;pixmap )</li>
<li class=fn><a href="#~TQPixmap"><b>~TQPixmap</b></a> ()</li>
<li class=fn>TQPixmap &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQPixmap&nbsp;&amp;&nbsp;pixmap )</li>
<li class=fn>TQPixmap &amp; <a href="#operator-eq-2"><b>operator=</b></a> ( const&nbsp;TQImage&nbsp;&amp;&nbsp;image )</li>
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</li>
<li class=fn>int <a href="#width"><b>width</b></a> () const</li>
<li class=fn>int <a href="#height"><b>height</b></a> () const</li>
<li class=fn>TQSize <a href="#size"><b>size</b></a> () const</li>
<li class=fn>TQRect <a href="#rect"><b>rect</b></a> () const</li>
<li class=fn>int <a href="#depth"><b>depth</b></a> () const</li>
<li class=fn>void <a href="#fill"><b>fill</b></a> ( const&nbsp;TQColor&nbsp;&amp;&nbsp;fillColor = TQt::white )</li>
<li class=fn>void <a href="#fill-2"><b>fill</b></a> ( const&nbsp;TQWidget&nbsp;*&nbsp;widget, int&nbsp;xofs, int&nbsp;yofs )</li>
<li class=fn>void <a href="#fill-3"><b>fill</b></a> ( const&nbsp;TQWidget&nbsp;*&nbsp;widget, const&nbsp;TQPoint&nbsp;&amp;&nbsp;ofs )</li>
<li class=fn>void <a href="#resize"><b>resize</b></a> ( int&nbsp;w, int&nbsp;h )</li>
<li class=fn>void <a href="#resize-2"><b>resize</b></a> ( const&nbsp;TQSize&nbsp;&amp;&nbsp;size )</li>
<li class=fn>const TQBitmap * <a href="#mask"><b>mask</b></a> () const</li>
<li class=fn>void <a href="#setMask"><b>setMask</b></a> ( const&nbsp;TQBitmap&nbsp;&amp;&nbsp;newmask )</li>
<li class=fn>bool <a href="#selfMask"><b>selfMask</b></a> () const</li>
<li class=fn>bool <a href="#hasAlpha"><b>hasAlpha</b></a> () const</li>
<li class=fn>bool <a href="#hasAlphaChannel"><b>hasAlphaChannel</b></a> () const</li>
<li class=fn>TQBitmap <a href="#createHeuristicMask"><b>createHeuristicMask</b></a> ( bool&nbsp;clipTight = TRUE ) const</li>
<li class=fn>TQPixmap <a href="#xForm"><b>xForm</b></a> ( const&nbsp;TQWMatrix&nbsp;&amp;&nbsp;matrix ) const</li>
<li class=fn>TQImage <a href="#convertToImage"><b>convertToImage</b></a> () const</li>
<li class=fn>bool <a href="#convertFromImage-2"><b>convertFromImage</b></a> ( const&nbsp;TQImage&nbsp;&amp;&nbsp;image, ColorMode&nbsp;mode = Auto )</li>
<li class=fn>bool <a href="#convertFromImage"><b>convertFromImage</b></a> ( const&nbsp;TQImage&nbsp;&amp;&nbsp;img, int&nbsp;conversion_flags )</li>
<li class=fn>bool <a href="#load-2"><b>load</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0, ColorMode&nbsp;mode = Auto )</li>
<li class=fn>bool <a href="#load"><b>load</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;conversion_flags )</li>
<li class=fn>bool <a href="#loadFromData-2"><b>loadFromData</b></a> ( const&nbsp;uchar&nbsp;*&nbsp;buf, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;format = 0, ColorMode&nbsp;mode = Auto )</li>
<li class=fn>bool <a href="#loadFromData"><b>loadFromData</b></a> ( const&nbsp;uchar&nbsp;*&nbsp;buf, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;conversion_flags )</li>
<li class=fn>bool <a href="#loadFromData-3"><b>loadFromData</b></a> ( const&nbsp;TQByteArray&nbsp;&amp;&nbsp;buf, const&nbsp;char&nbsp;*&nbsp;format = 0, int&nbsp;conversion_flags = 0 )</li>
<li class=fn>bool <a href="#save"><b>save</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const</li>
<li class=fn>bool <a href="#save-2"><b>save</b></a> ( TQIODevice&nbsp;*&nbsp;device, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const</li>
<li class=fn>int <a href="#serialNumber"><b>serialNumber</b></a> () const</li>
<li class=fn>Optimization <a href="#optimization"><b>optimization</b></a> () const</li>
<li class=fn>void <a href="#setOptimization"><b>setOptimization</b></a> ( Optimization&nbsp;optimization )</li>
<li class=fn>virtual void <a href="#detach"><b>detach</b></a> ()</li>
<li class=fn>bool <a href="#isTQBitmap"><b>isTQBitmap</b></a> () const</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>int <a href="#defaultDepth"><b>defaultDepth</b></a> ()</li>
<li class=fn>TQPixmap <a href="#fromMimeSource"><b>fromMimeSource</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;abs_name )</li>
<li class=fn>TQPixmap <a href="#grabWindow"><b>grabWindow</b></a> ( WId&nbsp;window, int&nbsp;x = 0, int&nbsp;y = 0, int&nbsp;w = -1, int&nbsp;h = -1 )</li>
<li class=fn>TQPixmap <a href="#grabWidget"><b>grabWidget</b></a> ( TQWidget&nbsp;*&nbsp;widget, int&nbsp;x = 0, int&nbsp;y = 0, int&nbsp;w = -1, int&nbsp;h = -1 )</li>
<li class=fn>TQWMatrix <a href="#trueMatrix"><b>trueMatrix</b></a> ( const&nbsp;TQWMatrix&nbsp;&amp;&nbsp;matrix, int&nbsp;w, int&nbsp;h )</li>
<li class=fn>const char * <a href="#imageFormat"><b>imageFormat</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;fileName )</li>
<li class=fn>Optimization <a href="#defaultOptimization"><b>defaultOptimization</b></a> ()</li>
<li class=fn>void <a href="#setDefaultOptimization"><b>setDefaultOptimization</b></a> ( Optimization&nbsp;optimization )</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn><a href="#TQPixmap-a"><b>TQPixmap</b></a> ( int&nbsp;w, int&nbsp;h, const&nbsp;uchar&nbsp;*&nbsp;bits, bool&nbsp;isXbitmap )</li>
<li class=fn>virtual int <a href="#metric"><b>metric</b></a> ( int&nbsp;m ) const</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>TQDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, const&nbsp;TQPixmap&nbsp;&amp;&nbsp;pixmap )</li>
<li class=fn>TQDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( TQDataStream&nbsp;&amp;&nbsp;s, TQPixmap&nbsp;&amp;&nbsp;pixmap )</li>
<li class=fn>void <a href="#copyBlt"><b>copyBlt</b></a> ( TQPixmap&nbsp;*&nbsp;dst, int&nbsp;dx, int&nbsp;dy, const&nbsp;TQPixmap&nbsp;*&nbsp;src, int&nbsp;sx, int&nbsp;sy, int&nbsp;sw, int&nbsp;sh )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The TQPixmap class is an off-screen, pixel-based paint device.
<p> 



<p> TQPixmap is one of the two classes TQt provides for dealing with
images; the other is <a href="tqimage.html">TQImage</a>. TQPixmap is designed and optimized
for drawing; TQImage is designed and optimized for I/O and for
direct pixel access/manipulation. There are (slow) functions to
convert between TQImage and TQPixmap: <a href="#convertToImage">convertToImage</a>() and
<a href="#convertFromImage">convertFromImage</a>().
<p> One common use of the TQPixmap class is to enable smooth updating
of widgets. Whenever something complex needs to be drawn, you can
use a pixmap to obtain flicker-free drawing, like this:
<p> <ol type=1>
<li> Create a pixmap with the same size as the widget.
<li> Fill the pixmap with the widget background color.
<li> Paint the pixmap.
<li> <a href="tqpaintdevice.html#bitBlt">bitBlt</a>() the pixmap contents onto the widget.
</ol>
<p> Pixel data in a pixmap is internal and is managed by the
underlying window system. Pixels can be accessed only through
<a href="tqpainter.html">TQPainter</a> functions, through bitBlt(), and by converting the
TQPixmap to a TQImage.
<p> You can easily display a TQPixmap on the screen using
<a href="tqlabel.html#setPixmap">TQLabel::setPixmap</a>(). For example, all the <a href="tqbutton.html">TQButton</a> subclasses
support pixmap use.
<p> The TQPixmap class uses <a href="shclass.html">copy-on-write</a>,
so it is practical to pass TQPixmap objects by value.
<p> You can retrieve the <a href="#width">width</a>(), <a href="#height">height</a>(), <a href="#depth">depth</a>() and <a href="#size">size</a>() of a
pixmap. The enclosing rectangle is given by <a href="#rect">rect</a>(). Pixmaps can be
filled with <a href="#fill">fill</a>() and resized with <a href="#resize">resize</a>(). You can create and
set a mask with <a href="#createHeuristicMask">createHeuristicMask</a>() and <a href="#setMask">setMask</a>(). Use
<a href="#selfMask">selfMask</a>() to see if the pixmap is identical to its mask.
<p> In addition to loading a pixmap from file using <a href="#load">load</a>() you can
also <a href="#loadFromData">loadFromData</a>(). You can control optimization with
<a href="#setOptimization">setOptimization</a>() and obtain a transformed version of the pixmap
using <a href="#xForm">xForm</a>()
<p> Note regarding Windows 95 and 98: on Windows 9x the system crashes
if you create more than about 1000 pixmaps, independent of the
size of the pixmaps or installed RAM. Windows NT-systems (including
2000, XP and following versions) do not have the same limitation,
but depending on the graphics equipment the system will fail to
allocate pixmap objects at some point (due to system running out of
GDI resources).
<p> TQt tries to work around the resource limitation. If you set the
pixmap optimization to <a href="#Optimization-enum">TQPixmap::MemoryOptim</a> and the width of
your pixmap is less than or equal to 128 pixels, TQt stores the
pixmap in a way that is very memory-efficient when there are many
pixmaps.
<p> If your application uses dozens or hundreds of pixmaps (for
example on tool bar buttons and in popup menus), and you plan to
run it on Windows 95 or Windows 98, we recommend using code like
this:
<p> <pre>
        TQPixmap::<a href="#setDefaultOptimization">setDefaultOptimization</a>( TQPixmap::<a href="#Optimization-enum">MemoryOptim</a> );
        while ( ... ) {
            // load tool bar pixmaps etc.
            TQPixmap *pixmap = new TQPixmap(fileName);
        }
        TQPixmap::<a href="#setDefaultOptimization">setDefaultOptimization</a>( TQPixmap::<a href="#Optimization-enum">NormalOptim</a> );
    </pre>
 
<p> In general it is recommended to make as much use of TQPixmap's
<a href="shclass.html#implicit-sharing">implicit sharing</a> and the <a href="tqpixmapcache.html">TQPixmapCache</a> as possible.
<p> <p>See also <a href="tqbitmap.html">TQBitmap</a>, <a href="tqimage.html">TQImage</a>, <a href="tqimageio.html">TQImageIO</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 Type Documentation</h2>
<h3 class=fn><a name="ColorMode-enum"></a>TQPixmap::ColorMode</h3>

<p> This enum type defines the color modes that exist for converting
<a href="tqimage.html">TQImage</a> objects to TQPixmap.
<ul>
<li><tt>TQPixmap::Auto</tt> - Select <a href="#ColorMode-enum">Color</a> or <a href="#ColorMode-enum">Mono</a> on a case-by-case basis.
<li><tt>TQPixmap::Color</tt> - Always create colored pixmaps.
<li><tt>TQPixmap::Mono</tt> - Always create bitmaps.
</ul>
<h3 class=fn><a name="Optimization-enum"></a>TQPixmap::Optimization</h3>

<p> TQPixmap has the choice of optimizing for speed or memory in a few
places; the best choice varies from pixmap to pixmap but can
generally be derived heuristically. This enum type defines a
number of optimization modes that you can set for any pixmap to
tweak the speed/memory tradeoffs:
<ul>
<li><tt>TQPixmap::DefaultOptim</tt> - Whatever <a href="#defaultOptimization">TQPixmap::defaultOptimization</a>()
returns. A pixmap with this optimization will have whatever
the current default optimization is. If the default
optimization is changed using <a href="#setDefaultOptimization">setDefaultOptimization</a>(), then
this will not effect any pixmaps that have already been
created.
<li><tt>TQPixmap::NoOptim</tt> - No optimization (currently the same as <a href="#Optimization-enum">MemoryOptim</a>).
<li><tt>TQPixmap::MemoryOptim</tt> - Optimize for minimal memory use on Windows
9x and X11 systems.
<li><tt>TQPixmap::NormalOptim</tt> - Optimize for typical usage. Often uses more
memory than <a href="#Optimization-enum">MemoryOptim</a>, and is often faster.
<li><tt>TQPixmap::BestOptim</tt> - Optimize for pixmaps that are drawn very often
and where performance is critical. Generally uses more memory
than <a href="#Optimization-enum">NormalOptim</a> and may provide a little more speed.
</ul><p> We recommend using <a href="#Optimization-enum">DefaultOptim</a>.
<p> 
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQPixmap"></a>TQPixmap::TQPixmap ()
</h3>
Constructs a null pixmap.
<p> <p>See also <a href="#isNull">isNull</a>().

<h3 class=fn><a name="TQPixmap-2"></a>TQPixmap::TQPixmap ( const&nbsp;<a href="tqimage.html">TQImage</a>&nbsp;&amp;&nbsp;image )
</h3>
Constructs a pixmap from the <a href="tqimage.html">TQImage</a> <em>image</em>.
<p> <p>See also <a href="#convertFromImage">convertFromImage</a>().

<h3 class=fn><a name="TQPixmap-3"></a>TQPixmap::TQPixmap ( int&nbsp;w, int&nbsp;h, int&nbsp;depth = -1, <a href="tqpixmap.html#Optimization-enum">Optimization</a>&nbsp;optimization = DefaultOptim )
</h3>
Constructs a pixmap with <em>w</em> width, <em>h</em> height and <em>depth</em> bits
per pixel. The pixmap is optimized in accordance with the <em>optimization</em> value.
<p> The contents of the pixmap is uninitialized.
<p> The <em>depth</em> can be either 1 (monochrome) or the depth of the
current video mode. If <em>depth</em> is negative, then the hardware
depth of the current video mode will be used.
<p> If either <em>w</em> or <em>h</em> is zero, a null pixmap is constructed.
<p> <p>See also <a href="#isNull">isNull</a>() and <a href="#Optimization-enum">TQPixmap::Optimization</a>.

<h3 class=fn><a name="TQPixmap-4"></a>TQPixmap::TQPixmap ( const&nbsp;<a href="tqsize.html">TQSize</a>&nbsp;&amp;&nbsp;size, int&nbsp;depth = -1, <a href="tqpixmap.html#Optimization-enum">Optimization</a>&nbsp;optimization = DefaultOptim )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Constructs a pixmap of size <em>size</em>, <em>depth</em> bits per pixel,
optimized in accordance with the <em>optimization</em> value.

<h3 class=fn><a name="TQPixmap-5"></a>TQPixmap::TQPixmap ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0, <a href="tqpixmap.html#ColorMode-enum">ColorMode</a>&nbsp;mode = Auto )
</h3>
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 <em>fileName</em>, <em>format</em> and <em>mode</em> parameters are passed on to
<a href="#load">load</a>(). This means that the data in <em>fileName</em> is not compiled
into the binary. If <em>fileName</em> contains a relative path (e.g. the
filename only) the relevant file must be found relative to the
runtime working directory.
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>, <a href="#isNull">isNull</a>(), <a href="#load">load</a>(), <a href="#loadFromData">loadFromData</a>(), <a href="#save">save</a>(), and <a href="#imageFormat">imageFormat</a>().

<h3 class=fn><a name="TQPixmap-6"></a>TQPixmap::TQPixmap ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;conversion_flags )
</h3>
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 <em>fileName</em>, <em>format</em> and <em>conversion_flags</em> parameters are
passed on to <a href="#load">load</a>(). This means that the data in <em>fileName</em> is
not compiled into the binary. If <em>fileName</em> contains a relative
path (e.g. the filename only) the relevant file must be found
relative to the runtime working directory.
<p> If the image needs to be modified to fit in a lower-resolution
result (e.g. converting from 32-bit to 8-bit), use the <em>conversion_flags</em> to specify how you'd prefer this to happen.
<p> <p>See also <a href="ntqt.html#ImageConversionFlags-enum">TQt::ImageConversionFlags</a>, <a href="#isNull">isNull</a>(), <a href="#load">load</a>(), <a href="#loadFromData">loadFromData</a>(), <a href="#save">save</a>(), and <a href="#imageFormat">imageFormat</a>().

<h3 class=fn><a name="TQPixmap-7"></a>TQPixmap::TQPixmap ( const&nbsp;char&nbsp;*&nbsp;xpm[] )
</h3>
Constructs a pixmap from <em>xpm</em>, which must be a valid XPM image.
<p> Errors are silently ignored.
<p> Note that it's possible to squeeze the XPM variable a little bit
by using an unusual declaration:
<p> <pre>
        static const char * const start_xpm[]={
            "16 15 8 1",
            "a c #cec6bd",
        ....
    </pre>
 
<p> The extra <tt>const</tt> makes the entire definition read-only, which is
slightly more efficient (for example, when the code is in a shared
library) and ROMable when the application is to be stored in ROM.
<p> In order to use that sort of declaration you must cast the
variable back to <tt>const char **</tt> when you create the TQPixmap.

<h3 class=fn><a name="TQPixmap-8"></a>TQPixmap::TQPixmap ( const&nbsp;<a href="tqbytearray.html">TQByteArray</a>&nbsp;&amp;&nbsp;img_data )
</h3>
Constructs a pixmaps by loading from <em>img_data</em>. The data can be
in any image format supported by TQt.
<p> <p>See also <a href="#loadFromData">loadFromData</a>().

<h3 class=fn><a name="TQPixmap-9"></a>TQPixmap::TQPixmap ( const&nbsp;<a href="tqpixmap.html">TQPixmap</a>&nbsp;&amp;&nbsp;pixmap )
</h3>
Constructs a pixmap that is a copy of <em>pixmap</em>.

<h3 class=fn><a name="TQPixmap-a"></a>TQPixmap::TQPixmap ( int&nbsp;w, int&nbsp;h, const&nbsp;uchar&nbsp;*&nbsp;bits, bool&nbsp;isXbitmap )<tt> [protected]</tt>
</h3>
Constructs a monochrome pixmap, with width <em>w</em> and height <em>h</em>,
that is initialized with the data in <em>bits</em>. The <em>isXbitmap</em>
indicates whether the data is an X bitmap and defaults to FALSE.
This constructor is protected and used by the <a href="tqbitmap.html">TQBitmap</a> class.

<h3 class=fn><a name="~TQPixmap"></a>TQPixmap::~TQPixmap ()
</h3>
Destroys the pixmap.

<h3 class=fn>bool <a name="convertFromImage"></a>TQPixmap::convertFromImage ( const&nbsp;<a href="tqimage.html">TQImage</a>&nbsp;&amp;&nbsp;img, int&nbsp;conversion_flags )
</h3>
Converts image <em>img</em> and sets this pixmap. Returns TRUE if
successful; otherwise returns FALSE.
<p> The <em>conversion_flags</em> argument is a bitwise-OR of the
<a href="ntqt.html#ImageConversionFlags-enum">TQt::ImageConversionFlags</a>. Passing 0 for <em>conversion_flags</em>
sets all the default options.
<p> Note that even though a TQPixmap with depth 1 behaves much like a
<a href="tqbitmap.html">TQBitmap</a>, <a href="#isTQBitmap">isTQBitmap</a>() returns FALSE.
<p> If a pixmap with depth 1 is painted with color0 and color1 and
converted to an image, the pixels painted with color0 will produce
pixel index 0 in the image and those painted with color1 will
produce pixel index 1.
<p> <p>See also <a href="#convertToImage">convertToImage</a>(), <a href="#isTQBitmap">isTQBitmap</a>(), <a href="tqimage.html#convertDepth">TQImage::convertDepth</a>(), <a href="#defaultDepth">defaultDepth</a>(), and <a href="tqimage.html#hasAlphaBuffer">TQImage::hasAlphaBuffer</a>().

<p>Examples: <a href="canvas-example.html#x2943">canvas/canvas.cpp</a> and <a href="themes-example.html#x228">themes/wood.cpp</a>.
<h3 class=fn>bool <a name="convertFromImage-2"></a>TQPixmap::convertFromImage ( const&nbsp;<a href="tqimage.html">TQImage</a>&nbsp;&amp;&nbsp;image, <a href="tqpixmap.html#ColorMode-enum">ColorMode</a>&nbsp;mode = Auto )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Converts <em>image</em> and sets this pixmap using color mode <em>mode</em>.
Returns TRUE if successful; otherwise returns FALSE.
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>.

<h3 class=fn><a href="tqimage.html">TQImage</a> <a name="convertToImage"></a>TQPixmap::convertToImage () const
</h3>
Converts the pixmap to a <a href="tqimage.html">TQImage</a>. Returns a null image if it fails.
<p> If the pixmap has 1-bit depth, the returned image will also be 1
bit deep. If the pixmap has 2- to 8-bit depth, the returned image
has 8-bit depth. If the pixmap has greater than 8-bit depth, the
returned image has 32-bit depth.
<p> Note that for the moment, alpha masks on monochrome images are
ignored.
<p> <p>See also <a href="#convertFromImage">convertFromImage</a>().

<p>Example: <a href="qmag-example.html#x1783">qmag/qmag.cpp</a>.
<h3 class=fn><a href="tqbitmap.html">TQBitmap</a> <a name="createHeuristicMask"></a>TQPixmap::createHeuristicMask ( bool&nbsp;clipTight = TRUE ) const
</h3>
Creates and returns a heuristic mask for this pixmap. It works by
selecting a color from one of the corners and then chipping away
pixels of that color, starting at all the edges.
<p> The mask may not be perfect but it should be reasonable, so you
can do things such as the following:
<pre>
    pm-&gt;setMask( pm-&gt;createHeuristicMask() );
    </pre>
 
<p> This function is slow because it involves transformation to a
<a href="tqimage.html">TQImage</a>, non-trivial computations and a transformation back to a
<a href="tqbitmap.html">TQBitmap</a>.
<p> If <em>clipTight</em> is TRUE the mask is just large enough to cover the
pixels; otherwise, the mask is larger than the data pixels.
<p> <p>See also <a href="tqimage.html#createHeuristicMask">TQImage::createHeuristicMask</a>().

<h3 class=fn>int <a name="defaultDepth"></a>TQPixmap::defaultDepth ()<tt> [static]</tt>
</h3>
Returns the default pixmap depth, i.e. the depth a pixmap gets if
-1 is specified.
<p> <p>See also <a href="#depth">depth</a>().

<h3 class=fn><a href="tqpixmap.html#Optimization-enum">Optimization</a> <a name="defaultOptimization"></a>TQPixmap::defaultOptimization ()<tt> [static]</tt>
</h3>
Returns the default pixmap optimization setting.
<p> <p>See also <a href="#setDefaultOptimization">setDefaultOptimization</a>(), <a href="#setOptimization">setOptimization</a>(), and <a href="#optimization">optimization</a>().

<h3 class=fn>int <a name="depth"></a>TQPixmap::depth () const
</h3>

<p> Returns the depth of the pixmap.
<p> The pixmap depth is also called bits per pixel (bpp) or bit planes
of a pixmap. A null pixmap has depth 0.
<p> <p>See also <a href="#defaultDepth">defaultDepth</a>(), <a href="#isNull">isNull</a>(), and <a href="tqimage.html#convertDepth">TQImage::convertDepth</a>().

<h3 class=fn>void <a name="detach"></a>TQPixmap::detach ()<tt> [virtual]</tt>
</h3>
This is a special-purpose function that detaches the pixmap from
shared pixmap data.
<p> A pixmap is automatically detached by TQt whenever its contents is
about to change. This is done in all TQPixmap member functions
that modify the pixmap (<a href="#fill">fill</a>(), <a href="#resize">resize</a>(), <a href="#convertFromImage">convertFromImage</a>(),
<a href="#load">load</a>(), etc.), in <a href="tqpaintdevice.html#bitBlt">bitBlt</a>() for the destination pixmap and in
<a href="tqpainter.html#begin">TQPainter::begin</a>() on a pixmap.
<p> It is possible to modify a pixmap without letting TQt know. You can
first obtain the system-dependent <a href="tqpaintdevice.html#handle">handle</a>() and then call
system-specific functions (for instance, BitBlt under Windows)
that modify the pixmap contents. In such cases, you can call
<a href="#detach">detach</a>() to cut the pixmap loose from other pixmaps that share
data with this one.
<p> detach() returns immediately if there is just a single reference
or if the pixmap has not been initialized yet.

<h3 class=fn>void <a name="fill"></a>TQPixmap::fill ( const&nbsp;<a href="tqcolor.html">TQColor</a>&nbsp;&amp;&nbsp;fillColor = TQt::white )
</h3>
Fills the pixmap with the color <em>fillColor</em>.

<p>Examples: <a href="tutorial2-08.html#x2606">chart/setdataform.cpp</a>, <a href="desktop-example.html#x1742">desktop/desktop.cpp</a>, <a href="grapher-nsplugin-example.html#x2765">grapher/grapher.cpp</a>, <a href="hello-example.html#x1638">hello/hello.cpp</a>, <a href="tutorial1-10.html#x2358">t10/cannon.cpp</a>, <a href="themes-example.html#x292">themes/metal.cpp</a>, and <a href="xform-example.html#x1245">xform/xform.cpp</a>.
<h3 class=fn>void <a name="fill-2"></a>TQPixmap::fill ( const&nbsp;<a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;widget, int&nbsp;xofs, int&nbsp;yofs )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Fills the pixmap with the <em>widget</em>'s background color or pixmap.
If the background is empty, nothing is done. <em>xofs</em>, <em>yofs</em> is
an offset in the widget.

<h3 class=fn>void <a name="fill-3"></a>TQPixmap::fill ( const&nbsp;<a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;widget, const&nbsp;<a href="tqpoint.html">TQPoint</a>&nbsp;&amp;&nbsp;ofs )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Fills the pixmap with the <em>widget</em>'s background color or pixmap.
If the background is empty, nothing is done.
<p> The <em>ofs</em> point is an offset in the widget.
<p> The point <em>ofs</em> is a point in the widget's coordinate system. The
pixmap's top-left pixel will be mapped to the point <em>ofs</em> in the
widget. This is significant if the widget has a background pixmap;
otherwise the pixmap will simply be filled with the background
color of the widget.
<p> Example:
<pre>
    void CuteWidget::paintEvent( <a href="tqpaintevent.html">TQPaintEvent</a> *e )
    {
        <a href="tqrect.html">TQRect</a> ur = e-&gt;<a href="tqpaintevent.html#rect">rect</a>();            // rectangle to update
        TQPixmap pix( ur.<a href="tqrect.html#size">size</a>() );        // Pixmap for double-buffering
        pix.<a href="#fill">fill</a>( this, ur.<a href="tqrect.html#topLeft">topLeft</a>() );  // fill with widget background

        <a href="tqpainter.html">TQPainter</a> p( &amp;pix );
        p.<a href="tqpainter.html#translate">translate</a>( -ur.<a href="tqrect.html#x">x</a>(), -ur.<a href="tqrect.html#y">y</a>() ); // use widget coordinate system
                                         // when drawing on pixmap
        //    ... draw on pixmap ...

        p.<a href="tqpainter.html#end">end</a>();

        <a href="tqpaintdevice.html#bitBlt">bitBlt</a>( this, ur.<a href="tqrect.html#topLeft">topLeft</a>(), &amp;pix );
    }
    </pre>
 

<h3 class=fn><a href="tqpixmap.html">TQPixmap</a> <a name="fromMimeSource"></a>TQPixmap::fromMimeSource ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;abs_name )<tt> [static]</tt>
</h3> Convenience function. Gets the data associated with the absolute
name <em>abs_name</em> from the default mime source factory and decodes it
to a pixmap.
<p> <p>See also <a href="tqmimesourcefactory.html">TQMimeSourceFactory</a>, <a href="tqimage.html#fromMimeSource">TQImage::fromMimeSource</a>(), and <a href="tqimagedrag.html#decode">TQImageDrag::decode</a>().

<p>Example: <a href="tqactiongroup.html#x2113">textedit/textedit.cpp</a>.
<h3 class=fn><a href="tqpixmap.html">TQPixmap</a> <a name="grabWidget"></a>TQPixmap::grabWidget ( <a href="tqwidget.html">TQWidget</a>&nbsp;*&nbsp;widget, int&nbsp;x = 0, int&nbsp;y = 0, int&nbsp;w = -1, int&nbsp;h = -1 )<tt> [static]</tt>
</h3>
Creates a pixmap and paints <em>widget</em> in it.
<p> If the <em>widget</em> has any children, then they are also painted in
the appropriate positions.
<p> If you specify <em>x</em>, <em>y</em>, <em>w</em> or <em>h</em>, only the rectangle you
specify is painted. The defaults are 0, 0 (top-left corner) and
-1,-1 (which means the entire widget).
<p> (If <em>w</em> is negative, the function copies everything to the right
border of the window. If <em>h</em> is negative, the function copies
everything to the bottom of the window.)
<p> If <em>widget</em> is 0, or if the rectangle defined by <em>x</em>, <em>y</em>, the
modified <em>w</em> and the modified <em>h</em> does not overlap the <em>widget</em>->rect(), this function will return a null TQPixmap.
<p> This function actually asks <em>widget</em> to paint itself (and its
children to paint themselves). <a href="#grabWindow">TQPixmap::grabWindow</a>() grabs pixels
off the screen, which is a bit faster and picks up <em>exactly</em>
what's on-screen. This function works by calling paintEvent() with
painter redirection turned on. If there are overlaying windows,
<a href="#grabWindow">grabWindow</a>() will see them, but not this function.
<p> If there is overlap, it returns a pixmap of the size you want,
containing a rendering of <em>widget</em>. If the rectangle you ask for
is a superset of <em>widget</em>, the areas outside <em>widget</em> are
covered with the widget's background.
<p> If an error occurs when trying to grab the widget, such as the
size of the widget being too large to fit in memory, an <a href="#isNull">isNull</a>()
pixmap is returned.
<p> <p>See also <a href="#grabWindow">grabWindow</a>(), <a href="tqpainter.html#redirect">TQPainter::redirect</a>(), and <a href="tqwidget.html#paintEvent">TQWidget::paintEvent</a>().

<h3 class=fn><a href="tqpixmap.html">TQPixmap</a> <a name="grabWindow"></a>TQPixmap::grabWindow ( WId&nbsp;window, int&nbsp;x = 0, int&nbsp;y = 0, int&nbsp;w = -1, int&nbsp;h = -1 )<tt> [static]</tt>
</h3>
Grabs the contents of the window <em>window</em> and makes a pixmap out
of it. Returns the pixmap.
<p> The arguments <em>(x, y)</em> specify the offset in the window, whereas
<em>(w, h)</em> specify the width and height of the area to be copied.
<p> If <em>w</em> is negative, the function copies everything to the right
border of the window. If <em>h</em> is negative, the function copies
everything to the bottom of the window.
<p> Note that <a href="#grabWindow">grabWindow</a>() grabs pixels from the screen, not from the
window. If there is another window partially or entirely over the
one you grab, you get pixels from the overlying window, too.
<p> Note also that the mouse cursor is generally not grabbed.
<p> The reason we use a window identifier and not a <a href="tqwidget.html">TQWidget</a> is to
enable grabbing of windows that are not part of the application,
window system frames, and so on.
<p> <b>Warning:</b> Grabbing an area outside the screen is not safe in
general. This depends on the underlying window system.
<p> <b>Warning:</b> X11 only: If <em>window</em> is not the same depth as the root
window and another window partially or entirely obscures the one
you grab, you will <em>not</em> get pixels from the overlying window.
The contests of the obscured areas in the pixmap are undefined and
uninitialized.
<p> <p>See also <a href="#grabWidget">grabWidget</a>().

<p>Example: <a href="qmag-example.html#x1784">qmag/qmag.cpp</a>.
<h3 class=fn>bool <a name="hasAlpha"></a>TQPixmap::hasAlpha () const
</h3>
Returns TRUE this pixmap has an alpha channel or a mask.
<p> <p>See also <a href="#hasAlphaChannel">hasAlphaChannel</a>() and <a href="#mask">mask</a>().

<h3 class=fn>bool <a name="hasAlphaChannel"></a>TQPixmap::hasAlphaChannel () const
</h3>
Returns TRUE if the pixmap has an alpha channel; otherwise it
returns FALSE.
<p> NOTE: If the pixmap has a mask but not alpha channel, this
function returns FALSE.
<p> <p>See also <a href="#hasAlpha">hasAlpha</a>() and <a href="#mask">mask</a>().

<h3 class=fn>int <a name="height"></a>TQPixmap::height () const
</h3>

<p> Returns the height of the pixmap.
<p> <p>See also <a href="#width">width</a>(), <a href="#size">size</a>(), and <a href="#rect">rect</a>().

<p>Examples: <a href="desktop-example.html#x1743">desktop/desktop.cpp</a>, <a href="movies-example.html#x510">movies/main.cpp</a>, <a href="scribble-example.html#x921">scribble/scribble.cpp</a>, <a href="scrollview-example.html#x638">scrollview/scrollview.cpp</a>, <a href="tutorial1-10.html#x2359">t10/cannon.cpp</a>, and <a href="xform-example.html#x1246">xform/xform.cpp</a>.
<h3 class=fn>const char * <a name="imageFormat"></a>TQPixmap::imageFormat ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName )<tt> [static]</tt>
</h3>
Returns a string that specifies the image format of the file <em>fileName</em>, or 0 if the file cannot be read or if the format cannot
be recognized.
<p> The <a href="tqimageio.html">TQImageIO</a> documentation lists the supported image formats.
<p> <p>See also <a href="#load">load</a>() and <a href="#save">save</a>().

<h3 class=fn>bool <a name="isNull"></a>TQPixmap::isNull () const
</h3>

<p> Returns TRUE if this is a null pixmap; otherwise returns FALSE.
<p> A null pixmap has zero width, zero height and no contents. You
cannot draw in a null pixmap or <a href="tqpaintdevice.html#bitBlt">bitBlt</a>() anything to it.
<p> Resizing an existing pixmap to (0, 0) makes a pixmap into a null
pixmap.
<p> <p>See also <a href="#resize">resize</a>().

<p>Examples: <a href="movies-example.html#x511">movies/main.cpp</a>, <a href="tqdir-example.html#x1834">tqdir/tqdir.cpp</a>, <a href="qmag-example.html#x1785">qmag/qmag.cpp</a>, and <a href="scrollview-example.html#x639">scrollview/scrollview.cpp</a>.
<h3 class=fn>bool <a name="isTQBitmap"></a>TQPixmap::isTQBitmap () const
</h3>

<p> Returns TRUE if this is a <a href="tqbitmap.html">TQBitmap</a>; otherwise returns FALSE.

<h3 class=fn>bool <a name="load"></a>TQPixmap::load ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;conversion_flags )
</h3>
Loads a pixmap from the file <em>fileName</em> at runtime. Returns TRUE
if successful; otherwise returns FALSE.
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
using the specified format. If <em>format</em> is not specified
(default), the loader reads a few bytes from the header to guess
the file's format.
<p> See the <a href="#convertFromImage">convertFromImage</a>() documentation for a description of the
<em>conversion_flags</em> argument.
<p> The <a href="tqimageio.html">TQImageIO</a> documentation lists the supported image formats and
explains how to add extra formats.
<p> <p>See also <a href="#loadFromData">loadFromData</a>(), <a href="#save">save</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="tqimage.html#load">TQImage::load</a>(), and <a href="tqimageio.html">TQImageIO</a>.

<p>Examples: <a href="picture-example.html#x124">picture/picture.cpp</a>, <a href="scrollview-example.html#x640">scrollview/scrollview.cpp</a>, and <a href="xform-example.html#x1247">xform/xform.cpp</a>.
<h3 class=fn>bool <a name="load-2"></a>TQPixmap::load ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format = 0, <a href="tqpixmap.html#ColorMode-enum">ColorMode</a>&nbsp;mode = Auto )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Loads a pixmap from the file <em>fileName</em> at runtime.
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
using the specified format. If <em>format</em> is not specified
(default), the loader reads a few bytes from the header to guess
the file's format.
<p> The <em>mode</em> is used to specify the color mode of the pixmap.
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>.

<h3 class=fn>bool <a name="loadFromData"></a>TQPixmap::loadFromData ( const&nbsp;uchar&nbsp;*&nbsp;buf, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;conversion_flags )
</h3>
Loads a pixmap from the binary data in <em>buf</em> (<em>len</em> bytes).
Returns TRUE if successful; otherwise returns FALSE.
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
using the specified format. If <em>format</em> is not specified
(default), the loader reads a few bytes from the header to guess
the file's format.
<p> See the <a href="#convertFromImage">convertFromImage</a>() documentation for a description of the
<em>conversion_flags</em> argument.
<p> The <a href="tqimageio.html">TQImageIO</a> documentation lists the supported image formats and
explains how to add extra formats.
<p> <p>See also <a href="#load">load</a>(), <a href="#save">save</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="tqimage.html#loadFromData">TQImage::loadFromData</a>(), and <a href="tqimageio.html">TQImageIO</a>.

<h3 class=fn>bool <a name="loadFromData-2"></a>TQPixmap::loadFromData ( const&nbsp;uchar&nbsp;*&nbsp;buf, uint&nbsp;len, const&nbsp;char&nbsp;*&nbsp;format = 0, <a href="tqpixmap.html#ColorMode-enum">ColorMode</a>&nbsp;mode = Auto )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Loads a pixmap from the binary data in <em>buf</em> (<em>len</em> bytes) using
color mode <em>mode</em>. Returns TRUE if successful; otherwise returns
FALSE.
<p> If <em>format</em> is specified, the loader attempts to read the pixmap
using the specified format. If <em>format</em> is not specified
(default), the loader reads a few bytes from the header to guess
the file's format.
<p> <p>See also <a href="#ColorMode-enum">TQPixmap::ColorMode</a>.

<h3 class=fn>bool <a name="loadFromData-3"></a>TQPixmap::loadFromData ( const&nbsp;<a href="tqbytearray.html">TQByteArray</a>&nbsp;&amp;&nbsp;buf, const&nbsp;char&nbsp;*&nbsp;format = 0, int&nbsp;conversion_flags = 0 )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> 
<h3 class=fn>const&nbsp;<a href="tqbitmap.html">TQBitmap</a>&nbsp;* <a name="mask"></a>TQPixmap::mask () const
</h3>

<p> Returns the mask bitmap, or 0 if no mask has been set.
<p> <p>See also <a href="#setMask">setMask</a>(), <a href="tqbitmap.html">TQBitmap</a>, and <a href="#hasAlpha">hasAlpha</a>().

<h3 class=fn>int <a name="metric"></a>TQPixmap::metric ( int&nbsp;m ) const<tt> [virtual protected]</tt>
</h3>
Internal implementation of the virtual TQPaintDevice::metric() function.
<p> Use the <a href="tqpaintdevicemetrics.html">TQPaintDeviceMetrics</a> class instead.
<p> <em>m</em> is the metric to get.

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

<h3 class=fn><a href="tqpixmap.html">TQPixmap</a>&nbsp;&amp; <a name="operator-eq-2"></a>TQPixmap::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 pixmap that is assigned to this
pixmap. Returns a reference to the pixmap.
<p> <p>See also <a href="#convertFromImage">convertFromImage</a>().

<h3 class=fn><a href="tqpixmap.html#Optimization-enum">Optimization</a> <a name="optimization"></a>TQPixmap::optimization () const
</h3>

<p> Returns the optimization setting for this pixmap.
<p> The default optimization setting is <a href="#Optimization-enum">TQPixmap::NormalOptim</a>. You
can change this setting in two ways:
<ul>
<li> Call <a href="#setDefaultOptimization">setDefaultOptimization</a>() to set the default optimization
for all new pixmaps.
<li> Call <a href="#setOptimization">setOptimization</a>() to set the optimization for individual
pixmaps.
</ul>
<p> <p>See also <a href="#setOptimization">setOptimization</a>(), <a href="#setDefaultOptimization">setDefaultOptimization</a>(), and <a href="#defaultOptimization">defaultOptimization</a>().

<h3 class=fn><a href="tqrect.html">TQRect</a> <a name="rect"></a>TQPixmap::rect () const
</h3>

<p> Returns the enclosing rectangle (0,0,width(),height()) of the pixmap.
<p> <p>See also <a href="#width">width</a>(), <a href="#height">height</a>(), and <a href="#size">size</a>().

<h3 class=fn>void <a name="resize"></a>TQPixmap::resize ( int&nbsp;w, int&nbsp;h )
</h3>
Resizes the pixmap to <em>w</em> width and <em>h</em> height. If either <em>w</em>
or <em>h</em> is 0, the pixmap becomes a null pixmap.
<p> If both <em>w</em> and <em>h</em> are greater than 0, a valid pixmap is
created. New pixels will be uninitialized (random) if the pixmap
is expanded.

<p>Examples: <a href="desktop-example.html#x1744">desktop/desktop.cpp</a> and <a href="grapher-nsplugin-example.html#x2766">grapher/grapher.cpp</a>.
<h3 class=fn>void <a name="resize-2"></a>TQPixmap::resize ( const&nbsp;<a href="tqsize.html">TQSize</a>&nbsp;&amp;&nbsp;size )
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Resizes the pixmap to size <em>size</em>.

<h3 class=fn>bool <a name="save"></a>TQPixmap::save ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;fileName, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const
</h3>
Saves the pixmap to the file <em>fileName</em> using the image file
format <em>format</em> and a quality factor <em>quality</em>. <em>quality</em> must
be in the range [0,100] or -1. Specify 0 to obtain small
compressed files, 100 for large uncompressed files, and -1 to use
the default settings. Returns TRUE if successful; otherwise
returns FALSE.
<p> <p>See also <a href="#load">load</a>(), <a href="#loadFromData">loadFromData</a>(), <a href="#imageFormat">imageFormat</a>(), <a href="tqimage.html#save">TQImage::save</a>(), and <a href="tqimageio.html">TQImageIO</a>.

<p>Example: <a href="qmag-example.html#x1786">qmag/qmag.cpp</a>.
<h3 class=fn>bool <a name="save-2"></a>TQPixmap::save ( <a href="tqiodevice.html">TQIODevice</a>&nbsp;*&nbsp;device, const&nbsp;char&nbsp;*&nbsp;format, int&nbsp;quality = -1 ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> This function writes a TQPixmap to the <a href="tqiodevice.html">TQIODevice</a>, <em>device</em>. This
can be used, for example, to save a pixmap directly into a
TQByteArray:
<pre>
    TQPixmap pixmap;
    <a href="tqbytearray.html">TQByteArray</a> ba;
    <a href="tqbuffer.html">TQBuffer</a> buffer( ba );
    buffer.<a href="tqiodevice.html#open">open</a>( <a href="tqfile.html#open">IO_WriteOnly</a> );
    pixmap.<a href="#save">save</a>( &amp;buffer, "PNG" ); // writes pixmap into ba in PNG format
    </pre>
 

<h3 class=fn>bool <a name="selfMask"></a>TQPixmap::selfMask () const
</h3>

<p> Returns TRUE if the pixmap's mask is identical to the pixmap
itself; otherwise returns FALSE.
<p> <p>See also <a href="#mask">mask</a>().

<h3 class=fn>int <a name="serialNumber"></a>TQPixmap::serialNumber () const
</h3>

<p> Returns a number that uniquely identifies the contents of this
TQPixmap object. This means that multiple TQPixmap objects can have
the same serial number as long as they refer to the same contents.
<p> An example of where this is useful is for caching TQPixmaps.
<p> <p>See also <a href="tqpixmapcache.html">TQPixmapCache</a>.

<h3 class=fn>void <a name="setDefaultOptimization"></a>TQPixmap::setDefaultOptimization ( <a href="tqpixmap.html#Optimization-enum">Optimization</a>&nbsp;optimization )<tt> [static]</tt>
</h3>
Sets the default pixmap optimization.
<p> All <em>new</em> pixmaps that are created will use this default
optimization. You may also set optimization for individual pixmaps
using the <a href="#setOptimization">setOptimization</a>() function.
<p> The initial default <em>optimization</em> setting is <tt>TQPixmap::Normal</tt>.
<p> <p>See also <a href="#defaultOptimization">defaultOptimization</a>(), <a href="#setOptimization">setOptimization</a>(), and <a href="#optimization">optimization</a>().

<h3 class=fn>void <a name="setMask"></a>TQPixmap::setMask ( const&nbsp;<a href="tqbitmap.html">TQBitmap</a>&nbsp;&amp;&nbsp;newmask )
</h3>
Sets a mask bitmap.
<p> The <em>newmask</em> bitmap defines the clip mask for this pixmap. Every
pixel in <em>newmask</em> corresponds to a pixel in this pixmap. Pixel
value 1 means opaque and pixel value 0 means transparent. The mask
must have the same size as this pixmap.
<p> <b>Warning:</b> Setting the mask on a pixmap will cause any alpha channel
data to be cleared. For example:
<pre>
        TQPixmap alpha( "image-with-alpha.png" );
        TQPixmap alphacopy = alpha;
        alphacopy.<a href="#setMask">setMask</a>( *alphacopy.<a href="#mask">mask</a>() );
    </pre>
 
Now, alpha and alphacopy are visually different.
<p> Setting a <a href="#isNull">null</a> mask resets the mask.
<p> <p>See also <a href="#mask">mask</a>(), <a href="#createHeuristicMask">createHeuristicMask</a>(), and <a href="tqbitmap.html">TQBitmap</a>.

<h3 class=fn>void <a name="setOptimization"></a>TQPixmap::setOptimization ( <a href="tqpixmap.html#Optimization-enum">Optimization</a>&nbsp;optimization )
</h3>
Sets pixmap drawing optimization for this pixmap.
<p> The <em>optimization</em> setting affects pixmap operations, in
particular drawing of transparent pixmaps (<a href="tqpaintdevice.html#bitBlt">bitBlt</a>() a pixmap with
a mask set) and pixmap transformations (the <a href="#xForm">xForm</a>() function).
<p> Pixmap optimization involves keeping intermediate results in a
cache buffer and using the cache to speed up bitBlt() and xForm().
The cost is more memory consumption, up to twice as much as an
unoptimized pixmap.
<p> Use the <a href="#setDefaultOptimization">setDefaultOptimization</a>() to change the default
optimization for all new pixmaps.
<p> <p>See also <a href="#optimization">optimization</a>(), <a href="#setDefaultOptimization">setDefaultOptimization</a>(), and <a href="#defaultOptimization">defaultOptimization</a>().

<p>Example: <a href="desktop-example.html#x1745">desktop/desktop.cpp</a>.
<h3 class=fn><a href="tqsize.html">TQSize</a> <a name="size"></a>TQPixmap::size () const
</h3>

<p> Returns the size of the pixmap.
<p> <p>See also <a href="#width">width</a>(), <a href="#height">height</a>(), and <a href="#rect">rect</a>().

<p>Example: <a href="movies-example.html#x512">movies/main.cpp</a>.
<h3 class=fn><a href="tqwmatrix.html">TQWMatrix</a> <a name="trueMatrix"></a>TQPixmap::trueMatrix ( const&nbsp;<a href="tqwmatrix.html">TQWMatrix</a>&nbsp;&amp;&nbsp;matrix, int&nbsp;w, int&nbsp;h )<tt> [static]</tt>
</h3>
Returns the actual matrix used for transforming a pixmap with <em>w</em>
width and <em>h</em> height and matrix <em>matrix</em>.
<p> When transforming a pixmap with <a href="#xForm">xForm</a>(), the <a href="tqwmatrix.html#TransformationMode">transformation matrix</a>
is internally adjusted to compensate for unwanted translation,
i.e. xForm() returns the smallest pixmap containing all
transformed points of the original pixmap.
<p> This function returns the modified matrix, which maps points
correctly from the original pixmap into the new pixmap.
<p> <p>See also <a href="#xForm">xForm</a>() and <a href="tqwmatrix.html">TQWMatrix</a>.

<h3 class=fn>int <a name="width"></a>TQPixmap::width () const
</h3>

<p> Returns the width of the pixmap.
<p> <p>See also <a href="#height">height</a>(), <a href="#size">size</a>(), and <a href="#rect">rect</a>().

<p>Examples: <a href="desktop-example.html#x1746">desktop/desktop.cpp</a>, <a href="movies-example.html#x513">movies/main.cpp</a>, <a href="scribble-example.html#x922">scribble/scribble.cpp</a>, <a href="scrollview-example.html#x641">scrollview/scrollview.cpp</a>, and <a href="xform-example.html#x1248">xform/xform.cpp</a>.
<h3 class=fn><a href="tqpixmap.html">TQPixmap</a> <a name="xForm"></a>TQPixmap::xForm ( const&nbsp;<a href="tqwmatrix.html">TQWMatrix</a>&nbsp;&amp;&nbsp;matrix ) const
</h3>
Returns a copy of the pixmap that is transformed using <em>matrix</em>.
The original pixmap is not changed.
<p> The transformation <em>matrix</em> is internally adjusted to compensate
for unwanted translation, i.e. <a href="#xForm">xForm</a>() returns the smallest image
that contains all the transformed points of the original image.
<p> This function is slow because it involves transformation to a
<a href="tqimage.html">TQImage</a>, non-trivial computations and a transformation back to a
TQPixmap.
<p> <p>See also <a href="#trueMatrix">trueMatrix</a>(), <a href="tqwmatrix.html">TQWMatrix</a>, <a href="tqpainter.html#setWorldMatrix">TQPainter::setWorldMatrix</a>(), and <a href="tqimage.html#xForm">TQImage::xForm</a>().

<p>Examples: <a href="desktop-example.html#x1747">desktop/desktop.cpp</a>, <a href="fileiconview-example.html#x863">fileiconview/tqfileiconview.cpp</a>, <a href="movies-example.html#x514">movies/main.cpp</a>, and <a href="qmag-example.html#x1787">qmag/qmag.cpp</a>.
<hr><h2>Related Functions</h2>
<h3 class=fn>void <a name="copyBlt"></a>copyBlt ( <a href="tqpixmap.html">TQPixmap</a>&nbsp;*&nbsp;dst, int&nbsp;dx, int&nbsp;dy, const&nbsp;<a href="tqpixmap.html">TQPixmap</a>&nbsp;*&nbsp;src, int&nbsp;sx, int&nbsp;sy, int&nbsp;sw, int&nbsp;sh )
</h3>

<p> Copies a block of pixels from <em>src</em> to <em>dst</em>.  The alpha channel
and mask data (if any) is also copied from <em>src</em>.  NOTE: <em>src</em>
is <em>not</em> alpha blended or masked when copied to <em>dst</em>.  Use
<a href="tqpaintdevice.html#bitBlt">bitBlt</a>() or <a href="tqpainter.html#drawPixmap">TQPainter::drawPixmap</a>() to perform alpha blending or
masked drawing.
<p> <em>sx</em>, <em>sy</em> is the top-left pixel in <em>src</em> (0, 0 by default), <em>dx</em>, <em>dy</em> is the top-left position in <em>dst</em> and <em>sw</em>, \sh is the
size of the copied block (all of <em>src</em> by default).
<p> If <em>src</em>, <em>dst</em>, <em>sw</em> or <em>sh</em> is 0 (zero), <a href="#copyBlt">copyBlt</a>() does
nothing.  If <em>sw</em> or <em>sh</em> is negative, copyBlt() copies starting
at <em>sx</em> (and respectively, <em>sy</em>) and ending at the right edge
(and respectively, the bottom edge) of <em>src</em>.
<p> copyBlt() does nothing if <em>src</em> and <em>dst</em> have different depths.

<h3 class=fn><a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="tqpixmap.html">TQPixmap</a>&nbsp;&amp;&nbsp;pixmap )
</h3>

<p> Writes the pixmap <em>pixmap</em> to the stream <em>s</em> as a PNG image.
<p> Note that writing the stream to a file will not produce a valid image file.
<p> <p>See also <a href="#save">TQPixmap::save</a>() and <a href="datastreamformat.html">Format of the TQDataStream operators</a>.

<h3 class=fn><a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="tqdatastream.html">TQDataStream</a>&nbsp;&amp;&nbsp;s, <a href="tqpixmap.html">TQPixmap</a>&nbsp;&amp;&nbsp;pixmap )
</h3>

<p> Reads a pixmap from the stream <em>s</em> into the pixmap <em>pixmap</em>.
<p> <p>See also <a href="#load">TQPixmap::load</a>() and <a href="datastreamformat.html">Format of the TQDataStream operators</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>