• PySide 模块
  • PySide.QtGui
  • 内容表

    上一话题

    QPaintEngineState

    下一话题

    QTextItem

    QPaintEngine

    概要

    函数

    虚函数

    详细描述

    PySide.QtGui.QPaintEngine class provides an abstract definition of how PySide.QtGui.QPainter 绘制到给定设备在给定平台。

    Qt 4.0 provides several premade implementations of PySide.QtGui.QPaintEngine for the different painter backends we support. We provide one paint engine for each window system and painting framework we support. This includes X11 on Unix/Linux and CoreGraphics on Mac OS X. In addition we provide PySide.QtGui.QPaintEngine implementations for OpenGL (accessible through PySide.QtOpenGL.QGLWidget ) and PostScript (accessible through QPSPrinter on X11). Additionally there is a raster-based paint engine that is a fallback for when an engine does not support a certain capability.

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

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

    The big advantage of the PySide.QtGui.QPaintEngine approach opposed to Qt 3's PySide.QtGui.QPainter /QPaintDevice::cmd() approach is that it is now possible to adapt to multiple technologies on each platform and take advantage of each to the fullest.

    class PySide.QtGui. QPaintEngine ( [ features=0 ] )
    参数: features PySide.QtGui.QPaintEngine.PaintEngineFeatures
    PySide.QtGui.QPaintEngine. PolygonDrawMode
    常量 描述
    QPaintEngine.OddEvenMode The polygon should be drawn using OddEven fill rule.
    QPaintEngine.WindingMode The polygon should be drawn using Winding fill rule.
    QPaintEngine.ConvexMode The polygon is a convex polygon and can be drawn using specialized algorithms where available.
    QPaintEngine.PolylineMode Only the outline of the polygon should be drawn.
    PySide.QtGui.QPaintEngine. Type
    常量 描述
    QPaintEngine.X11  
    QPaintEngine.Windows  
    QPaintEngine.MacPrinter  
    QPaintEngine.CoreGraphics Mac OS X's Quartz2D ( CoreGraphics )
    QPaintEngine.QuickDraw Mac OS X's QuickDraw
    QPaintEngine.QWindowSystem Qt for Embedded Linux
    QPaintEngine.PostScript  
    QPaintEngine.OpenGL  
    QPaintEngine.Picture PySide.QtGui.QPicture format
    QPaintEngine.SVG Scalable Vector Graphics XML format
    QPaintEngine.Raster  
    QPaintEngine.Direct3D Windows only, Direct3D based engine
    QPaintEngine.Pdf PDF (便携式文档格式)
    QPaintEngine.OpenVG  
    QPaintEngine.User First user type ID
    QPaintEngine.MaxUser Last user type ID
    QPaintEngine.OpenGL2  
    QPaintEngine.PaintBuffer  
    QPaintEngine.Blitter  
    PySide.QtGui.QPaintEngine. PaintEngineFeature

    This enum is used to describe the features or capabilities that the paint engine has. If a feature is not supported by the engine, PySide.QtGui.QPainter will do a best effort to emulate that feature through other means and pass on an alpha blended PySide.QtGui.QImage to the engine with the emulated results. Some features cannot be emulated: AlphaBlend and PorterDuff .

    常量 描述
    QPaintEngine.AlphaBlend 引擎可以 alpha 融合原语。
    QPaintEngine.Antialiasing The engine can use antialising to improve the appearance of rendered primitives.
    QPaintEngine.BlendModes 引擎支持融合模式。
    QPaintEngine.BrushStroke The engine supports drawing strokes that contain brushes as fills, not just solid colors (e.g. a dashed gradient line of width 2).
    QPaintEngine.ConicalGradientFill The engine supports conical gradient fills.
    QPaintEngine.ConstantOpacity The engine supports the feature provided by QPainter.setOpacity() .
    QPaintEngine.LinearGradientFill The engine supports linear gradient fills.
    QPaintEngine.MaskedBrush The engine is capable of rendering brushes that has a texture with an alpha channel or a mask.
    QPaintEngine.ObjectBoundingModeGradients The engine has native support for gradients with coordinate mode QGradient.ObjectBoundingMode . Otherwise, if QPaintEngine.PatternTransform is supported, object bounding mode gradients are converted to gradients with coordinate mode QGradient.LogicalMode and a brush transform for the coordinate mapping.
    QPaintEngine.PainterPaths The engine has path support.
    QPaintEngine.PaintOutsidePaintEvent The engine is capable of painting outside of paint events.
    QPaintEngine.PatternBrush The engine is capable of rendering brushes with the brush patterns specified in Qt.BrushStyle .
    QPaintEngine.PatternTransform The engine has support for transforming brush patterns.
    QPaintEngine.PerspectiveTransform The engine has support for performing perspective transformations on primitives.
    QPaintEngine.PixmapTransform The engine can transform pixmaps, including rotation and shearing.
    QPaintEngine.PorterDuff The engine supports Porter-Duff operations
    QPaintEngine.PrimitiveTransform The engine has support for transforming drawing primitives.
    QPaintEngine.RadialGradientFill The engine supports radial gradient fills.
    QPaintEngine.RasterOpModes The engine supports bitwise raster operations.
    QPaintEngine.AllFeatures All of the above features. This enum value is usually used as a bit mask.
    PySide.QtGui.QPaintEngine. DirtyFlag
    常量 描述
    QPaintEngine.DirtyPen The pen is dirty and needs to be updated.
    QPaintEngine.DirtyBrush The brush is dirty and needs to be updated.
    QPaintEngine.DirtyBrushOrigin The brush origin is dirty and needs to updated.
    QPaintEngine.DirtyFont The font is dirty and needs to be updated.
    QPaintEngine.DirtyBackground The background is dirty and needs to be updated.
    QPaintEngine.DirtyBackgroundMode The background mode is dirty and needs to be updated.
    QPaintEngine.DirtyTransform The transform is dirty and needs to be updated.
    QPaintEngine.DirtyClipRegion The clip region is dirty and needs to be updated.
    QPaintEngine.DirtyClipPath The clip path is dirty and needs to be updated.
    QPaintEngine.DirtyHints The render hints is dirty and needs to be updated.
    QPaintEngine.DirtyCompositionMode The composition mode is dirty and needs to be updated.
    QPaintEngine.DirtyClipEnabled Whether clipping is enabled or not is dirty and needs to be updated.
    QPaintEngine.DirtyOpacity The constant opacity has changed and needs to be updated as part of the state change in QPaintEngine.updateState() .
    QPaintEngine.AllDirty Convenience enum used internally.

    These types are used by PySide.QtGui.QPainter to trigger lazy updates of the various states in the PySide.QtGui.QPaintEngine 使用 QPaintEngine.updateState() .

    描绘引擎必须更新每脏点状态。

    PySide.QtGui.QPaintEngine. extended
    PySide.QtGui.QPaintEngine. selfDestruct
    PySide.QtGui.QPaintEngine. active
    PySide.QtGui.QPaintEngine. state
    PySide.QtGui.QPaintEngine. gccaps
    PySide.QtGui.QPaintEngine. autoDestruct ( )
    返回类型: PySide.QtCore.bool
    PySide.QtGui.QPaintEngine. begin ( pdev )
    参数: pdev PySide.QtGui.QPaintDevice
    返回类型: PySide.QtCore.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.

    PySide.QtGui.QPaintEngine. clearDirty ( df )
    参数: df PySide.QtGui.QPaintEngine.DirtyFlags
    PySide.QtGui.QPaintEngine. coordinateOffset ( )
    返回类型: PySide.QtCore.QPoint

    Returns the offset from the painters origo to the engines origo. This value is used by PySide.QtGui.QPainter for engines who have internal double buffering.

    This function only makes sense when the engine is active.

    PySide.QtGui.QPaintEngine. drawEllipse ( r )
    参数: r PySide.QtCore.QRectF

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

    默认实现调用 PySide.QtGui.QPaintEngine.drawPolygon() .

    PySide.QtGui.QPaintEngine. drawEllipse ( r )
    参数: r PySide.QtCore.QRect

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

    PySide.QtGui.QPaintEngine. drawImage ( r , pm , sr [ , flags=Qt.AutoColor ] )
    参数:
    PySide.QtGui.QPaintEngine. drawLines ( lines , lineCount )
    参数:

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

    PySide.QtGui.QPaintEngine. drawLines ( lines , lineCount )
    参数:

    这是重载函数。

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

    PySide.QtGui.QPaintEngine. drawPath ( path )
    参数: path PySide.QtGui.QPainterPath

    The default implementation ignores the path and does nothing.

    PySide.QtGui.QPaintEngine. drawPixmap ( r , pm , sr )
    参数:

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

    PySide.QtGui.QPaintEngine. drawPoints ( points , pointCount )
    参数:

    Draws the first pointCount points in the buffer points

    PySide.QtGui.QPaintEngine. drawPoints ( points , pointCount )
    参数:

    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.

    PySide.QtGui.QPaintEngine. drawPolygon ( points , pointCount , mode )
    参数:

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

    注意

    At least one of the PySide.QtGui.QPaintEngine.drawPolygon() functions must be reimplemented.

    PySide.QtGui.QPaintEngine. drawPolygon ( points , pointCount , mode )
    参数:

    这是重载函数。

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

    注意

    At least one of the PySide.QtGui.QPaintEngine.drawPolygon() functions must be reimplemented.

    PySide.QtGui.QPaintEngine. drawRects ( rects , rectCount )
    参数:

    这是重载函数。

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

    PySide.QtGui.QPaintEngine. drawRects ( rects , rectCount )
    参数:

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

    PySide.QtGui.QPaintEngine. drawTextItem ( p , textItem )
    参数:

    This function draws the text item textItem 在位置 p . The default implementation of this function converts the text to a PySide.QtGui.QPainterPath and paints the resulting path.

    PySide.QtGui.QPaintEngine. drawTiledPixmap ( r , pixmap , s )
    参数:

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

    PySide.QtGui.QPaintEngine. end ( )
    返回类型: PySide.QtCore.bool

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

    PySide.QtGui.QPaintEngine. hasFeature ( feature )
    参数: feature PySide.QtGui.QPaintEngine.PaintEngineFeatures
    返回类型: PySide.QtCore.bool
    PySide.QtGui.QPaintEngine. isActive ( )
    返回类型: PySide.QtCore.bool

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

    PySide.QtGui.QPaintEngine. isExtended ( )
    返回类型: PySide.QtCore.bool

    Returns true if the paint engine is a QPaintEngineEx derivative.

    PySide.QtGui.QPaintEngine. paintDevice ( )
    返回类型: PySide.QtGui.QPaintDevice

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

    PySide.QtGui.QPaintEngine. painter ( )
    返回类型: PySide.QtGui.QPainter

    Returns the paint engine's painter.

    PySide.QtGui.QPaintEngine. setActive ( newState )
    参数: newState PySide.QtCore.bool

    Sets the active state of the paint engine to state .

    PySide.QtGui.QPaintEngine. setAutoDestruct ( autoDestr )
    参数: autoDestr PySide.QtCore.bool
    PySide.QtGui.QPaintEngine. setDirty ( df )
    参数: df PySide.QtGui.QPaintEngine.DirtyFlags
    PySide.QtGui.QPaintEngine. setSystemClip ( baseClip )
    参数: baseClip PySide.QtGui.QRegion

    Sets the system clip for this engine. The system clip defines the basis area that the engine has to draw in. All clips that are set will be be an intersection with the system clip.

    Reset the systemclip to no clip by setting an empty region.

    PySide.QtGui.QPaintEngine. setSystemRect ( rect )
    参数: rect PySide.QtCore.QRect

    Sets the target rect for drawing within the backing store. This function should ONLY be used by the backing store.

    PySide.QtGui.QPaintEngine. syncState ( )

    Updates all dirty states in this engine. This function should ONLY be used when drawing with native handles directly and immediate sync from QPainters state to the native state is required.

    PySide.QtGui.QPaintEngine. systemClip ( )
    返回类型: PySide.QtGui.QRegion

    Returns the system clip. The system clip is read only while the painter is active. An empty region indicates that system clip is not in use.

    PySide.QtGui.QPaintEngine. systemRect ( )
    返回类型: PySide.QtCore.QRect

    Retrieves the rect for drawing within the backing store. This function should ONLY be used by the backing store.

    PySide.QtGui.QPaintEngine. testDirty ( df )
    参数: df PySide.QtGui.QPaintEngine.DirtyFlags
    返回类型: PySide.QtCore.bool
    PySide.QtGui.QPaintEngine. type ( )
    返回类型: PySide.QtGui.QPaintEngine.Type

    Reimplement this function to return the paint engine QPaintEngine.Type .

    PySide.QtGui.QPaintEngine. updateState ( state )
    参数: state PySide.QtGui.QPaintEngineState

    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.