Struct rute::auto::paint_engine::PaintEngine
source · pub struct PaintEngine<'a> { /* private fields */ }
Expand description
Notice these docs are heavy WIP and not very relevent yet
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.
See also: Painter
PaintDevice::paint_engine
{Paint System}
Licence
The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Implementations
sourceimpl<'a> PaintEngine<'a>
impl<'a> PaintEngine<'a>
sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Returns true
if the paint engine is actively drawing; otherwise
returns false.
See also: [set_active()
]
sourcepub fn set_active(&self, new_state: bool) -> &Self
pub fn set_active(&self, new_state: bool) -> &Self
Sets the active state of the paint engine to state.
See also: [is_active()
]
sourcepub fn begin<P: PaintDeviceTrait<'a>>(&self, pdev: &P) -> bool
pub fn begin<P: PaintDeviceTrait<'a>>(&self, pdev: &P) -> 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.
See also: [end()
]
[is_active()
]
sourcepub fn end(&self) -> bool
pub 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.
See also: [begin()
]
[is_active()
]
sourcepub fn update_state<P: PaintEngineStateTrait<'a>>(&self, state: &P) -> &Self
pub fn update_state<P: PaintEngineStateTrait<'a>>(&self, state: &P) -> &Self
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: PaintEngineState
sourcepub fn draw_rects<R: RectTrait<'a>>(&self, rects: &R, rect_count: i32) -> &Self
pub fn draw_rects<R: RectTrait<'a>>(&self, rects: &R, rect_count: i32) -> &Self
Overloads The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.
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.
sourcepub fn draw_rects_2<R: RectFTrait<'a>>(&self, rects: &R, rect_count: i32) -> &Self
pub fn draw_rects_2<R: RectFTrait<'a>>(&self, rects: &R, rect_count: i32) -> &Self
Overloads The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.
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.
sourcepub fn draw_lines<L: LineTrait<'a>>(&self, lines: &L, line_count: i32) -> &Self
pub fn draw_lines<L: LineTrait<'a>>(&self, lines: &L, line_count: i32) -> &Self
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.
Overloads The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.
sourcepub fn draw_lines_2<L: LineFTrait<'a>>(&self, lines: &L, line_count: i32) -> &Self
pub fn draw_lines_2<L: LineFTrait<'a>>(&self, lines: &L, line_count: i32) -> &Self
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.
Overloads The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.
sourcepub fn draw_ellipse<R: RectFTrait<'a>>(&self, r: &R) -> &Self
pub fn draw_ellipse<R: RectFTrait<'a>>(&self, r: &R) -> &Self
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
The default implementation calls drawPolygon().
The default implementation of this function calls the floating point version of this function
sourcepub fn draw_ellipse_2<R: RectTrait<'a>>(&self, r: &R) -> &Self
pub fn draw_ellipse_2<R: RectTrait<'a>>(&self, r: &R) -> &Self
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
The default implementation calls drawPolygon().
The default implementation of this function calls the floating point version of this function
sourcepub fn draw_points<P: PointFTrait<'a>>(
&self,
points: &P,
point_count: i32
) -> &Self
pub fn draw_points<P: PointFTrait<'a>>(
&self,
points: &P,
point_count: i32
) -> &Self
The default implementation ignores the path and does nothing.
Draws the first pointCount points in the buffer points
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.
sourcepub fn draw_points_2<P: PointTrait<'a>>(
&self,
points: &P,
point_count: i32
) -> &Self
pub fn draw_points_2<P: PointTrait<'a>>(
&self,
points: &P,
point_count: i32
) -> &Self
Draws the first pointCount points in the buffer points
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.
sourcepub fn draw_polygon<P: PointFTrait<'a>>(
&self,
points: &P,
point_count: i32,
mode: PolygonDrawMode
) -> &Self
pub fn draw_polygon<P: PointFTrait<'a>>(
&self,
points: &P,
point_count: i32,
mode: PolygonDrawMode
) -> &Self
PolygonDrawMode mode)
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.
Overloads 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.
sourcepub fn draw_polygon_2<P: PointTrait<'a>>(
&self,
points: &P,
point_count: i32,
mode: PolygonDrawMode
) -> &Self
pub fn draw_polygon_2<P: PointTrait<'a>>(
&self,
points: &P,
point_count: i32,
mode: PolygonDrawMode
) -> &Self
PolygonDrawMode mode)
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.
Overloads 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.
sourcepub fn draw_pixmap<P: PixmapTrait<'a>, R: RectFTrait<'a>>(
&self,
r: &R,
pm: &P,
sr: &R
) -> &Self
pub fn draw_pixmap<P: PixmapTrait<'a>, R: RectFTrait<'a>>(
&self,
r: &R,
pm: &P,
sr: &R
) -> &Self
&pm, const QRectF &sr)
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
sourcepub fn draw_tiled_pixmap<P: PixmapTrait<'a>, Q: PointFTrait<'a>, R: RectFTrait<'a>>(
&self,
r: &R,
pixmap: &P,
s: &Q
) -> &Self
pub fn draw_tiled_pixmap<P: PixmapTrait<'a>, Q: PointFTrait<'a>, R: RectFTrait<'a>>(
&self,
r: &R,
pixmap: &P,
s: &Q
) -> &Self
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.
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.
sourcepub fn draw_image<I: ImageTrait<'a>, R: RectFTrait<'a>>(
&self,
r: &R,
pm: &I,
sr: &R,
flags: ImageConversionFlags
) -> &Self
pub fn draw_image<I: ImageTrait<'a>, R: RectFTrait<'a>>(
&self,
r: &R,
pm: &I,
sr: &R,
flags: ImageConversionFlags
) -> &Self
&image, const QRectF &sr, Qt::ImageConversionFlags flags)
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.
pub fn set_paint_device<P: PaintDeviceTrait<'a>>(&self, device: &P) -> &Self
sourcepub fn paint_device(&self) -> Option<PaintDevice<'_>>
pub fn paint_device(&self) -> Option<PaintDevice<'_>>
Returns the device that this engine is painting on, if painting is active; otherwise returns 0.
pub fn set_system_clip<R: RegionTrait<'a>>(&self, base_clip: &R) -> &Self
pub fn system_clip(&self) -> Region<'_>
pub fn set_system_rect<R: RectTrait<'a>>(&self, rect: &R) -> &Self
pub fn system_rect(&self) -> Rect<'_>
pub fn coordinate_offset(&self) -> Point<'_>
pub fn build(&self) -> Self
Trait Implementations
sourceimpl<'a> Clone for PaintEngine<'a>
impl<'a> Clone for PaintEngine<'a>
sourcefn clone(&self) -> PaintEngine<'a>
fn clone(&self) -> PaintEngine<'a>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more