source: trunk/include/qpicture.h@ 59

Last change on this file since 59 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: 3.6 KB
Line 
1/****************************************************************************
2** $Id: qpicture.h 2 2005-11-16 15:49:26Z dmik $
3**
4** Definition of QPicture class
5**
6** Created : 940729
7**
8** Copyright (C) 1992-2000 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#ifndef QPICTURE_H
39#define QPICTURE_H
40
41#ifndef QT_H
42#include "qpaintdevice.h"
43#include "qbuffer.h"
44#endif // QT_H
45
46#ifndef QT_NO_PICTURE
47
48class Q_EXPORT QPicture : public QPaintDevice // picture class
49{
50public:
51 QPicture( int formatVersion = -1 );
52 QPicture( const QPicture & );
53 ~QPicture();
54
55 bool isNull() const;
56
57 uint size() const;
58 const char* data() const;
59 virtual void setData( const char* data, uint size );
60
61 bool play( QPainter * );
62
63 bool load( QIODevice *dev, const char *format = 0 );
64 bool load( const QString &fileName, const char *format = 0 );
65 bool save( QIODevice *dev, const char *format = 0 );
66 bool save( const QString &fileName, const char *format = 0 );
67
68 QRect boundingRect() const;
69 void setBoundingRect( const QRect &r );
70
71 QPicture& operator= (const QPicture&);
72
73 friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QPicture & );
74 friend Q_EXPORT QDataStream &operator>>( QDataStream &, QPicture & );
75
76protected:
77 bool cmd( int, QPainter *, QPDevCmdParam * );
78 int metric( int ) const;
79 void detach();
80 QPicture copy() const;
81
82private:
83 bool exec( QPainter *, QDataStream &, int );
84
85 struct QPicturePrivate : public QShared {
86 bool cmd( int, QPainter *, QPDevCmdParam * );
87 bool checkFormat();
88 void resetFormat();
89
90 QBuffer pictb;
91 int trecs;
92 bool formatOk;
93 int formatMajor;
94 int formatMinor;
95 QRect brect;
96 } *d;
97};
98
99
100inline bool QPicture::isNull() const
101{
102 return d->pictb.buffer().isNull();
103}
104
105inline uint QPicture::size() const
106{
107 return d->pictb.buffer().size();
108}
109
110inline const char* QPicture::data() const
111{
112 return d->pictb.buffer().data();
113}
114
115/*****************************************************************************
116 QPicture stream functions
117 *****************************************************************************/
118
119Q_EXPORT QDataStream &operator<<( QDataStream &, const QPicture & );
120Q_EXPORT QDataStream &operator>>( QDataStream &, QPicture & );
121
122#endif // QT_NO_PICTURE
123
124#endif // QPICTURE_H
Note: See TracBrowser for help on using the repository browser.