Struct qt_gui::QPaintEngine

source ·
#[repr(C)]
pub struct QPaintEngine { /* private fields */ }
Expand description

The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a given platform.

C++ class: QPaintEngine.

C++ documentation:

The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a given platform.

Qt provides several premade implementations of QPaintEngine for the different painter backends we support. The primary paint engine provided is the raster paint engine, which contains a software rasterizer which supports the full feature set on all supported platforms. This is the default for painting on QWidget-based classes in e.g. on Windows, X11 and macOS, it is the backend for painting on QImage and it is used as a fallback for paint engines that do not support a certain capability. In addition we provide QPaintEngine implementations for OpenGL (accessible through QGLWidget) and printing (which allows using QPainter to draw on a QPrinter object).

If one wants to use QPainter to draw to a different backend, one must subclass QPaintEngine and reimplement all its virtual functions. The QPaintEngine implementation is then made available by subclassing QPaintDevice and reimplementing the virtual function QPaintDevice::paintEngine().

QPaintEngine is created and owned by the QPaintDevice that created it.

Implementations§

source§

impl QPaintEngine

source

pub unsafe fn begin(&self, pdev: impl CastInto<Ptr<QPaintDevice>>) -> bool

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. Return true if the initialization was successful; otherwise return false.

Calls C++ function: pure virtual bool QPaintEngine::begin(QPaintDevice* pdev).

C++ documentation:

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. Return true if the initialization was successful; otherwise return false.

See also end() and isActive().

source

pub unsafe fn clear_dirty(&self, df: QFlags<DirtyFlag>)

Calls C++ function: void QPaintEngine::clearDirty(QFlags<QPaintEngine::DirtyFlag> df).

source

pub unsafe fn coordinate_offset(&self) -> CppBox<QPoint>

Calls C++ function: virtual QPoint QPaintEngine::coordinateOffset() const.

source

pub unsafe fn draw_ellipse_q_rect_f(&self, r: impl CastInto<Ref<QRectF>>)

Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.

Calls C++ function: virtual void QPaintEngine::drawEllipse(const QRectF& r).

C++ documentation:

Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.

The default implementation calls drawPolygon().

source

pub unsafe fn draw_ellipse_q_rect(&self, r: impl CastInto<Ref<QRect>>)

The default implementation of this function calls the floating point version of this function

Calls C++ function: virtual void QPaintEngine::drawEllipse(const QRect& r).

C++ documentation:

The default implementation of this function calls the floating point version of this function

source

pub unsafe fn draw_image_4a( &self, r: impl CastInto<Ref<QRectF>>, pm: impl CastInto<Ref<QImage>>, sr: impl CastInto<Ref<QRectF>>, flags: QFlags<ImageConversionFlag> )

Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.

Calls C++ function: virtual void QPaintEngine::drawImage(const QRectF& r, const QImage& pm, const QRectF& sr, QFlags<Qt::ImageConversionFlag> flags = …).

C++ documentation:

Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.

source

pub unsafe fn draw_image_3a( &self, r: impl CastInto<Ref<QRectF>>, pm: impl CastInto<Ref<QImage>>, sr: impl CastInto<Ref<QRectF>> )

Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.

Calls C++ function: virtual void QPaintEngine::drawImage(const QRectF& r, const QImage& pm, const QRectF& sr).

C++ documentation:

Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.

source

pub unsafe fn draw_lines_q_line_int( &self, lines: impl CastInto<Ptr<QLine>>, line_count: c_int )

This is an overloaded function.

Calls C++ function: virtual void QPaintEngine::drawLines(const QLine* lines, int lineCount).

C++ documentation:

This is an overloaded function.

The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.

source

pub unsafe fn draw_lines_q_line_f_int( &self, lines: impl CastInto<Ptr<QLineF>>, line_count: c_int )

The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.

Calls C++ function: virtual void QPaintEngine::drawLines(const QLineF* lines, int lineCount).

C++ documentation:

The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.

source

pub unsafe fn draw_path(&self, path: impl CastInto<Ref<QPainterPath>>)

The default implementation ignores the path and does nothing.

Calls C++ function: virtual void QPaintEngine::drawPath(const QPainterPath& path).

C++ documentation:

The default implementation ignores the path and does nothing.

source

pub unsafe fn draw_pixmap( &self, r: impl CastInto<Ref<QRectF>>, pm: impl CastInto<Ref<QPixmap>>, sr: impl CastInto<Ref<QRectF>> )

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

Calls C++ function: pure virtual void QPaintEngine::drawPixmap(const QRectF& r, const QPixmap& pm, const QRectF& sr).

C++ documentation:

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

source

pub unsafe fn draw_points_q_point_f_int( &self, points: impl CastInto<Ptr<QPointF>>, point_count: c_int )

Draws the first pointCount points in the buffer points

Calls C++ function: virtual void QPaintEngine::drawPoints(const QPointF* points, int pointCount).

C++ documentation:

Draws the first pointCount points in the buffer points

source

pub unsafe fn draw_points_q_point_int( &self, points: impl CastInto<Ptr<QPoint>>, point_count: c_int )

Draws the first pointCount points in the buffer points

Calls C++ function: virtual void QPaintEngine::drawPoints(const QPoint* points, int pointCount).

C++ documentation:

Draws the first pointCount points in the buffer points

The default implementation converts the first pointCount QPoints in points to QPointFs and calls the floating point version of drawPoints.

source

pub unsafe fn draw_polygon_q_point_f_int_polygon_draw_mode( &self, points: impl CastInto<Ptr<QPointF>>, point_count: c_int, mode: PolygonDrawMode )

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

Calls C++ function: virtual void QPaintEngine::drawPolygon(const QPointF* points, int pointCount, QPaintEngine::PolygonDrawMode mode).

C++ documentation:

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

Note: At least one of the drawPolygon() functions must be reimplemented.

source

pub unsafe fn draw_polygon_q_point_int_polygon_draw_mode( &self, points: impl CastInto<Ptr<QPoint>>, point_count: c_int, mode: PolygonDrawMode )

This is an overloaded function.

Calls C++ function: virtual void QPaintEngine::drawPolygon(const QPoint* points, int pointCount, QPaintEngine::PolygonDrawMode mode).

C++ documentation:

This is an overloaded function.

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

Note: At least one of the drawPolygon() functions must be reimplemented.

source

pub unsafe fn draw_rects_q_rect_int( &self, rects: impl CastInto<Ptr<QRect>>, rect_count: c_int )

This is an overloaded function.

Calls C++ function: virtual void QPaintEngine::drawRects(const QRect* rects, int rectCount).

C++ documentation:

This is an overloaded function.

The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.

source

pub unsafe fn draw_rects_q_rect_f_int( &self, rects: impl CastInto<Ptr<QRectF>>, rect_count: c_int )

Draws the first rectCount rectangles in the buffer rects. The default implementation of this function calls drawPath() or drawPolygon() depending on the feature set of the paint engine.

Calls C++ function: virtual void QPaintEngine::drawRects(const QRectF* rects, int rectCount).

C++ documentation:

Draws the first rectCount rectangles in the buffer rects. The default implementation of this function calls drawPath() or drawPolygon() depending on the feature set of the paint engine.

source

pub unsafe fn draw_text_item( &self, p: impl CastInto<Ref<QPointF>>, text_item: impl CastInto<Ref<QTextItem>> )

This function draws the text item textItem at position p. The default implementation of this function converts the text to a QPainterPath and paints the resulting path.

Calls C++ function: virtual void QPaintEngine::drawTextItem(const QPointF& p, const QTextItem& textItem).

C++ documentation:

This function draws the text item textItem at position p. The default implementation of this function converts the text to a QPainterPath and paints the resulting path.

source

pub unsafe fn draw_tiled_pixmap( &self, r: impl CastInto<Ref<QRectF>>, pixmap: impl CastInto<Ref<QPixmap>>, s: impl CastInto<Ref<QPointF>> )

Reimplement this function to draw the pixmap in the given rect, starting at the given p. The pixmap will be drawn repeatedly until the rect is filled.

Calls C++ function: virtual void QPaintEngine::drawTiledPixmap(const QRectF& r, const QPixmap& pixmap, const QPointF& s).

C++ documentation:

Reimplement this function to draw the pixmap in the given rect, starting at the given p. The pixmap will be drawn repeatedly until the rect is filled.

source

pub unsafe fn end(&self) -> bool

Reimplement this function to finish painting on the current paint device. Return true if painting was finished successfully; otherwise return false.

Calls C++ function: pure virtual bool QPaintEngine::end().

C++ documentation:

Reimplement this function to finish painting on the current paint device. Return true if painting was finished successfully; otherwise return false.

See also begin() and isActive().

source

pub unsafe fn fix_neg_rect( &self, x: *mut c_int, y: *mut c_int, w: *mut c_int, h: *mut c_int )

Calls C++ function: void QPaintEngine::fix_neg_rect(int* x, int* y, int* w, int* h).

source

pub unsafe fn has_feature(&self, feature: QFlags<PaintEngineFeature>) -> bool

Returns true if the paint engine supports the specified feature; otherwise returns false.

Calls C++ function: bool QPaintEngine::hasFeature(QFlags<QPaintEngine::PaintEngineFeature> feature) const.

C++ documentation:

Returns true if the paint engine supports the specified feature; otherwise returns false.

source

pub unsafe fn is_active(&self) -> bool

Returns true if the paint engine is actively drawing; otherwise returns false.

Calls C++ function: bool QPaintEngine::isActive() const.

C++ documentation:

Returns true if the paint engine is actively drawing; otherwise returns false.

See also setActive().

source

pub unsafe fn is_extended(&self) -> bool

Calls C++ function: bool QPaintEngine::isExtended() const.

source

pub unsafe fn paint_device(&self) -> Ptr<QPaintDevice>

Returns the device that this engine is painting on, if painting is active; otherwise returns 0.

Calls C++ function: QPaintDevice* QPaintEngine::paintDevice() const.

C++ documentation:

Returns the device that this engine is painting on, if painting is active; otherwise returns 0.

source

pub unsafe fn painter(&self) -> Ptr<QPainter>

Returns the paint engine's painter.

Calls C++ function: QPainter* QPaintEngine::painter() const.

C++ documentation:

Returns the paint engine’s painter.

source

pub unsafe fn set_active(&self, new_state: bool)

Sets the active state of the paint engine to state.

Calls C++ function: void QPaintEngine::setActive(bool newState).

C++ documentation:

Sets the active state of the paint engine to state.

See also isActive().

source

pub unsafe fn set_dirty(&self, df: QFlags<DirtyFlag>)

Calls C++ function: void QPaintEngine::setDirty(QFlags<QPaintEngine::DirtyFlag> df).

source

pub unsafe fn set_paint_device(&self, device: impl CastInto<Ptr<QPaintDevice>>)

Calls C++ function: void QPaintEngine::setPaintDevice(QPaintDevice* device).

source

pub unsafe fn set_system_clip(&self, base_clip: impl CastInto<Ref<QRegion>>)

Calls C++ function: void QPaintEngine::setSystemClip(const QRegion& baseClip).

source

pub unsafe fn set_system_rect(&self, rect: impl CastInto<Ref<QRect>>)

Calls C++ function: void QPaintEngine::setSystemRect(const QRect& rect).

source

pub unsafe fn sync_state(&self)

Calls C++ function: void QPaintEngine::syncState().

source

pub unsafe fn system_clip(&self) -> CppBox<QRegion>

Calls C++ function: QRegion QPaintEngine::systemClip() const.

source

pub unsafe fn system_rect(&self) -> CppBox<QRect>

Calls C++ function: QRect QPaintEngine::systemRect() const.

source

pub unsafe fn test_dirty(&self, df: QFlags<DirtyFlag>) -> bool

Calls C++ function: bool QPaintEngine::testDirty(QFlags<QPaintEngine::DirtyFlag> df).

source

pub unsafe fn type_(&self) -> Type

Reimplement this function to return the paint engine Type.

Calls C++ function: pure virtual QPaintEngine::Type QPaintEngine::type() const.

C++ documentation:

Reimplement this function to return the paint engine Type.

source

pub unsafe fn update_state(&self, state: impl CastInto<Ref<QPaintEngineState>>)

Reimplement this function to update the state of a paint engine.

Calls C++ function: pure virtual void QPaintEngine::updateState(const QPaintEngineState& state).

C++ documentation:

Reimplement this function to update the state of a paint engine.

When implemented, this function is responsible for checking the paint engine's current state and update the properties that are changed. Use the QPaintEngineState::state() function to find out which properties that must be updated, then use the corresponding get function to retrieve the current values for the given properties.

See also QPaintEngineState.

Trait Implementations§

source§

impl CppDeletable for QPaintEngine

source§

unsafe fn delete(&self)

Destroys the paint engine.

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

C++ documentation:

Destroys the paint engine.

source§

impl EndMut for QPaintEngine

source§

unsafe fn end_mut(&self) -> bool

Reimplement this function to finish painting on the current paint device. Return true if painting was finished successfully; otherwise return false.

Calls C++ function: pure virtual bool QPaintEngine::end().

C++ documentation:

Reimplement this function to finish painting on the current paint device. Return true if painting was finished successfully; otherwise return false.

See also begin() and isActive().

§

type Output = bool

Output type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.