Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator 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 pic)
  More...
 
 QPicture (int formatVersion=-1)
  More...
 
override void CreateProxy ()
 
new void Detach ()
 
new bool Load (QIODevice dev, string format=null)
  More...
 
new bool Load (string fileName, string format=null)
  More...
 
new bool Play (QPainter p)
  More...
 
new bool Save (QIODevice dev, string format=null)
  More...
 
new bool Save (string fileName, string format=null)
  More...
 
virtual void SetData (string data, uint size)
  More...
 
new void Swap (QPicture other)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QPaintDevice
virtual System.IntPtr GetDC ()
 
virtual void ReleaseDC (System.IntPtr hdc)
 
new void Dispose ()
 

Static Public Member Functions

static string PictureFormat (string fileName)
  More...
 

Protected Member Functions

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

Properties

QRect BoundingRect [get, set]
  More...
 
string Data [get]
  More...
 
override int DevType [get]
 
override QPaintEngine PaintEngine [get]
 
static
System.Collections.Generic.List
< string > 
InputFormatList [get]
  More...
 
static
System.Collections.Generic.List
< QByteArray
InputFormats [get]
  More...
 
bool IsDetached [get]
 
bool IsNull [get]
  More...
 
static
System.Collections.Generic.List
< string > 
OutputFormatList [get]
  More...
 
static
System.Collections.Generic.List
< QByteArray
OutputFormats [get]
  More...
 
uint Size [get]
  More...
 
- Properties inherited from QtGui.QPaintDevice
int ColorCount [get]
  More...
 
int Depth [get]
  More...
 
virtual int DevType [get]
 
int Height [get]
  More...
 
int HeightMM [get]
  More...
 
int LogicalDpiX [get]
  More...
 
int LogicalDpiY [get]
  More...
 
int NumColors [get]
  More...
 
virtual QPaintEngine PaintEngine [get]
  More...
 
bool PaintingActive [get]
  More...
 
int PhysicalDpiX [get]
  More...
 
int PhysicalDpiY [get]
  More...
 
int Width [get]
  More...
 
int WidthMM [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 
new ushort Painters [get, set]
 
- Properties inherited from QtGui.IQPaintDevice
System.Int32 ColorCount [get]
  More...
 
System.Int32 Depth [get]
  More...
 
System.Int32 DevType [get]
 
System.Int32 Height [get]
  More...
 
System.Int32 HeightMM [get]
  More...
 
System.Int32 LogicalDpiX [get]
  More...
 
System.Int32 LogicalDpiY [get]
  More...
 
System.Int32 NumColors [get]
  More...
 
QPaintEngine PaintEngine [get]
  More...
 
System.Boolean PaintingActive [get]
  More...
 
System.Int32 PhysicalDpiX [get]
  More...
 
System.Int32 PhysicalDpiY [get]
  More...
 
System.Int32 Width [get]
  More...
 
System.Int32 WidthMM [get]
  More...
 

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  pic)

Constructs a copy of pic.

This constructor is fast thanks to implicit sharing.

Here is the call graph for this function:

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.

Here is the call graph for this function:

Member Function Documentation

override void QtGui.QPicture.CreateProxy ( )
virtual

Reimplemented from QtGui.QPaintDevice.

Here is the caller graph for this function:

new void QtGui.QPicture.Detach ( )
new void QtGui.QPicture.Dispose ( )
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 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 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

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.

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

override int QtGui.QPicture.DevType
get
System.Collections.Generic.List<string> QtGui.QPicture.InputFormatList
staticget

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.

System.Collections.Generic.List<QByteArray> QtGui.QPicture.InputFormats
staticget

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

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

bool QtGui.QPicture.IsDetached
get
bool QtGui.QPicture.IsNull
get

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

System.Collections.Generic.List<string> QtGui.QPicture.OutputFormatList
staticget

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.

System.Collections.Generic.List<QByteArray> QtGui.QPicture.OutputFormats
staticget

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

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

override QPaintEngine QtGui.QPicture.PaintEngine
get
uint QtGui.QPicture.Size
get

Returns the size of the picture data.

See also data().