[][src]Struct qt_gui::QPicture

#[repr(C)]
pub struct QPicture { /* fields omitted */ }

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

C++ class: QPicture.

C++ documentation:

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

Methods

impl QPicture[src]

pub unsafe fn bounding_rect(&self) -> CppBox<QRect>[src]

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

Calls C++ function: QRect QPicture::boundingRect() const.

C++ documentation:

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

See also setBoundingRect().

pub unsafe fn copy_from(
    &mut self,
    p: impl CastInto<Ref<QPicture>>
) -> MutRef<QPicture>
[src]

Assigns picture p to this picture and returns a reference to this picture.

Calls C++ function: QPicture& QPicture::operator=(const QPicture& p).

C++ documentation:

Assigns picture p to this picture and returns a reference to this picture.

pub unsafe fn data(&self) -> Ptr<c_char>[src]

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.

Calls C++ function: const char* QPicture::data() const.

C++ documentation:

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

pub unsafe fn detach(&mut self)[src]

Calls C++ function: void QPicture::detach().

pub unsafe fn dev_type(&self) -> c_int[src]

Calls C++ function: virtual int QPicture::devType() const.

pub unsafe fn input_format_list() -> CppBox<QStringList>[src]

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

Calls C++ function: static QStringList QPicture::inputFormatList().

C++ documentation:

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.

pub unsafe fn input_formats() -> CppBox<QListOfQByteArray>[src]

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

Calls C++ function: static QList<QByteArray> QPicture::inputFormats().

C++ documentation:

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

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

pub unsafe fn is_detached(&self) -> bool[src]

Calls C++ function: bool QPicture::isDetached() const.

pub unsafe fn is_null(&self) -> bool[src]

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

Calls C++ function: bool QPicture::isNull() const.

C++ documentation:

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

pub unsafe fn load_q_io_device_char(
    &mut self,
    dev: impl CastInto<MutPtr<QIODevice>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QPicture::load(QIODevice* dev, const char* format = …).

C++ documentation:

This is an overloaded function.

dev is the device to use for loading.

pub unsafe fn load_q_string_char(
    &mut self,
    file_name: impl CastInto<Ref<QString>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

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

Calls C++ function: bool QPicture::load(const QString& fileName, const char* format = …).

C++ documentation:

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

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

See also save().

pub unsafe fn load_q_io_device(
    &mut self,
    dev: impl CastInto<MutPtr<QIODevice>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QPicture::load(QIODevice* dev).

C++ documentation:

This is an overloaded function.

dev is the device to use for loading.

pub unsafe fn load_q_string(
    &mut self,
    file_name: impl CastInto<Ref<QString>>
) -> bool
[src]

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

Calls C++ function: bool QPicture::load(const QString& fileName).

C++ documentation:

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

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

See also save().

pub unsafe fn new_1a(format_version: c_int) -> CppBox<QPicture>[src]

Constructs an empty picture.

Calls C++ function: [constructor] void QPicture::QPicture(int formatVersion = …).

C++ documentation:

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.

pub unsafe fn new_0a() -> CppBox<QPicture>[src]

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

Calls C++ function: [constructor] void QPicture::QPicture().

C++ documentation:

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

pub unsafe fn new_copy(arg1: impl CastInto<Ref<QPicture>>) -> CppBox<QPicture>[src]

Constructs a copy of pic.

Calls C++ function: [constructor] void QPicture::QPicture(const QPicture& arg1).

C++ documentation:

Constructs a copy of pic.

This constructor is fast thanks to implicit sharing.

pub unsafe fn output_format_list() -> CppBox<QStringList>[src]

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

Calls C++ function: static QStringList QPicture::outputFormatList().

C++ documentation:

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.

pub unsafe fn output_formats() -> CppBox<QListOfQByteArray>[src]

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

Calls C++ function: static QList<QByteArray> QPicture::outputFormats().

C++ documentation:

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

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

pub unsafe fn paint_engine(&self) -> MutPtr<QPaintEngine>[src]

Calls C++ function: virtual QPaintEngine* QPicture::paintEngine() const.

pub unsafe fn picture_format(
    file_name: impl CastInto<Ref<QString>>
) -> Ptr<c_char>
[src]

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.

Calls C++ function: static const char* QPicture::pictureFormat(const QString& fileName).

C++ documentation:

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

pub unsafe fn play(&mut self, p: impl CastInto<MutPtr<QPainter>>) -> bool[src]

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

Calls C++ function: bool QPicture::play(QPainter* p).

C++ documentation:

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

pub unsafe fn save_q_io_device_char(
    &mut self,
    dev: impl CastInto<MutPtr<QIODevice>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QPicture::save(QIODevice* dev, const char* format = …).

C++ documentation:

This is an overloaded function.

dev is the device to use for saving.

pub unsafe fn save_q_string_char(
    &mut self,
    file_name: impl CastInto<Ref<QString>>,
    format: impl CastInto<Ptr<c_char>>
) -> bool
[src]

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

Calls C++ function: bool QPicture::save(const QString& fileName, const char* format = …).

C++ documentation:

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

pub unsafe fn save_q_io_device(
    &mut self,
    dev: impl CastInto<MutPtr<QIODevice>>
) -> bool
[src]

This is an overloaded function.

Calls C++ function: bool QPicture::save(QIODevice* dev).

C++ documentation:

This is an overloaded function.

dev is the device to use for saving.

pub unsafe fn save_q_string(
    &mut self,
    file_name: impl CastInto<Ref<QString>>
) -> bool
[src]

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

Calls C++ function: bool QPicture::save(const QString& fileName).

C++ documentation:

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

pub unsafe fn set_bounding_rect(&mut self, r: impl CastInto<Ref<QRect>>)[src]

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

Calls C++ function: void QPicture::setBoundingRect(const QRect& r).

C++ documentation:

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

See also boundingRect().

pub unsafe fn set_data(
    &mut self,
    data: impl CastInto<Ptr<c_char>>,
    size: c_uint
)
[src]

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

Calls C++ function: virtual void QPicture::setData(const char* data, unsigned int size).

C++ documentation:

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

See also data() and size().

pub unsafe fn size(&self) -> c_uint[src]

Returns the size of the picture data.

Calls C++ function: unsigned int QPicture::size() const.

C++ documentation:

Returns the size of the picture data.

See also data().

pub unsafe fn swap(&mut self, other: impl CastInto<MutRef<QPicture>>)[src]

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

Calls C++ function: void QPicture::swap(QPicture& other).

C++ documentation:

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

This function was introduced in Qt 4.8.

Methods from Deref<Target = QPaintDevice>

pub unsafe fn color_count(&self) -> c_int[src]

Returns the number of different colors available for the paint device. If the number of colors available is too great to be represented by the int data type, then INT_MAX will be returned instead.

Calls C++ function: int QPaintDevice::colorCount() const.

C++ documentation:

Returns the number of different colors available for the paint device. If the number of colors available is too great to be represented by the int data type, then INT_MAX will be returned instead.

pub unsafe fn depth(&self) -> c_int[src]

Returns the bit depth (number of bit planes) of the paint device.

Calls C++ function: int QPaintDevice::depth() const.

C++ documentation:

Returns the bit depth (number of bit planes) of the paint device.

pub unsafe fn dev_type(&self) -> c_int[src]

Calls C++ function: virtual int QPaintDevice::devType() const.

pub unsafe fn device_pixel_ratio(&self) -> c_int[src]

Returns the device pixel ratio for device.

Calls C++ function: int QPaintDevice::devicePixelRatio() const.

C++ documentation:

Returns the device pixel ratio for device.

Common values are 1 for normal-dpi displays and 2 for high-dpi "retina" displays.

pub unsafe fn device_pixel_ratio_f(&self) -> c_double[src]

Returns the device pixel ratio for the device as a floating point number.

Calls C++ function: double QPaintDevice::devicePixelRatioF() const.

C++ documentation:

Returns the device pixel ratio for the device as a floating point number.

This function was introduced in Qt 5.6.

pub unsafe fn height(&self) -> c_int[src]

Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

Calls C++ function: int QPaintDevice::height() const.

C++ documentation:

Returns the height of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

See also heightMM().

pub unsafe fn height_m_m(&self) -> c_int[src]

Returns the height of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

Calls C++ function: int QPaintDevice::heightMM() const.

C++ documentation:

Returns the height of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

See also height().

pub unsafe fn logical_dpi_x(&self) -> c_int[src]

Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM().

Calls C++ function: int QPaintDevice::logicalDpiX() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from widthMM().

Note that if the logicalDpiX() doesn't equal the physicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.

See also logicalDpiY() and physicalDpiX().

pub unsafe fn logical_dpi_y(&self) -> c_int[src]

Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM().

Calls C++ function: int QPaintDevice::logicalDpiY() const.

C++ documentation:

Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from heightMM().

Note that if the logicalDpiY() doesn't equal the physicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.

See also logicalDpiX() and physicalDpiY().

pub unsafe fn paint_engine(&self) -> MutPtr<QPaintEngine>[src]

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

Calls C++ function: pure virtual QPaintEngine* QPaintDevice::paintEngine() const.

C++ documentation:

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

pub unsafe fn painting_active(&self) -> bool[src]

Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

Calls C++ function: bool QPaintDevice::paintingActive() const.

C++ documentation:

Returns true if the device is currently being painted on, i.e. someone has called QPainter::begin() but not yet called QPainter::end() for this device; otherwise returns false.

See also QPainter::isActive().

pub unsafe fn physical_dpi_x(&self) -> c_int[src]

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Calls C++ function: int QPaintDevice::physicalDpiX() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Note that if the physicalDpiX() doesn't equal the logicalDpiX(), the corresponding QPaintEngine must handle the resolution mapping.

See also physicalDpiY() and logicalDpiX().

pub unsafe fn physical_dpi_y(&self) -> c_int[src]

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Calls C++ function: int QPaintDevice::physicalDpiY() const.

C++ documentation:

Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

Note that if the physicalDpiY() doesn't equal the logicalDpiY(), the corresponding QPaintEngine must handle the resolution mapping.

See also physicalDpiX() and logicalDpiY().

pub unsafe fn width(&self) -> c_int[src]

Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

Calls C++ function: int QPaintDevice::width() const.

C++ documentation:

Returns the width of the paint device in default coordinate system units (e.g. pixels for QPixmap and QWidget).

See also widthMM().

pub unsafe fn width_m_m(&self) -> c_int[src]

Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

Calls C++ function: int QPaintDevice::widthMM() const.

C++ documentation:

Returns the width of the paint device in millimeters. Due to platform limitations it may not be possible to use this function to determine the actual physical size of a widget on the screen.

See also width().

Trait Implementations

impl CppDeletable for QPicture[src]

unsafe fn delete(&mut self)[src]

Destroys the picture.

Calls C++ function: virtual [destructor] void QPicture::~QPicture().

C++ documentation:

Destroys the picture.

impl Data for QPicture[src]

type Output = Ptr<c_char>

unsafe fn data(&self) -> Ptr<c_char>[src]

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.

Calls C++ function: const char* QPicture::data() const.

C++ documentation:

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

impl Deref for QPicture[src]

type Target = QPaintDevice

The resulting type after dereferencing.

fn deref(&self) -> &QPaintDevice[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPicture* ptr).

impl DerefMut for QPicture[src]

fn deref_mut(&mut self) -> &mut QPaintDevice[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPicture* ptr).

impl DynamicCast<QPicture> for QPaintDevice[src]

unsafe fn dynamic_cast(ptr: Ptr<QPaintDevice>) -> Ptr<QPicture>[src]

Calls C++ function: QPicture* dynamic_cast<QPicture*>(QPaintDevice* ptr).

unsafe fn dynamic_cast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QPicture>[src]

Calls C++ function: QPicture* dynamic_cast<QPicture*>(QPaintDevice* ptr).

impl Size for QPicture[src]

unsafe fn size(&self) -> usize[src]

Returns the size of the picture data.

Calls C++ function: unsigned int QPicture::size() const.

C++ documentation:

Returns the size of the picture data.

See also data().

impl StaticDowncast<QPicture> for QPaintDevice[src]

unsafe fn static_downcast(ptr: Ptr<QPaintDevice>) -> Ptr<QPicture>[src]

Calls C++ function: QPicture* static_cast<QPicture*>(QPaintDevice* ptr).

unsafe fn static_downcast_mut(ptr: MutPtr<QPaintDevice>) -> MutPtr<QPicture>[src]

Calls C++ function: QPicture* static_cast<QPicture*>(QPaintDevice* ptr).

impl StaticUpcast<QPaintDevice> for QPicture[src]

unsafe fn static_upcast(ptr: Ptr<QPicture>) -> Ptr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPicture* ptr).

unsafe fn static_upcast_mut(ptr: MutPtr<QPicture>) -> MutPtr<QPaintDevice>[src]

Calls C++ function: QPaintDevice* static_cast<QPaintDevice*>(QPicture* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VectorAsSlice for V where
    V: Data<Output = Ptr<T>> + Size
[src]

type Item = T