summaryrefslogtreecommitdiffstats
path: root/experimental/tqtinterface/qt4/src/kernel/tqpaintdevice.h
blob: 738dd761f849fdc25e7bddf20c7137f6ebae86c3 (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
/****************************************************************************
**
** Definition of TQPaintDevice class
**
** Created : 940721
**
** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
**
** This file is part of the kernel module of the TQt GUI Toolkit.
**
** This file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the files LICENSE.GPL2
** and LICENSE.GPL3 included in the packaging of this file.
** Alternatively you may (at your option) use any later version
** of the GNU General Public License if such license has been
** publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free TQt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** This file may be used under the terms of the Q Public License as
** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
** included in the packaging of this file.  Licensees holding valid TQt
** Commercial licenses may use this file in accordance with the TQt
** Commercial License Agreement provided with the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/

#ifndef TQPAINTDEVICE_H
#define TQPAINTDEVICE_H

#include "tqtglobaldefines.h"

#ifndef TQT_H
#include "tqwindowdefs.h"
#include "tqrect.h"
#endif // TQT_H

#ifdef USE_QT4

#include <Qt/qapplication.h>
#include <Qt/qx11info_x11.h>
#include <Qt/qpaintdevice.h>
#include <Qt/qpaintengine.h>

#endif // USE_QT4

#if defined(TQ_WS_TQWS)
class TQWSDisplay;
class TQGfx;
#endif

class TQIODevice;
class TQString;
class TQTextItem;

#ifdef USE_QT4

#if defined(TQ_WS_X11)
struct TQPaintDeviceX11Data;
#endif

// There does not seem to be a Qt4 equivalent for this
union TQPDevCmdParam {
	int			ival;
	int			*ivec;
	TQString		*str;
	const TQPoint		*point;
	const TQRect		*rect;
	const TQPointArray	*ptarr;
	const TQPixmap		*pixmap;
	const TQImage		*image;
	const TQColor		*color;
	const TQFont		*font;
	const TQPen		*pen;
	const TQBrush		*brush;
	const TQRegion		*rgn;
	const TQWMatrix		*matrix;
	const TQTextItem	*textItem;
	TQIODevice		*tqdevice;
};

class TQPaintDevice;

class TQ_EXPORT TQPaintDeviceEngineTranslator : public QPaintEngine
{
public:
	TQPaintDeviceEngineTranslator() : QPaintEngine() {}
	TQPaintDeviceEngineTranslator(TQPaintDevice* tqpd) : QPaintEngine() { parent_paintdevice = tqpd; }

	inline void setPaintDevice(TQPaintDevice* tqpd) { parent_paintdevice = tqpd; }

	// Reimplemented QPaintEngine methods
	virtual bool begin(QPaintDevice*);
	virtual bool end();
	virtual void updateState(const QPaintEngineState&);
	virtual void drawPixmap(const QRectF&, const QPixmap&, const QRectF&);
	virtual QPaintEngine::Type type() const;

private:
	TQPaintDevice* parent_paintdevice;
};

class TQ_EXPORT TQPaintDevice : public QPaintDevice, virtual public TQt
{
public:
	TQPaintDevice() : QPaintDevice() { tqpet.setPaintDevice(this); }
// 	TQPaintDevice( const QPaintDevice &pd ) : QPaintDevice( pd ) {}

	inline static void *x11AppVisual( void ) { return x11AppVisual(-1); }
	inline static void *x11AppVisual( int screen ) { return QX11Info::appVisual(screen); }
	inline static int x11AppCells( void ) { return x11AppCells(-1); }
	inline static int x11AppCells( int screen ) { return QX11Info::appCells(screen); }
	inline static int x11AppDepth( void ) { return x11AppDepth(-1); }
	inline static int x11AppDepth( int screen ) { return QX11Info::appDepth(screen); }
	inline static Display *x11AppDisplay( void ) { return QX11Info::display(); }
	inline static int x11AppScreen( void ) { return QX11Info::appScreen(); }
	inline static bool x11AppDefaultVisual( void ) { return x11AppDefaultVisual(-1); }
	inline static bool x11AppDefaultVisual( int screen ) { return QX11Info::appDefaultVisual(screen); }
	inline static TQt::HANDLE x11AppColormap( void ) { return x11AppColormap(-1); }
	inline static TQt::HANDLE x11AppColormap( int screen ) { return QX11Info::appColormap(screen); }
	inline static bool x11AppDefaultColormap( void ) { return x11AppDefaultColormap(-1); }
	inline static bool x11AppDefaultColormap( int screen ) { return QX11Info::appDefaultColormap(screen); }
	inline static TQt::HANDLE x11AppRootWindow( void ) { return x11AppRootWindow(-1); }
	inline static TQt::HANDLE x11AppRootWindow( int screen ) { return QX11Info::appRootWindow(screen); }

	bool isExtDev() const;

	// Windows:	  get tqdevice context
	// X-Windows: get drawable
#if defined(TQ_WS_WIN)
// 	virtual HDC handle() const;
#elif defined(TQ_WS_X11)
	virtual TQt::HANDLE handle() const;
	virtual TQt::HANDLE x11RenderHandle() const;
#elif defined(TQ_WS_MAC)
// 	virtual TQt::HANDLE handle() const;
#elif defined(TQ_WS_TQWS)
// 	virtual TQt::HANDLE handle() const;
#endif

#if defined(TQ_WS_X11)
	Display *x11Display() const;
	int x11Screen() const;
	int x11Depth() const;
	int x11Cells() const;
	Qt::HANDLE x11Colormap() const;
	bool x11DefaultColormap() const;
	void *x11Visual() const;
	bool x11DefaultVisual() const;

	static int x11AppDpiX(int screen = -1);
	static int x11AppDpiY(int screen = -1);
	static void x11SetAppDpiX(int, int);
	static void x11SetAppDpiY(int, int);
#endif

public:
	// There does not seem to be a Qt4 equivalent for this
	enum PDevCmd {
		PdcNOP = 0, //  <void>
		PdcDrawPoint = 1, // point
		PdcDrawFirst = PdcDrawPoint,
		PdcMoveTo = 2, // point
		PdcLineTo = 3, // point
		PdcDrawLine = 4, // point,point
		PdcDrawRect = 5, // rect
		PdcDrawRoundRect = 6, // rect,ival,ival
		PdcDrawEllipse = 7, // rect
		PdcDrawArc = 8, // rect,ival,ival
		PdcDrawPie = 9, // rect,ival,ival
		PdcDrawChord = 10, // rect,ival,ival
		PdcDrawLineSegments = 11, // ptarr
		PdcDrawPolyline = 12, // ptarr
		PdcDrawPolygon = 13, // ptarr,ival
		PdcDrawCubicBezier = 14, // ptarr
		PdcDrawText = 15, // point,str
		PdcDrawTextFormatted = 16, // rect,ival,str
		PdcDrawPixmap = 17, // rect,pixmap
		PdcDrawImage = 18, // rect,image
		PdcDrawText2 = 19, // point,str
		PdcDrawText2Formatted = 20, // rect,ival,str
		PdcDrawTextItem = 21,
		PdcDrawLast = PdcDrawTextItem,

		// no painting commands below PdcDrawLast.

		PdcBegin = 30, //  <void>
		PdcEnd = 31, //  <void>
		PdcSave = 32, //  <void>
		PdcRestore = 33, //  <void>
		PdcSetdev = 34, // tqdevice - PRIVATE
		PdcSetBkColor = 40, // color
		PdcSetBkMode = 41, // ival
		PdcSetROP = 42, // ival
		PdcSetBrushOrigin = 43, // point
		PdcSetFont = 45, // font
		PdcSetPen = 46, // pen
		PdcSetBrush = 47, // brush
		PdcSetTabStops = 48, // ival
		PdcSetTabArray = 49, // ival,ivec
		PdcSetUnit = 50, // ival
		PdcSetVXform = 51, // ival
		PdcSetWindow = 52, // rect
		PdcSetViewport = 53, // rect
		PdcSetWXform = 54, // ival
		PdcSetWMatrix = 55, // matrix,ival
		PdcSaveWMatrix = 56,
		PdcRestoreWMatrix = 57,
		PdcSetClip = 60, // ival
		PdcSetClipRegion = 61, // rgn

		PdcReservedStart = 0, // codes 0-199 are reserved
		PdcReservedStop = 199 //   for TQt
	};

protected:
	TQPaintDevice( uint devflags );
#if defined(TQ_WS_X11)
	friend void qt_init_internal( int *, char **, Display *, TQt::HANDLE, TQt::HANDLE );
	friend void qt_cleanup();
	virtual bool cmd( int, TQPainter *, TQPDevCmdParam * );
	virtual QPaintEngine* paintEngine() const;
#endif

private:
#if defined(TQ_WS_X11)
	static Display *x_appdisplay;
	static int x_appscreen;
	
	static int x_appdepth;
	static int x_appcells;
	static TQt::HANDLE x_approotwindow;
	static TQt::HANDLE x_appcolormap;
	static bool x_appdefcolormap;
	static void *x_appvisual;
	static bool x_appdefvisual;
	
	// ### in 4.0, remove the above, and replace with the below
	static int *x_appdepth_arr;
	static int *x_appcells_arr;
	static TQt::HANDLE *x_approotwindow_arr;
	static TQt::HANDLE *x_appcolormap_arr;
	static bool *x_appdefcolormap_arr;
	static void **x_appvisual_arr;
	static bool *x_appdefvisual_arr;
	
	TQPaintDeviceX11Data* x11Data;

	TQPaintDeviceEngineTranslator tqpet;
#endif

public:
	// Interoperability
	static const TQPaintDevice& convertFromQPaintDevice( QPaintDevice& qpd );
};

// Interoperability
inline static const TQPaintDevice& convertFromQPaintDevice( const QPaintDevice& qpd ) {
	return (*static_cast<const TQPaintDevice*>(&qpd));
}

void bitBlt(QPaintDevice *dst, int dx, int dy,
             const QPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
             bool ignoreMask=false);

void bitBlt(QPaintDevice *dst, int dx, int dy,
             const QImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
             int conversion_flags=0);

void bitBlt(QPaintDevice *dst, const QPoint &dp,
            const QPaintDevice *src, const QRect &sr=QRect(0,0,-1,-1),
            bool ignoreMask=false);

TQ_EXPORT void bitBlt( TQPaintDevice *dst, int dx, int dy, const TQPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1, TQt::RasterOp = TQt::CopyROP, bool ignoreMask=FALSE );

// [FIXME]
inline bool TQPaintDevice::isExtDev() const
//{ return (devFlags & TQInternal::ExternalDevice) != 0; }
{ return false; }

#if defined(TQ_WS_X11)

struct TQ_EXPORT TQPaintDeviceX11Data : public TQShared {
    Display*	x_display;
    int		x_screen;
    int		x_depth;
    int		x_cells;
    TQt::HANDLE	x_colormap;
    bool	x_defcolormap;
    void*	x_visual;
    bool	x_defvisual;
};

#endif

// This provides a default interface from the old Qt3 cmd based API to the new Qt4 QPaintEngine based API
// It can (obviously) be overridden if someone desires to use QPaintEngine instead of the cmd based API!
inline QPaintEngine* TQPaintDevice::paintEngine() const {
	// Provide the address of the translator class...
	return const_cast<TQPaintDeviceEngineTranslator*>(&tqpet);
}

TQ_EXPORT
inline void bitBlt( TQPaintDevice *dst, const TQPoint &dp,
                    const TQPaintDevice *src, const TQRect &sr =TQRect(0,0,-1,-1),
                    TQt::RasterOp rop=TQt::CopyROP, bool ignoreMask=FALSE )
{
    bitBlt( dst, dp.x(), dp.y(), src, sr.x(), sr.y(), sr.width(), sr.height(),
            rop, ignoreMask );
}

#else // USE_QT4

#if defined(TQ_WS_X11)
struct TQPaintDeviceX11Data;
#endif

union TQPDevCmdParam {
    int			 ival;
    int			*ivec;
    TQString	        *str;
    const TQPoint	*point;
    const TQRect		*rect;
    const TQPointArray	*ptarr;
    const TQPixmap	*pixmap;
    const TQImage	*image;
    const TQColor	*color;
    const TQFont		*font;
    const TQPen		*pen;
    const TQBrush	*brush;
    const TQRegion	*rgn;
    const TQWMatrix	*matrix;
    const TQTextItem     *textItem;
    TQIODevice		*tqdevice;
};



class TQ_EXPORT TQPaintDevice				// tqdevice for TQPainter
{
public:
    virtual ~TQPaintDevice();

    int		devType() const;
    bool	isExtDev() const;
    bool	paintingActive() const;

    virtual void setResolution( int );
    virtual int resolution() const;

    // Windows:	  get tqdevice context
    // X-Windows: get drawable
#if defined(TQ_WS_WIN)
    virtual HDC		handle() const;
#elif defined(TQ_WS_X11)
    virtual TQt::HANDLE	handle() const;
    virtual TQt::HANDLE  x11RenderHandle() const;
#elif defined(TQ_WS_MAC)
    virtual TQt::HANDLE      handle() const;
#elif defined(TQ_WS_TQWS)
    virtual TQt::HANDLE	handle() const;
#endif

#if defined(TQ_WS_X11)
    Display 	   *x11Display() const;
    int		    x11Screen() const;
    int		    x11Depth() const;
    int		    x11Cells() const;
    TQt::HANDLE	    x11Colormap() const;
    bool	    x11DefaultColormap() const;
    void	   *x11Visual() const;
    bool	    x11DefaultVisual() const;

    static Display *x11AppDisplay();
    static int	    x11AppScreen();

    static int      x11AppDpiX();
    static int      x11AppDpiY();
    static void     x11SetAppDpiX(int);
    static void     x11SetAppDpiY(int);
    static int	    x11AppDepth();
    static int	    x11AppCells();
    static TQt::HANDLE   x11AppRootWindow();
    static TQt::HANDLE   x11AppColormap();
    static bool     x11AppDefaultColormap();
    static void    *x11AppVisual();
    static bool	    x11AppDefaultVisual();

    // ### in 4.0, the above need to go away, the below needs to take a -1 default
    // argument, signifying the default screen...
    static int	    x11AppDepth( int screen );
    static int	    x11AppCells( int screen );
    static TQt::HANDLE   x11AppRootWindow( int screen );
    static TQt::HANDLE   x11AppColormap( int screen );
    static void    *x11AppVisual( int screen );
    static bool     x11AppDefaultColormap( int screen );
    static bool	    x11AppDefaultVisual( int screen );
    static int      x11AppDpiX( int );
    static int      x11AppDpiY( int );
    static void     x11SetAppDpiX( int, int );
    static void     x11SetAppDpiY( int, int );
#endif

#if defined(TQ_WS_TQWS)
    static TQWSDisplay *qwsDisplay();
    virtual unsigned char * scanLine(int) const;
    virtual int bytesPerLine() const;
    virtual TQGfx * graphicsContext(bool clip_tqchildren=TRUE) const;
#endif

    enum PDevCmd {
	PdcNOP = 0, //  <void>
	PdcDrawPoint = 1, // point
	PdcDrawFirst = PdcDrawPoint,
	PdcMoveTo = 2, // point
	PdcLineTo = 3, // point
	PdcDrawLine = 4, // point,point
	PdcDrawRect = 5, // rect
	PdcDrawRoundRect = 6, // rect,ival,ival
	PdcDrawEllipse = 7, // rect
	PdcDrawArc = 8, // rect,ival,ival
	PdcDrawPie = 9, // rect,ival,ival
	PdcDrawChord = 10, // rect,ival,ival
	PdcDrawLineSegments = 11, // ptarr
	PdcDrawPolyline = 12, // ptarr
	PdcDrawPolygon = 13, // ptarr,ival
	PdcDrawCubicBezier = 14, // ptarr
	PdcDrawText = 15, // point,str
	PdcDrawTextFormatted = 16, // rect,ival,str
	PdcDrawPixmap = 17, // rect,pixmap
	PdcDrawImage = 18, // rect,image
	PdcDrawText2 = 19, // point,str
	PdcDrawText2Formatted = 20, // rect,ival,str
	PdcDrawTextItem = 21,
	PdcDrawLast = PdcDrawTextItem,

	// no painting commands below PdcDrawLast.

	PdcBegin = 30, //  <void>
	PdcEnd = 31, //  <void>
	PdcSave = 32, //  <void>
	PdcRestore = 33, //  <void>
	PdcSetdev = 34, // tqdevice - PRIVATE
	PdcSetBkColor = 40, // color
	PdcSetBkMode = 41, // ival
	PdcSetROP = 42, // ival
	PdcSetBrushOrigin = 43, // point
	PdcSetFont = 45, // font
	PdcSetPen = 46, // pen
	PdcSetBrush = 47, // brush
	PdcSetTabStops = 48, // ival
	PdcSetTabArray = 49, // ival,ivec
	PdcSetUnit = 50, // ival
	PdcSetVXform = 51, // ival
	PdcSetWindow = 52, // rect
	PdcSetViewport = 53, // rect
	PdcSetWXform = 54, // ival
	PdcSetWMatrix = 55, // matrix,ival
	PdcSaveWMatrix = 56,
	PdcRestoreWMatrix = 57,
	PdcSetClip = 60, // ival
	PdcSetClipRegion = 61, // rgn

	PdcReservedStart = 0, // codes 0-199 are reserved
	PdcReservedStop = 199 //   for TQt
    };

protected:
    TQPaintDevice( uint devflags );

#if defined(TQ_WS_WIN)
    HDC		hdc;				// tqdevice context
#elif defined(TQ_WS_X11)
    TQt::HANDLE	hd;				// handle to drawable
    TQt::HANDLE  rendhd;                         // handle to RENDER pict

    void		 copyX11Data( const TQPaintDevice * );
    void		 cloneX11Data( const TQPaintDevice * );
    virtual void	 setX11Data( const TQPaintDeviceX11Data* );
    TQPaintDeviceX11Data* getX11Data( bool def=FALSE ) const;
#elif defined(TQ_WS_MAC)
#if !defined( TQMAC_NO_TQUARTZ )
    CGContextRef ctx;
#endif
    void * hd;
#elif defined(TQ_WS_TQWS)
    TQt::HANDLE hd;
#endif

    virtual bool cmd( int, TQPainter *, TQPDevCmdParam * );
    virtual int	 metric( int ) const;
    virtual int	 fontMet( TQFont *, int, const char * = 0, int = 0 ) const;
    virtual int	 fontInf( TQFont *, int ) const;

    ushort	devFlags;			// tqdevice flags
    ushort	painters;			// refcount

    friend class TQPainter;
    friend class TQPaintDeviceMetrics;
#if defined(TQ_WS_MAC)
#ifndef TQMAC_NO_TQUARTZ
    virtual CGContextRef macCGContext(bool clipped=TRUE) const;
#endif
    friend TQ_EXPORT void unclippedScaledBitBlt( TQPaintDevice *, int, int, int, int,
						const TQPaintDevice *, int, int, int, int, TQt::RasterOp, bool, bool );
#else
    friend TQ_EXPORT void bitBlt( TQPaintDevice *, int, int,
				 const TQPaintDevice *,
				 int, int, int, int, TQt::RasterOp, bool );
#endif
#if defined(TQ_WS_X11)
    friend void qt_init_internal( int *, char **, Display *, TQt::HANDLE, TQt::HANDLE );
    friend void qt_cleanup();
#endif

private:
#if defined(TQ_WS_X11)
    static Display *x_appdisplay;
    static int	    x_appscreen;

    static int	    x_appdepth;
    static int	    x_appcells;
    static TQt::HANDLE   x_approotwindow;
    static TQt::HANDLE   x_appcolormap;
    static bool	    x_appdefcolormap;
    static void	   *x_appvisual;
    static bool     x_appdefvisual;

    // ### in 4.0, remove the above, and replace with the below
    static int	      *x_appdepth_arr;
    static int	      *x_appcells_arr;
    static TQt::HANDLE *x_approotwindow_arr;
    static TQt::HANDLE *x_appcolormap_arr;
    static bool	      *x_appdefcolormap_arr;
    static void	     **x_appvisual_arr;
    static bool       *x_appdefvisual_arr;

    TQPaintDeviceX11Data* x11Data;
#endif

private:	// Disabled copy constructor and operator=
#if defined(TQ_DISABLE_COPY)
    TQPaintDevice( const TQPaintDevice & );
    TQPaintDevice &operator=( const TQPaintDevice & );
#endif
};


TQ_EXPORT
void bitBlt( TQPaintDevice *dst, int dx, int dy,
	     const TQPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
	     TQt::RasterOp = TQt::CopyROP, bool ignoreMask=FALSE );

TQ_EXPORT
void bitBlt( TQPaintDevice *dst, int dx, int dy,
	     const TQImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
	     int conversion_flags=0 );


#if defined(TQ_WS_X11)

struct TQ_EXPORT TQPaintDeviceX11Data : public TQShared {
    Display*	x_display;
    int		x_screen;
    int		x_depth;
    int		x_cells;
    TQt::HANDLE	x_colormap;
    bool	x_defcolormap;
    void*	x_visual;
    bool	x_defvisual;
};

#endif

/*****************************************************************************
  Inline functions
 *****************************************************************************/

inline int TQPaintDevice::devType() const
{ return devFlags & TQInternal::DeviceTypeMask; }

inline bool TQPaintDevice::isExtDev() const
{ return (devFlags & TQInternal::ExternalDevice) != 0; }

inline bool TQPaintDevice::paintingActive() const
{ return painters != 0; }

#if defined(TQ_WS_X11)
inline Display *TQPaintDevice::x11Display() const
{ return x11Data ? x11Data->x_display : x_appdisplay; }

inline int TQPaintDevice::x11Screen() const
{ return x11Data ? x11Data->x_screen : x_appscreen; }

inline int TQPaintDevice::x11Depth() const
{ return x11Data ? x11Data->x_depth : x_appdepth; }

inline int TQPaintDevice::x11Cells() const
{ return x11Data ? x11Data->x_cells : x_appcells; }

inline TQt::HANDLE TQPaintDevice::x11Colormap() const
{ return x11Data ? x11Data->x_colormap : x_appcolormap; }

inline bool TQPaintDevice::x11DefaultColormap() const
{ return x11Data ? x11Data->x_defcolormap : x_appdefcolormap; }

inline void *TQPaintDevice::x11Visual() const
{ return x11Data ? x11Data->x_visual : x_appvisual; }

inline bool TQPaintDevice::x11DefaultVisual() const
{ return x11Data ? x11Data->x_defvisual : x_appdefvisual; }

inline Display *TQPaintDevice::x11AppDisplay()
{ return x_appdisplay; }

inline int TQPaintDevice::x11AppScreen()
{ return x_appscreen; }

inline int TQPaintDevice::x11AppDepth( int screen )
{ return x_appdepth_arr[ screen == -1 ? x_appscreen : screen ]; }

inline int TQPaintDevice::x11AppCells( int screen )
{ return x_appcells_arr[ screen == -1 ? x_appscreen : screen ]; }

inline TQt::HANDLE TQPaintDevice::x11AppRootWindow( int screen )
{ return x_approotwindow_arr[ screen == -1 ? x_appscreen : screen ]; }

inline TQt::HANDLE TQPaintDevice::x11AppColormap( int screen )
{ return x_appcolormap_arr[ screen == -1 ? x_appscreen : screen ]; }

inline bool TQPaintDevice::x11AppDefaultColormap( int screen )
{ return x_appdefcolormap_arr[ screen == -1 ? x_appscreen : screen ]; }

inline void *TQPaintDevice::x11AppVisual( int screen )
{ return x_appvisual_arr[ screen == -1 ? x_appscreen : screen ]; }

inline bool TQPaintDevice::x11AppDefaultVisual( int screen )
{ return x_appdefvisual_arr[ screen == -1 ? x_appscreen : screen ]; }

inline int TQPaintDevice::x11AppDepth()
{ return x_appdepth; }

inline int TQPaintDevice::x11AppCells()
{ return x_appcells; }

inline TQt::HANDLE TQPaintDevice::x11AppRootWindow()
{ return x_approotwindow; }

inline TQt::HANDLE TQPaintDevice::x11AppColormap()
{ return x_appcolormap; }

inline bool TQPaintDevice::x11AppDefaultColormap()
{ return x_appdefcolormap; }

inline void *TQPaintDevice::x11AppVisual()
{ return x_appvisual; }

inline bool TQPaintDevice::x11AppDefaultVisual()
{ return x_appdefvisual; }

#endif // TQ_WS_X11


TQ_EXPORT
inline void bitBlt( TQPaintDevice *dst, const TQPoint &dp,
		    const TQPaintDevice *src, const TQRect &sr =TQRect(0,0,-1,-1),
		    TQt::RasterOp rop=TQt::CopyROP, bool ignoreMask=FALSE )
{
    bitBlt( dst, dp.x(), dp.y(), src, sr.x(), sr.y(), sr.width(), sr.height(),
	    rop, ignoreMask );
}

#endif // USE_QT4

#endif // TQPAINTDEVICE_H