|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QPicture
public class QPicture
The QPicture class is a paint device that records and replays QPainter commands. A picture serializes painter commands to an IO device in a platform-independent format. They are sometimes referred to as meta-files.
Qt pictures use a proprietary binary format. Unlike native picture (meta-file) formats on many window systems, Qt pictures have no limitations regarding their contents. Everything that can be painted on a widget or pixmap (e.g., fonts, pixmaps, regions, transformed graphics, etc.) can also be stored in a picture.
QPicture is resolution independent, i.e. a QPicture can be displayed on different devices (for example svg, pdf, ps, printer and screen) looking the same. This is, for instance, needed for WYSIWYG print preview. QPicture runs in the default system dpi, and scales the painter to match differences in resolution depending on the window system.
Example of how to record a picture:
QPicture picture = new QPicture();
QPainter painter = new QPainter();
painter.begin(picture); // paint in picture
painter.drawEllipse(10,20, 80,70); // draw an ellipse
painter.end(); // painting done
picture.save("drawing.pic"); // save picture
Note that the list of painter commands is reset on each call to the QPainter::begin() function. Example of how to replay a picture:
QPicture picture = new QPicture();
picture.load("drawing.pic"); // load picture
QPainter painter = new QPainter();
painter.begin(myWidget); // paint in myWidget
painter.drawPicture(0, 0, picture); // draw the picture at (0,0)
painter.end(); // painting done
Pictures can also be drawn using play(). Some basic data about a picture is available, for example, size(), isNull() and boundingRect(). QMovie.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
|---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
| Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
|---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
| Field Summary |
|---|
| Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
|---|
currentSender |
| Constructor Summary | |
|---|---|
QPicture()
Constructs an empty picture. |
|
QPicture(int formatVersion)
Constructs an empty picture. |
|
QPicture(QPicture arg__1)
Constructs a copy of pic. |
|
| Method Summary | |
|---|---|
QRect |
boundingRect()
Returns the picture's bounding rectangle or an invalid rectangle if the picture contains no data. |
QPicture |
clone()
This method is reimplemented for internal reasons |
byte[] |
data()
Returns the picture data. |
int |
depth()
Returns the bit depth (number of bit planes) of the paint device. |
int |
height()
Returns the height of the paint device in default coordinate system units (e. |
int |
heightMM()
Returns the height of the paint device in millimeters. |
boolean |
isNull()
Returns true if the picture contains no data; otherwise returns false. |
boolean |
load(QIODevice dev)
This is an overloaded member function, provided for convenience. |
boolean |
load(java.lang.String fileName)
Loads a picture from the file specified by fileName and returns true if successful; otherwise returns false. |
int |
logicalDpiX()
Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. |
int |
logicalDpiY()
Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. |
int |
metric(QPaintDevice.PaintDeviceMetric m)
Returns the metric information for the given paint device metric. |
int |
numColors()
Returns the number of different colors available for the paint device. |
QPaintEngine |
paintEngine()
Returns a pointer to the paint engine used for drawing on the device. |
boolean |
paintingActive()
Returns true if the device is currently being painted on, i. |
int |
physicalDpiX()
Returns the horizontal resolution of the device in dots per inch. |
int |
physicalDpiY()
Returns the horizontal resolution of the device in dots per inch. |
boolean |
play(QPainter p)
Replays the picture using painter, and returns true if successful; otherwise returns false. |
void |
readFrom(QDataStream arg__1)
|
boolean |
save(QIODevice dev)
This is an overloaded member function, provided for convenience. |
boolean |
save(java.lang.String fileName)
Saves a picture to the file specified by fileName and returns true if successful; otherwise returns false. |
void |
setBoundingRect(QRect r)
Sets the picture's bounding rectangle to r. |
void |
setData(byte[] data)
Sets the picture data directly from data and size. |
int |
size()
Returns the size of the picture data. |
int |
width()
Returns the width of the paint device in default coordinate system units (e. |
int |
widthMM()
Returns the width of the paint device in millimeters. |
void |
writeTo(QDataStream arg__1)
|
| Methods inherited from class com.trolltech.qt.QtJambiObject |
|---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
| Methods inherited from class com.trolltech.qt.QSignalEmitter |
|---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
| Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
|---|
__qt_signalInitialization |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.trolltech.qt.QtJambiInterface |
|---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
| Constructor Detail |
|---|
public QPicture(QPicture arg__1)
This constructor is fast thanks to implicit sharing.
public QPicture()
The formatVersion parameter may be used to create a QPicture that can be read by applications that are compiled with earlier versions of Qt.
Note that the default formatVersion is -1 which signifies the current release, i.e. for Qt 4.0 a formatVersion of 7 is the same as the default formatVersion of -1.
Reading pictures generated by earlier versions of Qt is not supported in Qt 4.0.
public QPicture(int formatVersion)
The formatVersion parameter may be used to create a QPicture that can be read by applications that are compiled with earlier versions of Qt.
Note that the default formatVersion is -1 which signifies the current release, i.e. for Qt 4.0 a formatVersion of 7 is the same as the default formatVersion of -1.
Reading pictures generated by earlier versions of Qt is not supported in Qt 4.0.
| Method Detail |
|---|
public final QRect boundingRect()
setBoundingRect().
public final int depth()
depth in interface QPaintDeviceInterfacepublic final int height()
QPixmap and QWidget). heightMM().
height in interface QPaintDeviceInterfacepublic final int heightMM()
height().
heightMM in interface QPaintDeviceInterfacepublic final boolean isNull()
public final int logicalDpiX()
widthMM(). Note that if the logicalDpiX() doesn't equal the physicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.
logicalDpiY(), and physicalDpiX().
logicalDpiX in interface QPaintDeviceInterfacepublic final int logicalDpiY()
heightMM(). Note that if the logicalDpiY() doesn't equal the physicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.
logicalDpiX(), and physicalDpiY().
logicalDpiY in interface QPaintDeviceInterfacepublic final int numColors()
numColors in interface QPaintDeviceInterfacepublic final void writeTo(QDataStream arg__1)
public final void readFrom(QDataStream arg__1)
public final boolean paintingActive()
QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false. QPainter::isActive().
paintingActive in interface QPaintDeviceInterfacepublic final int physicalDpiX()
Note that if the physicalDpiX() doesn't equal the logicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.
physicalDpiY(), and logicalDpiX().
physicalDpiX in interface QPaintDeviceInterfacepublic final int physicalDpiY()
Note that if the physicalDpiY() doesn't equal the logicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.
physicalDpiX(), and logicalDpiY().
physicalDpiY in interface QPaintDeviceInterfacepublic final boolean play(QPainter p)
This function does exactly the same as QPainter::drawPicture() with (x, y) = (0, 0).
public final void setBoundingRect(QRect r)
boundingRect().
public final int size()
data().
public final int width()
QPixmap and QWidget). widthMM().
width in interface QPaintDeviceInterfacepublic final int widthMM()
width().
widthMM in interface QPaintDeviceInterfacepublic int metric(QPaintDevice.PaintDeviceMetric m)
PaintDeviceMetric .
metric in interface QPaintDeviceInterfacepublic QPaintEngine paintEngine()
paintEngine in interface QPaintDeviceInterfacepublic void setData(byte[] data)
data(), and size().
public final boolean load(QIODevice dev)
public final boolean load(java.lang.String fileName)
public final boolean save(QIODevice dev)
dev is the device to use for saving.
public final boolean save(java.lang.String fileName)
public final byte[] data()
public QPicture clone()
clone in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||