Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QPicture Class Reference

The QPicture class is a paint device that records and replays QPainter commands. More...

Inheritance diagram for QtGui.QPicture:
Collaboration diagram for QtGui.QPicture:

Public Member Functions

 QPicture (QPicture arg1)
 
 
 QPicture (int formatVersion=-1)
 
 
override void CreateProxy ()
 
new void Detach ()
 
override int DevType ()
 
new bool IsDetached ()
 
new bool IsNull ()
 
 
new bool Load (QIODevice dev, string format=null)
 
 
new bool Load (string fileName, string format=null)
 
 
override QPaintEngine PaintEngine ()
 
 
new bool Play (QPainter p)
 
 
new bool Save (QIODevice dev, string format=null)
 
 
new bool Save (string fileName, string format=null)
 
 
virtual void SetData (string data, uint size)
 
 
new uint Size ()
 
 
new void Swap (QPicture other)
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QPaintDevice
new int ColorCount ()
 
 
new int Depth ()
 
 
virtual System.IntPtr GetDC ()
 
new int Height ()
 
 
new int HeightMM ()
 
 
new int LogicalDpiX ()
 
 
new int LogicalDpiY ()
 
 
new int NumColors ()
 
 
new bool PaintingActive ()
 
 
new int PhysicalDpiX ()
 
 
new int PhysicalDpiY ()
 
 
virtual void ReleaseDC (System.IntPtr hdc)
 
new int Width ()
 
 
new int WidthMM ()
 
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.IQPaintDevice
new int ColorCount ()
 
new int Depth ()
 
int DevType ()
 
System.IntPtr GetDC ()
 
new int Height ()
 
new int HeightMM ()
 
new int LogicalDpiX ()
 
new int LogicalDpiY ()
 
new int NumColors ()
 
QPaintEngine PaintEngine ()
 
new bool PaintingActive ()
 
new int PhysicalDpiX ()
 
new int PhysicalDpiY ()
 
void ReleaseDC (System.IntPtr hdc)
 
new int Width ()
 
new int WidthMM ()
 

Static Public Member Functions

static
System.Collections.Generic.List
< string > 
InputFormatList ()
 
 
static
System.Collections.Generic.List
< QByteArray
InputFormats ()
 
 
static
System.Collections.Generic.List
< string > 
OutputFormatList ()
 
 
static
System.Collections.Generic.List
< QByteArray
OutputFormats ()
 
 
static string PictureFormat (string fileName)
 
 

Protected Member Functions

 QPicture (System.Type dummy)
 
override int Metric (QPaintDevice.PaintDeviceMetric m)
 
 
- Protected Member Functions inherited from QtGui.QPaintDevice
 QPaintDevice (System.Type dummy)
 
 QPaintDevice ()
 
 

Properties

new QRect BoundingRect [get, set]
 
 
new string Data [get]
 
 
- Properties inherited from QtGui.QPaintDevice
virtual System.IntPtr SmokeObject [get, set]
 
new ushort Painters [get, set]
 

Additional Inherited Members

- Public Types inherited from QtGui.QPaintDevice
enum  PaintDeviceMetric {
  PdmDepth = 6, PdmDpiX = 7, PdmDpiY = 8, PdmHeight = 2,
  PdmHeightMM = 4, PdmNumColors = 5, PdmPhysicalDpiX = 9, PdmPhysicalDpiY = 10,
  PdmWidth = 1, PdmWidthMM = 3
}
  More...
 
- Protected Attributes inherited from QtGui.QPaintDevice
SmokeInvocation interceptor
 

Detailed Description

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;

QPainter painter;

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;

picture.load("drawing.pic"); // load picture

QPainter painter;

painter.begin(&myImage); // paint in myImage

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().

See also QMovie.

Constructor & Destructor Documentation

QtGui.QPicture.QPicture ( System.Type  dummy)
protected
QtGui.QPicture.QPicture ( QPicture  arg1)

Constructs a copy of pic.

This constructor is fast thanks to implicit sharing.

QtGui.QPicture.QPicture ( int  formatVersion = -1)

Constructs an empty picture.

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.

Member Function Documentation

override void QtGui.QPicture.CreateProxy ( )
virtual

Reimplemented from QtGui.QPaintDevice.

new void QtGui.QPicture.Detach ( )
override int QtGui.QPicture.DevType ( )
virtual

Reimplemented from QtGui.QPaintDevice.

new void QtGui.QPicture.Dispose ( )
static System.Collections.Generic.List<string> QtGui.QPicture.InputFormatList ( )
static

Returns a list of picture formats that are supported for picture input.

Note that if you want to iterate over the list, you should iterate over a copy, e.g.

QStringList list = QPicture::inputFormatList();

foreach (const QString &string, list)

myProcessing(string);

See also outputFormatList(), inputFormats(), and QPictureIO.

static System.Collections.Generic.List<QByteArray> QtGui.QPicture.InputFormats ( )
static

Returns a list of picture formats that are supported for picture input.

See also outputFormats(), inputFormatList(), and QPictureIO.

new bool QtGui.QPicture.IsDetached ( )
new bool QtGui.QPicture.IsNull ( )

Returns true if the picture contains no data; otherwise returns false.

new bool QtGui.QPicture.Load ( QIODevice  dev,
string  format = null 
)

This is an overloaded function.

dev is the device to use for loading.

new bool QtGui.QPicture.Load ( string  fileName,
string  format = null 
)

Loads a picture from the file specified by fileName and returns true if successful; otherwise returns false.

Please note that the format parameter has been deprecated and will have no effect.

See also save().

override int QtGui.QPicture.Metric ( QPaintDevice.PaintDeviceMetric  metric)
protectedvirtual

Returns the metric information for the given paint device metric.

See also PaintDeviceMetric.

Reimplemented from QtGui.QPaintDevice.

static System.Collections.Generic.List<string> QtGui.QPicture.OutputFormatList ( )
static

Returns a list of picture formats that are supported for picture output.

Note that if you want to iterate over the list, you should iterate over a copy, e.g.

QStringList list = QPicture::outputFormatList();

foreach (const QString &string, list)

myProcessing(string);

See also inputFormatList(), outputFormats(), and QPictureIO.

static System.Collections.Generic.List<QByteArray> QtGui.QPicture.OutputFormats ( )
static

Returns a list of picture formats that are supported for picture output.

See also inputFormats(), outputFormatList(), and QPictureIO.

override QPaintEngine QtGui.QPicture.PaintEngine ( )
virtual

Returns a pointer to the paint engine used for drawing on the device.

Implements QtGui.QPaintDevice.

static string QtGui.QPicture.PictureFormat ( string  fileName)
static

Returns a string that specifies the picture format of the file fileName, or 0 if the file cannot be read or if the format is not recognized.

See also load() and save().

new bool QtGui.QPicture.Play ( QPainter  p)

Replays the picture using painter, and returns true if successful; otherwise returns false.

This function does exactly the same as QPainter::drawPicture() with (x, y) = (0, 0).

new bool QtGui.QPicture.Save ( QIODevice  dev,
string  format = null 
)

This is an overloaded function.

dev is the device to use for saving.

new bool QtGui.QPicture.Save ( string  fileName,
string  format = null 
)

Saves a picture to the file specified by fileName and returns true if successful; otherwise returns false.

Please note that the format parameter has been deprecated and will have no effect.

See also load().

virtual void QtGui.QPicture.SetData ( string  data,
uint  size 
)
virtual

Sets the picture data directly from data and size. This function copies the input data.

See also data() and size().

new uint QtGui.QPicture.Size ( )

Returns the size of the picture data.

See also data().

new void QtGui.QPicture.Swap ( QPicture  other)

Swaps picture other with this picture. This operation is very fast and never fails.

This function was introduced in Qt 4.8.

Property Documentation

new QRect QtGui.QPicture.BoundingRect
getset

Returns the picture's bounding rectangle or an invalid rectangle if the picture contains no data.

Sets the picture's bounding rectangle to r. The automatically calculated value is overridden.

new string QtGui.QPicture.Data
get

Returns a pointer to the picture data. The pointer is only valid until the next non-const function is called on this picture. The returned pointer is 0 if the picture contains no data.

See also setData(), size(), and isNull().