source: vendor/trolltech/current/src/kernel/qpixmap.cpp

Last change on this file was 2, checked in by dmik, 20 years ago

Imported xplatform parts of the official release 3.3.1 from Trolltech

  • Property svn:keywords set to Id
File size: 42.0 KB
Line 
1/****************************************************************************
2** $Id: qpixmap.cpp 2 2005-11-16 15:49:26Z dmik $
3**
4** Implementation of QPixmap class
5**
6** Created : 950301
7**
8** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
9**
10** This file is part of the kernel module of the Qt GUI Toolkit.
11**
12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file.
15**
16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file.
20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software.
24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32**
33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you.
35**
36**********************************************************************/
37
38#include "qpixmap.h"
39
40#include "qbitmap.h"
41#include "qimage.h"
42#include "qwidget.h"
43#include "qpainter.h"
44#include "qdatastream.h"
45#include "qbuffer.h"
46#include "qobjectlist.h"
47#include "qapplication.h"
48#include <private/qinternal_p.h>
49#include "qmime.h"
50#include "qdragobject.h"
51#include "qfile.h"
52
53/*!
54 \class QPixmap qpixmap.h
55 \brief The QPixmap class is an off-screen, pixel-based paint device.
56
57 \ingroup graphics
58 \ingroup images
59 \ingroup shared
60 \mainclass
61
62 QPixmap is one of the two classes Qt provides for dealing with
63 images; the other is QImage. QPixmap is designed and optimized
64 for drawing; QImage is designed and optimized for I/O and for
65 direct pixel access/manipulation. There are (slow) functions to
66 convert between QImage and QPixmap: convertToImage() and
67 convertFromImage().
68
69 One common use of the QPixmap class is to enable smooth updating
70 of widgets. Whenever something complex needs to be drawn, you can
71 use a pixmap to obtain flicker-free drawing, like this:
72
73 \list 1
74 \i Create a pixmap with the same size as the widget.
75 \i Fill the pixmap with the widget background color.
76 \i Paint the pixmap.
77 \i bitBlt() the pixmap contents onto the widget.
78 \endlist
79
80 Pixel data in a pixmap is internal and is managed by the
81 underlying window system. Pixels can be accessed only through
82 QPainter functions, through bitBlt(), and by converting the
83 QPixmap to a QImage.
84
85 You can easily display a QPixmap on the screen using
86 QLabel::setPixmap(). For example, all the QButton subclasses
87 support pixmap use.
88
89 The QPixmap class uses \link shclass.html copy-on-write\endlink,
90 so it is practical to pass QPixmap objects by value.
91
92 You can retrieve the width(), height(), depth() and size() of a
93 pixmap. The enclosing rectangle is given by rect(). Pixmaps can be
94 filled with fill() and resized with resize(). You can create and
95 set a mask with createHeuristicMask() and setMask(). Use
96 selfMask() to see if the pixmap is identical to its mask.
97
98 In addition to loading a pixmap from file using load() you can
99 also loadFromData(). You can control optimization with
100 setOptimization() and obtain a transformed version of the pixmap
101 using xForm()
102
103 Note regarding Windows 95 and 98: on Windows 9x the system crashes
104 if you create more than about 1000 pixmaps, independent of the
105 size of the pixmaps or installed RAM. Windows NT-systems (including
106 2000, XP and following versions) do not have the same limitation,
107 but depending on the graphics equipment the system will fail to
108 allocate pixmap objects at some point (due to system running out of
109 GDI resources).
110
111 Qt tries to work around the resource limitation. If you set the
112 pixmap optimization to \c QPixmap::MemoryOptim and the width of
113 your pixmap is less than or equal to 128 pixels, Qt stores the
114 pixmap in a way that is very memory-efficient when there are many
115 pixmaps.
116
117 If your application uses dozens or hundreds of pixmaps (for
118 example on tool bar buttons and in popup menus), and you plan to
119 run it on Windows 95 or Windows 98, we recommend using code like
120 this:
121
122 \code
123 QPixmap::setDefaultOptimization( QPixmap::MemoryOptim );
124 while ( ... ) {
125 // load tool bar pixmaps etc.
126 QPixmap *pixmap = new QPixmap(fileName);
127 }
128 QPixmap::setDefaultOptimization( QPixmap::NormalOptim );
129 \endcode
130
131 In general it is recommended to make as much use of QPixmap's
132 implicit sharing and the QPixmapCache as possible.
133
134 \sa QBitmap, QImage, QImageIO, \link shclass.html Shared Classes\endlink
135*/
136
137/*!
138 \enum QPixmap::ColorMode
139
140 This enum type defines the color modes that exist for converting
141 QImage objects to QPixmap.
142
143 \value Auto Select \c Color or \c Mono on a case-by-case basis.
144 \value Color Always create colored pixmaps.
145 \value Mono Always create bitmaps.
146*/
147
148/*!
149 \enum QPixmap::Optimization
150
151 QPixmap has the choice of optimizing for speed or memory in a few
152 places; the best choice varies from pixmap to pixmap but can
153 generally be derived heuristically. This enum type defines a
154 number of optimization modes that you can set for any pixmap to
155 tweak the speed/memory tradeoffs:
156
157 \value DefaultOptim Whatever QPixmap::defaultOptimization()
158 returns. A pixmap with this optimization will have whatever
159 the current default optimization is. If the default
160 optimization is changed using setDefaultOptimization(), then
161 this will not effect any pixmaps that have already been
162 created.
163
164 \value NoOptim No optimization (currently the same as \c
165 MemoryOptim).
166
167 \value MemoryOptim Optimize for minimal memory use on Windows
168 9x and X11 systems.
169
170 \value NormalOptim Optimize for typical usage. Often uses more
171 memory than \c MemoryOptim, and is often faster.
172
173 \value BestOptim Optimize for pixmaps that are drawn very often
174 and where performance is critical. Generally uses more memory
175 than \c NormalOptim and may provide a little more speed.
176
177 We recommend using \c DefaultOptim.
178
179*/
180
181
182QPixmap::Optimization QPixmap::defOptim = QPixmap::NormalOptim;
183
184
185/*!
186 \internal
187 Private constructor which takes the bitmap flag, the optimization.and a screen.
188*/
189
190QPixmap::QPixmap( int w, int h, int depth, bool bitmap,
191 Optimization optimization )
192 : QPaintDevice( QInternal::Pixmap )
193{
194 init( w, h, depth, bitmap, optimization );
195}
196
197
198/*!
199 Constructs a null pixmap.
200
201 \sa isNull()
202*/
203
204QPixmap::QPixmap()
205 : QPaintDevice( QInternal::Pixmap )
206{
207 init( 0, 0, 0, FALSE, defOptim );
208}
209
210/*!
211 Constructs a pixmap from the QImage \a image.
212
213 \sa convertFromImage()
214*/
215
216QPixmap::QPixmap( const QImage& image )
217 : QPaintDevice( QInternal::Pixmap )
218{
219 init( 0, 0, 0, FALSE, defOptim );
220 convertFromImage( image );
221}
222
223/*!
224 Constructs a pixmap with \a w width, \a h height and \a depth bits
225 per pixel. The pixmap is optimized in accordance with the \a
226 optimization value.
227
228 The contents of the pixmap is uninitialized.
229
230 The \a depth can be either 1 (monochrome) or the depth of the
231 current video mode. If \a depth is negative, then the hardware
232 depth of the current video mode will be used.
233
234 If either \a w or \a h is zero, a null pixmap is constructed.
235
236 \sa isNull() QPixmap::Optimization
237*/
238
239QPixmap::QPixmap( int w, int h, int depth, Optimization optimization )
240 : QPaintDevice( QInternal::Pixmap )
241{
242 init( w, h, depth, FALSE, optimization );
243}
244
245/*!
246 \overload QPixmap::QPixmap( const QSize &size, int depth, Optimization optimization )
247
248 Constructs a pixmap of size \a size, \a depth bits per pixel,
249 optimized in accordance with the \a optimization value.
250*/
251
252QPixmap::QPixmap( const QSize &size, int depth, Optimization optimization )
253 : QPaintDevice( QInternal::Pixmap )
254{
255 init( size.width(), size.height(), depth, FALSE, optimization );
256}
257
258#ifndef QT_NO_IMAGEIO
259/*!
260 Constructs a pixmap from the file \a fileName. If the file does
261 not exist or is of an unknown format, the pixmap becomes a null
262 pixmap.
263
264 The \a fileName, \a format and \a conversion_flags parameters are
265 passed on to load(). This means that the data in \a fileName is
266 not compiled into the binary. If \a fileName contains a relative
267 path (e.g. the filename only) the relevant file must be found
268 relative to the runtime working directory.
269
270 If the image needs to be modified to fit in a lower-resolution
271 result (e.g. converting from 32-bit to 8-bit), use the \a
272 conversion_flags to specify how you'd prefer this to happen.
273
274 \sa Qt::ImageConversionFlags isNull(), load(), loadFromData(), save(), imageFormat()
275*/
276
277QPixmap::QPixmap( const QString& fileName, const char *format,
278 int conversion_flags )
279 : QPaintDevice( QInternal::Pixmap )
280{
281 init( 0, 0, 0, FALSE, defOptim );
282 load( fileName, format, conversion_flags );
283}
284
285/*!
286 Constructs a pixmap from the file \a fileName. If the file does
287 not exist or is of an unknown format, the pixmap becomes a null
288 pixmap.
289
290 The \a fileName, \a format and \a mode parameters are passed on to
291 load(). This means that the data in \a fileName is not compiled
292 into the binary. If \a fileName contains a relative path (e.g. the
293 filename only) the relevant file must be found relative to the
294 runtime working directory.
295
296 \sa QPixmap::ColorMode isNull(), load(), loadFromData(), save(), imageFormat()
297*/
298
299QPixmap::QPixmap( const QString& fileName, const char *format, ColorMode mode )
300 : QPaintDevice( QInternal::Pixmap )
301{
302 init( 0, 0, 0, FALSE, defOptim );
303 load( fileName, format, mode );
304}
305
306/*!
307 Constructs a pixmap from \a xpm, which must be a valid XPM image.
308
309 Errors are silently ignored.
310
311 Note that it's possible to squeeze the XPM variable a little bit
312 by using an unusual declaration:
313
314 \code
315 static const char * const start_xpm[]={
316 "16 15 8 1",
317 "a c #cec6bd",
318 ....
319 \endcode
320
321 The extra \c const makes the entire definition read-only, which is
322 slightly more efficient (for example, when the code is in a shared
323 library) and ROMable when the application is to be stored in ROM.
324
325 In order to use that sort of declaration you must cast the
326 variable back to \c{const char **} when you create the QPixmap.
327*/
328
329QPixmap::QPixmap( const char *xpm[] )
330 : QPaintDevice( QInternal::Pixmap )
331{
332 init( 0, 0, 0, FALSE, defOptim );
333 QImage image( xpm );
334 if ( !image.isNull() )
335 convertFromImage( image );
336}
337
338/*!
339 Constructs a pixmaps by loading from \a img_data. The data can be
340 in any image format supported by Qt.
341
342 \sa loadFromData()
343*/
344
345QPixmap::QPixmap( const QByteArray & img_data )
346 : QPaintDevice( QInternal::Pixmap )
347{
348 init( 0, 0, 0, FALSE, defOptim );
349 loadFromData( img_data );
350}
351#endif //QT_NO_IMAGEIO
352
353/*!
354 Constructs a pixmap that is a copy of \a pixmap.
355*/
356
357QPixmap::QPixmap( const QPixmap &pixmap )
358 : QPaintDevice( QInternal::Pixmap )
359{
360 if ( pixmap.paintingActive() ) { // make a deep copy
361 data = 0;
362 operator=( pixmap.copy() );
363 } else {
364 data = pixmap.data;
365 data->ref();
366 devFlags = pixmap.devFlags; // copy QPaintDevice flags
367#if defined(Q_WS_WIN)
368 hdc = pixmap.hdc; // copy Windows device context
369#elif defined(Q_WS_X11)
370 hd = pixmap.hd; // copy X11 drawable
371 rendhd = pixmap.rendhd;
372 copyX11Data( &pixmap ); // copy x11Data
373#elif defined(Q_WS_MAC)
374 hd = pixmap.hd;
375#endif
376 }
377}
378
379
380/*!
381 Destroys the pixmap.
382*/
383
384QPixmap::~QPixmap()
385{
386 deref();
387}
388
389/*! Convenience function. Gets the data associated with the absolute
390 name \a abs_name from the default mime source factory and decodes it
391 to a pixmap.
392
393 \sa QMimeSourceFactory, QImage::fromMimeSource(), QImageDrag::decode()
394*/
395
396#ifndef QT_NO_MIME
397QPixmap QPixmap::fromMimeSource( const QString &abs_name )
398{
399 const QMimeSource *m = QMimeSourceFactory::defaultFactory()->data( abs_name );
400 if ( !m ) {
401 if ( QFile::exists( abs_name ) )
402 return QPixmap( abs_name );
403#if defined(QT_CHECK_STATE)
404 if ( !abs_name.isEmpty() )
405 qWarning( "QPixmap::fromMimeSource: Cannot find pixmap \"%s\" in the mime source factory",
406 abs_name.latin1() );
407#endif
408 return QPixmap();
409 }
410 QPixmap pix;
411 QImageDrag::decode( m, pix );
412 return pix;
413}
414#endif
415
416/*!
417 Returns a \link shclass.html deep copy\endlink of the pixmap using
418 the bitBlt() function to copy the pixels.
419
420 \sa operator=()
421*/
422
423QPixmap QPixmap::copy( bool ignoreMask ) const
424{
425#if defined(Q_WS_X11)
426 int old = x11SetDefaultScreen( x11Screen() );
427#endif // Q_WS_X11
428
429 QPixmap pm( data->w, data->h, data->d, data->bitmap, data->optim );
430
431 if ( !pm.isNull() ) { // copy the bitmap
432#if defined(Q_WS_X11)
433 pm.cloneX11Data( this );
434#endif // Q_WS_X11
435
436 if ( ignoreMask )
437 bitBlt( &pm, 0, 0, this, 0, 0, data->w, data->h, Qt::CopyROP, TRUE );
438 else
439 copyBlt( &pm, 0, 0, this, 0, 0, data->w, data->h );
440 }
441
442#if defined(Q_WS_X11)
443 x11SetDefaultScreen( old );
444#endif // Q_WS_X11
445
446 return pm;
447}
448
449
450/*!
451 Assigns the pixmap \a pixmap to this pixmap and returns a
452 reference to this pixmap.
453*/
454
455QPixmap &QPixmap::operator=( const QPixmap &pixmap )
456{
457 if ( paintingActive() ) {
458#if defined(QT_CHECK_STATE)
459 qWarning("QPixmap::operator=: Cannot assign to pixmap during painting");
460#endif
461 return *this;
462 }
463 pixmap.data->ref(); // avoid 'x = x'
464 deref();
465 if ( pixmap.paintingActive() ) { // make a deep copy
466 init( pixmap.width(), pixmap.height(), pixmap.depth(),
467 pixmap.data->bitmap, pixmap.data->optim );
468 data->uninit = FALSE;
469 if ( !isNull() )
470 copyBlt( this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height() );
471 pixmap.data->deref();
472 } else {
473 data = pixmap.data;
474 devFlags = pixmap.devFlags; // copy QPaintDevice flags
475#if defined(Q_WS_WIN)
476 hdc = pixmap.hdc;
477#elif defined(Q_WS_X11)
478 hd = pixmap.hd; // copy QPaintDevice drawable
479 rendhd = pixmap.rendhd;
480 copyX11Data( &pixmap ); // copy x11Data
481#elif defined(Q_WS_MACX) || defined(Q_OS_MAC9)
482 hd = pixmap.hd;
483#endif
484 }
485 return *this;
486}
487
488
489/*!
490 \overload
491
492 Converts the image \a image to a pixmap that is assigned to this
493 pixmap. Returns a reference to the pixmap.
494
495 \sa convertFromImage().
496*/
497
498QPixmap &QPixmap::operator=( const QImage &image )
499{
500 convertFromImage( image );
501 return *this;
502}
503
504
505/*!
506 \fn bool QPixmap::isQBitmap() const
507
508 Returns TRUE if this is a QBitmap; otherwise returns FALSE.
509*/
510
511/*!
512 \fn bool QPixmap::isNull() const
513
514 Returns TRUE if this is a null pixmap; otherwise returns FALSE.
515
516 A null pixmap has zero width, zero height and no contents. You
517 cannot draw in a null pixmap or bitBlt() anything to it.
518
519 Resizing an existing pixmap to (0, 0) makes a pixmap into a null
520 pixmap.
521
522 \sa resize()
523*/
524
525/*!
526 \fn int QPixmap::width() const
527
528 Returns the width of the pixmap.
529
530 \sa height(), size(), rect()
531*/
532
533/*!
534 \fn int QPixmap::height() const
535
536 Returns the height of the pixmap.
537
538 \sa width(), size(), rect()
539*/
540
541/*!
542 \fn QSize QPixmap::size() const
543
544 Returns the size of the pixmap.
545
546 \sa width(), height(), rect()
547*/
548
549/*!
550 \fn QRect QPixmap::rect() const
551
552 Returns the enclosing rectangle (0,0,width(),height()) of the pixmap.
553
554 \sa width(), height(), size()
555*/
556
557/*!
558 \fn int QPixmap::depth() const
559
560 Returns the depth of the pixmap.
561
562 The pixmap depth is also called bits per pixel (bpp) or bit planes
563 of a pixmap. A null pixmap has depth 0.
564
565 \sa defaultDepth(), isNull(), QImage::convertDepth()
566*/
567
568
569/*!
570 \overload void QPixmap::fill( const QWidget *widget, const QPoint &ofs )
571
572 Fills the pixmap with the \a widget's background color or pixmap.
573 If the background is empty, nothing is done.
574
575 The \a ofs point is an offset in the widget.
576
577 The point \a ofs is a point in the widget's coordinate system. The
578 pixmap's top-left pixel will be mapped to the point \a ofs in the
579 widget. This is significant if the widget has a background pixmap;
580 otherwise the pixmap will simply be filled with the background
581 color of the widget.
582
583 Example:
584 \code
585 void CuteWidget::paintEvent( QPaintEvent *e )
586 {
587 QRect ur = e->rect(); // rectangle to update
588 QPixmap pix( ur.size() ); // Pixmap for double-buffering
589 pix.fill( this, ur.topLeft() ); // fill with widget background
590
591 QPainter p( &pix );
592 p.translate( -ur.x(), -ur.y() ); // use widget coordinate system
593 // when drawing on pixmap
594 // ... draw on pixmap ...
595
596 p.end();
597
598 bitBlt( this, ur.topLeft(), &pix );
599 }
600 \endcode
601*/
602
603/*!
604 \overload void QPixmap::fill( const QWidget *widget, int xofs, int yofs )
605
606 Fills the pixmap with the \a widget's background color or pixmap.
607 If the background is empty, nothing is done. \a xofs, \a yofs is
608 an offset in the widget.
609*/
610
611void QPixmap::fill( const QWidget *widget, int xofs, int yofs )
612{
613 const QPixmap* bgpm = widget->backgroundPixmap();
614 fill( widget->backgroundColor() );
615 if ( bgpm ) {
616 if ( !bgpm->isNull() ) {
617 QPoint ofs = widget->backgroundOffset();
618 xofs += ofs.x();
619 yofs += ofs.y();
620
621 QPainter p;
622 p.begin( this );
623 p.setPen( NoPen );
624 p.drawTiledPixmap( 0, 0, width(), height(), *widget->backgroundPixmap(), xofs, yofs );
625 p.end();
626 }
627 }
628}
629
630
631/*!
632 \overload void QPixmap::resize( const QSize &size )
633
634 Resizes the pixmap to size \a size.
635*/
636
637/*!
638 Resizes the pixmap to \a w width and \a h height. If either \a w
639 or \a h is 0, the pixmap becomes a null pixmap.
640
641 If both \a w and \a h are greater than 0, a valid pixmap is
642 created. New pixels will be uninitialized (random) if the pixmap
643 is expanded.
644*/
645
646void QPixmap::resize( int w, int h )
647{
648 if ( w < 1 || h < 1 ) { // becomes null
649 QPixmap pm( 0, 0, 0, data->bitmap, data->optim );
650 *this = pm;
651 return;
652 }
653 int d;
654 if ( depth() > 0 )
655 d = depth();
656 else
657 d = isQBitmap() ? 1 : -1;
658 // Create new pixmap
659 QPixmap pm( w, h, d, data->bitmap, data->optim );
660#ifdef Q_WS_X11
661 pm.x11SetScreen( x11Screen() );
662#endif // Q_WS_X11
663 if ( !data->uninit && !isNull() ) // has existing pixmap
664 bitBlt( &pm, 0, 0, this, 0, 0, // copy old pixmap
665 QMIN(width(), w),
666 QMIN(height(),h), CopyROP, TRUE );
667#if defined(Q_WS_MAC)
668 if(data->alphapm) {
669 data->alphapm->resize(w, h);
670 } else
671#elif defined(Q_WS_X11) && !defined(QT_NO_XFTFREETYPE)
672 if (data->alphapm)
673 qWarning("QPixmap::resize: TODO: resize alpha data");
674 else
675#endif // Q_WS_X11
676 if ( data->mask ) { // resize mask as well
677 if ( data->selfmask ) { // preserve self-mask
678 pm.setMask( *((QBitmap*)&pm) );
679 } else { // independent mask
680 QBitmap m = *data->mask;
681 m.resize( w, h );
682 pm.setMask( m );
683 }
684 }
685 *this = pm;
686}
687
688
689/*!
690 \fn const QBitmap *QPixmap::mask() const
691
692 Returns the mask bitmap, or 0 if no mask has been set.
693
694 \sa setMask(), QBitmap, hasAlpha()
695*/
696
697/*!
698 Sets a mask bitmap.
699
700 The \a newmask bitmap defines the clip mask for this pixmap. Every
701 pixel in \a newmask corresponds to a pixel in this pixmap. Pixel
702 value 1 means opaque and pixel value 0 means transparent. The mask
703 must have the same size as this pixmap.
704
705 \warning Setting the mask on a pixmap will cause any alpha channel
706 data to be cleared. For example:
707 \code
708 QPixmap alpha( "image-with-alpha.png" );
709 QPixmap alphacopy = alpha;
710 alphacopy.setMask( *alphacopy.mask() );
711 \endcode
712 Now, alpha and alphacopy are visually different.
713
714 Setting a \link isNull() null\endlink mask resets the mask.
715
716 \sa mask(), createHeuristicMask(), QBitmap
717*/
718
719void QPixmap::setMask( const QBitmap &newmask )
720{
721 const QPixmap *tmp = &newmask; // dec cxx bug
722 if ( (data == tmp->data) ||
723 ( newmask.handle() && newmask.handle() == handle() ) ) {
724 QPixmap m = tmp->copy( TRUE );
725 setMask( *((QBitmap*)&m) );
726 data->selfmask = TRUE; // mask == pixmap
727 return;
728 }
729
730 if ( newmask.isNull() ) { // reset the mask
731 if (data->mask) {
732 detach();
733 data->selfmask = FALSE;
734
735 delete data->mask;
736 data->mask = 0;
737 }
738 return;
739 }
740
741 detach();
742 data->selfmask = FALSE;
743
744 if ( newmask.width() != width() || newmask.height() != height() ) {
745#if defined(QT_CHECK_RANGE)
746 qWarning( "QPixmap::setMask: The pixmap and the mask must have "
747 "the same size" );
748#endif
749 return;
750 }
751#if defined(Q_WS_MAC) || (defined(Q_WS_X11) && !defined(QT_NO_XFTFREETYPE))
752 // when setting the mask, we get rid of the alpha channel completely
753 delete data->alphapm;
754 data->alphapm = 0;
755#endif // Q_WS_X11 && !QT_NO_XFTFREETYPE
756
757 delete data->mask;
758 QBitmap* newmaskcopy;
759 if ( newmask.mask() )
760 newmaskcopy = (QBitmap*)new QPixmap( tmp->copy( TRUE ) );
761 else
762 newmaskcopy = new QBitmap( newmask );
763#ifdef Q_WS_X11
764 newmaskcopy->x11SetScreen( x11Screen() );
765#endif
766 data->mask = newmaskcopy;
767}
768
769
770/*!
771 \fn bool QPixmap::selfMask() const
772
773 Returns TRUE if the pixmap's mask is identical to the pixmap
774 itself; otherwise returns FALSE.
775
776 \sa mask()
777*/
778
779#ifndef QT_NO_IMAGE_HEURISTIC_MASK
780/*!
781 Creates and returns a heuristic mask for this pixmap. It works by
782 selecting a color from one of the corners and then chipping away
783 pixels of that color, starting at all the edges.
784
785 The mask may not be perfect but it should be reasonable, so you
786 can do things such as the following:
787 \code
788 pm->setMask( pm->createHeuristicMask() );
789 \endcode
790
791 This function is slow because it involves transformation to a
792 QImage, non-trivial computations and a transformation back to a
793 QBitmap.
794
795 If \a clipTight is TRUE the mask is just large enough to cover the
796 pixels; otherwise, the mask is larger than the data pixels.
797
798 \sa QImage::createHeuristicMask()
799*/
800
801QBitmap QPixmap::createHeuristicMask( bool clipTight ) const
802{
803 QBitmap m;
804 m.convertFromImage( convertToImage().createHeuristicMask(clipTight) );
805 return m;
806}
807#endif
808#ifndef QT_NO_IMAGEIO
809/*!
810 Returns a string that specifies the image format of the file \a
811 fileName, or 0 if the file cannot be read or if the format cannot
812 be recognized.
813
814 The QImageIO documentation lists the supported image formats.
815
816 \sa load(), save()
817*/
818
819const char* QPixmap::imageFormat( const QString &fileName )
820{
821 return QImageIO::imageFormat(fileName);
822}
823
824/*!
825 Loads a pixmap from the file \a fileName at runtime. Returns TRUE
826 if successful; otherwise returns FALSE.
827
828 If \a format is specified, the loader attempts to read the pixmap
829 using the specified format. If \a format is not specified
830 (default), the loader reads a few bytes from the header to guess
831 the file's format.
832
833 See the convertFromImage() documentation for a description of the
834 \a conversion_flags argument.
835
836 The QImageIO documentation lists the supported image formats and
837 explains how to add extra formats.
838
839 \sa loadFromData(), save(), imageFormat(), QImage::load(),
840 QImageIO
841*/
842
843bool QPixmap::load( const QString &fileName, const char *format,
844 int conversion_flags )
845{
846 QImageIO io( fileName, format );
847 bool result = io.read();
848 if ( result ) {
849 detach(); // ###hanord: Why detach here, convertFromImage does it
850 result = convertFromImage( io.image(), conversion_flags );
851 }
852 return result;
853}
854
855/*!
856 \overload
857
858 Loads a pixmap from the file \a fileName at runtime.
859
860 If \a format is specified, the loader attempts to read the pixmap
861 using the specified format. If \a format is not specified
862 (default), the loader reads a few bytes from the header to guess
863 the file's format.
864
865 The \a mode is used to specify the color mode of the pixmap.
866
867 \sa QPixmap::ColorMode
868*/
869
870bool QPixmap::load( const QString &fileName, const char *format,
871 ColorMode mode )
872{
873 int conversion_flags = 0;
874 switch (mode) {
875 case Color:
876 conversion_flags |= ColorOnly;
877 break;
878 case Mono:
879 conversion_flags |= MonoOnly;
880 break;
881 default:
882 break;// Nothing.
883 }
884 return load( fileName, format, conversion_flags );
885}
886#endif //QT_NO_IMAGEIO
887
888/*!
889 \overload
890
891 Converts \a image and sets this pixmap using color mode \a mode.
892 Returns TRUE if successful; otherwise returns FALSE.
893
894 \sa QPixmap::ColorMode
895*/
896
897bool QPixmap::convertFromImage( const QImage &image, ColorMode mode )
898{
899 if ( image.isNull() ) {
900 // convert null image to null pixmap
901 *this = QPixmap();
902 return TRUE;
903 }
904
905 int conversion_flags = 0;
906 switch (mode) {
907 case Color:
908 conversion_flags |= ColorOnly;
909 break;
910 case Mono:
911 conversion_flags |= MonoOnly;
912 break;
913 default:
914 break;// Nothing.
915 }
916 return convertFromImage( image, conversion_flags );
917}
918
919#ifndef QT_NO_IMAGEIO
920/*!
921 Loads a pixmap from the binary data in \a buf (\a len bytes).
922 Returns TRUE if successful; otherwise returns FALSE.
923
924 If \a format is specified, the loader attempts to read the pixmap
925 using the specified format. If \a format is not specified
926 (default), the loader reads a few bytes from the header to guess
927 the file's format.
928
929 See the convertFromImage() documentation for a description of the
930 \a conversion_flags argument.
931
932 The QImageIO documentation lists the supported image formats and
933 explains how to add extra formats.
934
935 \sa load(), save(), imageFormat(), QImage::loadFromData(),
936 QImageIO
937*/
938
939bool QPixmap::loadFromData( const uchar *buf, uint len, const char *format,
940 int conversion_flags )
941{
942 QByteArray a;
943 a.setRawData( (char *)buf, len );
944 QBuffer b( a );
945 b.open( IO_ReadOnly );
946 QImageIO io( &b, format );
947 bool result = io.read();
948 b.close();
949 a.resetRawData( (char *)buf, len );
950 if ( result ) {
951 detach();
952 result = convertFromImage( io.image(), conversion_flags );
953 }
954 return result;
955}
956
957/*!
958 \overload
959
960 Loads a pixmap from the binary data in \a buf (\a len bytes) using
961 color mode \a mode. Returns TRUE if successful; otherwise returns
962 FALSE.
963
964 If \a format is specified, the loader attempts to read the pixmap
965 using the specified format. If \a format is not specified
966 (default), the loader reads a few bytes from the header to guess
967 the file's format.
968
969 \sa QPixmap::ColorMode
970*/
971
972bool QPixmap::loadFromData( const uchar *buf, uint len, const char *format,
973 ColorMode mode )
974{
975 int conversion_flags = 0;
976 switch (mode) {
977 case Color:
978 conversion_flags |= ColorOnly;
979 break;
980 case Mono:
981 conversion_flags |= MonoOnly;
982 break;
983 default:
984 break;// Nothing.
985 }
986 return loadFromData( buf, len, format, conversion_flags );
987}
988
989/*!
990 \overload
991*/
992
993bool QPixmap::loadFromData( const QByteArray &buf, const char *format,
994 int conversion_flags )
995{
996 return loadFromData( (const uchar *)(buf.data()), buf.size(),
997 format, conversion_flags );
998}
999
1000
1001/*!
1002 Saves the pixmap to the file \a fileName using the image file
1003 format \a format and a quality factor \a quality. \a quality must
1004 be in the range [0,100] or -1. Specify 0 to obtain small
1005 compressed files, 100 for large uncompressed files, and -1 to use
1006 the default settings. Returns TRUE if successful; otherwise
1007 returns FALSE.
1008
1009 \sa load(), loadFromData(), imageFormat(), QImage::save(),
1010 QImageIO
1011*/
1012
1013bool QPixmap::save( const QString &fileName, const char *format, int quality ) const
1014{
1015 if ( isNull() )
1016 return FALSE; // nothing to save
1017 QImageIO io( fileName, format );
1018 return doImageIO( &io, quality );
1019}
1020
1021/*!
1022 \overload
1023
1024 This function writes a QPixmap to the QIODevice, \a device. This
1025 can be used, for example, to save a pixmap directly into a
1026 QByteArray:
1027 \code
1028 QPixmap pixmap;
1029 QByteArray ba;
1030 QBuffer buffer( ba );
1031 buffer.open( IO_WriteOnly );
1032 pixmap.save( &buffer, "PNG" ); // writes pixmap into ba in PNG format
1033 \endcode
1034*/
1035
1036bool QPixmap::save( QIODevice* device, const char* format, int quality ) const
1037{
1038 if ( isNull() )
1039 return FALSE; // nothing to save
1040 QImageIO io( device, format );
1041 return doImageIO( &io, quality );
1042}
1043
1044/*! \internal
1045*/
1046
1047bool QPixmap::doImageIO( QImageIO* io, int quality ) const
1048{
1049 if ( !io )
1050 return FALSE;
1051 io->setImage( convertToImage() );
1052#if defined(QT_CHECK_RANGE)
1053 if ( quality > 100 || quality < -1 )
1054 qWarning( "QPixmap::save: quality out of range [-1,100]" );
1055#endif
1056 if ( quality >= 0 )
1057 io->setQuality( QMIN(quality,100) );
1058 return io->write();
1059}
1060
1061#endif //QT_NO_IMAGEIO
1062
1063/*!
1064 \fn int QPixmap::serialNumber() const
1065
1066 Returns a number that uniquely identifies the contents of this
1067 QPixmap object. This means that multiple QPixmap objects can have
1068 the same serial number as long as they refer to the same contents.
1069
1070 An example of where this is useful is for caching QPixmaps.
1071
1072 \sa QPixmapCache
1073*/
1074
1075
1076/*!
1077 Returns the default pixmap optimization setting.
1078
1079 \sa setDefaultOptimization(), setOptimization(), optimization()
1080*/
1081
1082QPixmap::Optimization QPixmap::defaultOptimization()
1083{
1084 return defOptim;
1085}
1086
1087/*!
1088 Sets the default pixmap optimization.
1089
1090 All \e new pixmaps that are created will use this default
1091 optimization. You may also set optimization for individual pixmaps
1092 using the setOptimization() function.
1093
1094 The initial default \a optimization setting is \c QPixmap::Normal.
1095
1096 \sa defaultOptimization(), setOptimization(), optimization()
1097*/
1098
1099void QPixmap::setDefaultOptimization( Optimization optimization )
1100{
1101 if ( optimization != DefaultOptim )
1102 defOptim = optimization;
1103}
1104
1105
1106// helper for next function.
1107static QPixmap grabChildWidgets( QWidget * w )
1108{
1109 QPixmap res( w->width(), w->height() );
1110 if ( res.isNull() && w->width() )
1111 return res;
1112 res.fill( w, QPoint( 0, 0 ) );
1113 QPaintDevice *oldRedirect = QPainter::redirect( w );
1114 QPainter::redirect( w, &res );
1115 bool dblbfr = QSharedDoubleBuffer::isDisabled();
1116 QSharedDoubleBuffer::setDisabled( TRUE );
1117 QPaintEvent e( w->rect(), FALSE );
1118 QApplication::sendEvent( w, &e );
1119 QSharedDoubleBuffer::setDisabled( dblbfr );
1120 QPainter::redirect( w, oldRedirect );
1121 if ( w->testWFlags( Qt::WRepaintNoErase ) )
1122 w->repaint( FALSE );
1123
1124 const QObjectList * children = w->children();
1125 if ( children ) {
1126 QPainter p( &res );
1127 QObjectListIt it( *children );
1128 QObject * child;
1129 while( (child=it.current()) != 0 ) {
1130 ++it;
1131 if ( child->isWidgetType() &&
1132 !((QWidget *)child)->isHidden() &&
1133 ((QWidget *)child)->geometry().intersects( w->rect() ) ) {
1134 // those conditions aren't quite right, it's possible
1135 // to have a grandchild completely outside its
1136 // grandparent, but partially inside its parent. no
1137 // point in optimizing for that.
1138
1139 // make sure to evaluate pos() first - who knows what
1140 // the paint event(s) inside grabChildWidgets() will do.
1141 QPoint childpos = ((QWidget *)child)->pos();
1142 QPixmap cpm = grabChildWidgets( (QWidget *)child );
1143 if ( cpm.isNull() ) {
1144 // Some child pixmap failed - abort and reset
1145 res.resize( 0, 0 );
1146 break;
1147 }
1148 p.drawPixmap( childpos, cpm);
1149 }
1150 }
1151 }
1152 return res;
1153}
1154
1155
1156/*!
1157 Creates a pixmap and paints \a widget in it.
1158
1159 If the \a widget has any children, then they are also painted in
1160 the appropriate positions.
1161
1162 If you specify \a x, \a y, \a w or \a h, only the rectangle you
1163 specify is painted. The defaults are 0, 0 (top-left corner) and
1164 -1,-1 (which means the entire widget).
1165
1166 (If \a w is negative, the function copies everything to the right
1167 border of the window. If \a h is negative, the function copies
1168 everything to the bottom of the window.)
1169
1170 If \a widget is 0, or if the rectangle defined by \a x, \a y, the
1171 modified \a w and the modified \a h does not overlap the \a
1172 {widget}->rect(), this function will return a null QPixmap.
1173
1174 This function actually asks \a widget to paint itself (and its
1175 children to paint themselves). QPixmap::grabWindow() grabs pixels
1176 off the screen, which is a bit faster and picks up \e exactly
1177 what's on-screen. This function works by calling paintEvent() with
1178 painter redirection turned on. If there are overlaying windows,
1179 grabWindow() will see them, but not this function.
1180
1181 If there is overlap, it returns a pixmap of the size you want,
1182 containing a rendering of \a widget. If the rectangle you ask for
1183 is a superset of \a widget, the areas outside \a widget are
1184 covered with the widget's background.
1185
1186 If an error occurs when trying to grab the widget, such as the
1187 size of the widget being too large to fit in memory, an isNull()
1188 pixmap is returned.
1189
1190 \sa grabWindow() QPainter::redirect() QWidget::paintEvent()
1191*/
1192
1193QPixmap QPixmap::grabWidget( QWidget * widget, int x, int y, int w, int h )
1194{
1195 QPixmap res;
1196 if ( !widget )
1197 return res;
1198
1199 if ( w < 0 )
1200 w = widget->width() - x;
1201 if ( h < 0 )
1202 h = widget->height() - y;
1203
1204 QRect wr( x, y, w, h );
1205 if ( wr == widget->rect() )
1206 return grabChildWidgets( widget );
1207 if ( !wr.intersects( widget->rect() ) )
1208 return res;
1209
1210 res.resize( w, h );
1211 if( res.isNull() )
1212 return res;
1213 res.fill( widget, QPoint( w,h ) );
1214 QPixmap tmp( grabChildWidgets( widget ) );
1215 if( tmp.isNull() )
1216 return tmp;
1217 ::bitBlt( &res, 0, 0, &tmp, x, y, w, h );
1218 return res;
1219}
1220
1221/*!
1222 Returns the actual matrix used for transforming a pixmap with \a w
1223 width and \a h height and matrix \a matrix.
1224
1225 When transforming a pixmap with xForm(), the transformation matrix
1226 is internally adjusted to compensate for unwanted translation,
1227 i.e. xForm() returns the smallest pixmap containing all
1228 transformed points of the original pixmap.
1229
1230 This function returns the modified matrix, which maps points
1231 correctly from the original pixmap into the new pixmap.
1232
1233 \sa xForm(), QWMatrix
1234*/
1235#ifndef QT_NO_PIXMAP_TRANSFORMATION
1236QWMatrix QPixmap::trueMatrix( const QWMatrix &matrix, int w, int h )
1237{
1238 const double dt = (double)0.;
1239 double x1,y1, x2,y2, x3,y3, x4,y4; // get corners
1240 double xx = (double)w;
1241 double yy = (double)h;
1242
1243 QWMatrix mat( matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), 0., 0. );
1244
1245 mat.map( dt, dt, &x1, &y1 );
1246 mat.map( xx, dt, &x2, &y2 );
1247 mat.map( xx, yy, &x3, &y3 );
1248 mat.map( dt, yy, &x4, &y4 );
1249
1250 double ymin = y1; // lowest y value
1251 if ( y2 < ymin ) ymin = y2;
1252 if ( y3 < ymin ) ymin = y3;
1253 if ( y4 < ymin ) ymin = y4;
1254 double xmin = x1; // lowest x value
1255 if ( x2 < xmin ) xmin = x2;
1256 if ( x3 < xmin ) xmin = x3;
1257 if ( x4 < xmin ) xmin = x4;
1258
1259 double ymax = y1; // lowest y value
1260 if ( y2 > ymax ) ymax = y2;
1261 if ( y3 > ymax ) ymax = y3;
1262 if ( y4 > ymax ) ymax = y4;
1263 double xmax = x1; // lowest x value
1264 if ( x2 > xmax ) xmax = x2;
1265 if ( x3 > xmax ) xmax = x3;
1266 if ( x4 > xmax ) xmax = x4;
1267
1268 if ( xmax-xmin > 1.0 )
1269 xmin -= xmin/(xmax-xmin);
1270 if ( ymax-ymin > 1.0 )
1271 ymin -= ymin/(ymax-ymin);
1272
1273 mat.setMatrix( matrix.m11(), matrix.m12(), matrix.m21(), matrix.m22(), -xmin, -ymin );
1274 return mat;
1275}
1276#endif // QT_NO_WMATRIX
1277
1278
1279
1280
1281
1282/*****************************************************************************
1283 QPixmap stream functions
1284 *****************************************************************************/
1285#if !defined(QT_NO_DATASTREAM) && !defined(QT_NO_IMAGEIO)
1286/*!
1287 \relates QPixmap
1288
1289 Writes the pixmap \a pixmap to the stream \a s as a PNG image.
1290
1291 Note that writing the stream to a file will not produce a valid image file.
1292
1293 \sa QPixmap::save()
1294 \link datastreamformat.html Format of the QDataStream operators \endlink
1295*/
1296
1297QDataStream &operator<<( QDataStream &s, const QPixmap &pixmap )
1298{
1299 s << pixmap.convertToImage();
1300 return s;
1301}
1302
1303/*!
1304 \relates QPixmap
1305
1306 Reads a pixmap from the stream \a s into the pixmap \a pixmap.
1307
1308 \sa QPixmap::load()
1309 \link datastreamformat.html Format of the QDataStream operators \endlink
1310*/
1311
1312QDataStream &operator>>( QDataStream &s, QPixmap &pixmap )
1313{
1314 QImage img;
1315 s >> img;
1316 pixmap.convertFromImage( img );
1317 return s;
1318}
1319
1320#endif //QT_NO_DATASTREAM
1321
1322
1323
1324
1325/*****************************************************************************
1326 QPixmap (and QImage) helper functions
1327 *****************************************************************************/
1328/*
1329 This internal function contains the common (i.e. platform independent) code
1330 to do a transformation of pixel data. It is used by QPixmap::xForm() and by
1331 QImage::xForm().
1332
1333 \a trueMat is the true transformation matrix (see QPixmap::trueMatrix()) and
1334 \a xoffset is an offset to the matrix.
1335
1336 \a msbfirst specifies for 1bpp images, if the MSB or LSB comes first and \a
1337 depth specifies the colordepth of the data.
1338
1339 \a dptr is a pointer to the destination data, \a dbpl specifies the bits per
1340 line for the destination data, \a p_inc is the offset that we advance for
1341 every scanline and \a dHeight is the height of the destination image.
1342
1343 \a sprt is the pointer to the source data, \a sbpl specifies the bits per
1344 line of the source data, \a sWidth and \a sHeight are the width and height of
1345 the source data.
1346*/
1347#ifndef QT_NO_PIXMAP_TRANSFORMATION
1348#undef IWX_MSB
1349#define IWX_MSB(b) if ( trigx < maxws && trigy < maxhs ) { \
1350 if ( *(sptr+sbpl*(trigy>>16)+(trigx>>19)) & \
1351 (1 << (7-((trigx>>16)&7))) ) \
1352 *dptr |= b; \
1353 } \
1354 trigx += m11; \
1355 trigy += m12;
1356 // END OF MACRO
1357#undef IWX_LSB
1358#define IWX_LSB(b) if ( trigx < maxws && trigy < maxhs ) { \
1359 if ( *(sptr+sbpl*(trigy>>16)+(trigx>>19)) & \
1360 (1 << ((trigx>>16)&7)) ) \
1361 *dptr |= b; \
1362 } \
1363 trigx += m11; \
1364 trigy += m12;
1365 // END OF MACRO
1366#undef IWX_PIX
1367#define IWX_PIX(b) if ( trigx < maxws && trigy < maxhs ) { \
1368 if ( (*(sptr+sbpl*(trigy>>16)+(trigx>>19)) & \
1369 (1 << (7-((trigx>>16)&7)))) == 0 ) \
1370 *dptr &= ~b; \
1371 } \
1372 trigx += m11; \
1373 trigy += m12;
1374 // END OF MACRO
1375bool qt_xForm_helper( const QWMatrix &trueMat, int xoffset,
1376 int type, int depth,
1377 uchar *dptr, int dbpl, int p_inc, int dHeight,
1378 uchar *sptr, int sbpl, int sWidth, int sHeight
1379 )
1380{
1381 int m11 = (int)(trueMat.m11()*65536.0);
1382 int m12 = (int)(trueMat.m12()*65536.0);
1383 int m21 = (int)(trueMat.m21()*65536.0);
1384 int m22 = (int)(trueMat.m22()*65536.0);
1385 int dx = (int)(trueMat.dx() *65536.0);
1386 int dy = (int)(trueMat.dy() *65536.0);
1387
1388 int m21ydx = dx + (xoffset<<16) + QABS(m11)/2;
1389 int m22ydy = dy + QABS(m22)/2;
1390 uint trigx;
1391 uint trigy;
1392 uint maxws = sWidth<<16;
1393 uint maxhs = sHeight<<16;
1394
1395 for ( int y=0; y<dHeight; y++ ) { // for each target scanline
1396 trigx = m21ydx;
1397 trigy = m22ydy;
1398 uchar *maxp = dptr + dbpl;
1399 if ( depth != 1 ) {
1400 switch ( depth ) {
1401 case 8: // 8 bpp transform
1402 while ( dptr < maxp ) {
1403 if ( trigx < maxws && trigy < maxhs )
1404 *dptr = *(sptr+sbpl*(trigy>>16)+(trigx>>16));
1405 trigx += m11;
1406 trigy += m12;
1407 dptr++;
1408 }
1409 break;
1410
1411 case 16: // 16 bpp transform
1412 while ( dptr < maxp ) {
1413 if ( trigx < maxws && trigy < maxhs )
1414 *((ushort*)dptr) = *((ushort *)(sptr+sbpl*(trigy>>16) +
1415 ((trigx>>16)<<1)));
1416 trigx += m11;
1417 trigy += m12;
1418 dptr++;
1419 dptr++;
1420 }
1421 break;
1422
1423 case 24: { // 24 bpp transform
1424 uchar *p2;
1425 while ( dptr < maxp ) {
1426 if ( trigx < maxws && trigy < maxhs ) {
1427 p2 = sptr+sbpl*(trigy>>16) + ((trigx>>16)*3);
1428 dptr[0] = p2[0];
1429 dptr[1] = p2[1];
1430 dptr[2] = p2[2];
1431 }
1432 trigx += m11;
1433 trigy += m12;
1434 dptr += 3;
1435 }
1436 }
1437 break;
1438
1439 case 32: // 32 bpp transform
1440 while ( dptr < maxp ) {
1441 if ( trigx < maxws && trigy < maxhs )
1442 *((uint*)dptr) = *((uint *)(sptr+sbpl*(trigy>>16) +
1443 ((trigx>>16)<<2)));
1444 trigx += m11;
1445 trigy += m12;
1446 dptr += 4;
1447 }
1448 break;
1449
1450 default: {
1451 return FALSE;
1452 }
1453 }
1454 } else {
1455 switch ( type ) {
1456 case QT_XFORM_TYPE_MSBFIRST:
1457 while ( dptr < maxp ) {
1458 IWX_MSB(128);
1459 IWX_MSB(64);
1460 IWX_MSB(32);
1461 IWX_MSB(16);
1462 IWX_MSB(8);
1463 IWX_MSB(4);
1464 IWX_MSB(2);
1465 IWX_MSB(1);
1466 dptr++;
1467 }
1468 break;
1469 case QT_XFORM_TYPE_LSBFIRST:
1470 while ( dptr < maxp ) {
1471 IWX_LSB(1);
1472 IWX_LSB(2);
1473 IWX_LSB(4);
1474 IWX_LSB(8);
1475 IWX_LSB(16);
1476 IWX_LSB(32);
1477 IWX_LSB(64);
1478 IWX_LSB(128);
1479 dptr++;
1480 }
1481 break;
1482# if defined(Q_WS_WIN)
1483 case QT_XFORM_TYPE_WINDOWSPIXMAP:
1484 while ( dptr < maxp ) {
1485 IWX_PIX(128);
1486 IWX_PIX(64);
1487 IWX_PIX(32);
1488 IWX_PIX(16);
1489 IWX_PIX(8);
1490 IWX_PIX(4);
1491 IWX_PIX(2);
1492 IWX_PIX(1);
1493 dptr++;
1494 }
1495 break;
1496# endif
1497 }
1498 }
1499 m21ydx += m21;
1500 m22ydy += m22;
1501 dptr += p_inc;
1502 }
1503 return TRUE;
1504}
1505#undef IWX_MSB
1506#undef IWX_LSB
1507#undef IWX_PIX
1508#endif // QT_NO_PIXMAP_TRANSFORMATION
Note: See TracBrowser for help on using the repository browser.