Qyoto  4.0.5
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Properties
QtGui.QPaintEngine Class Referenceabstract

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

Inheritance diagram for QtGui.QPaintEngine:
Collaboration diagram for QtGui.QPaintEngine:

Public Types

enum  DirtyFlag {
  AllDirty = 65535, DirtyBackground = 16, DirtyBackgroundMode = 32, DirtyBrush = 2,
  DirtyBrushOrigin = 4, DirtyClipEnabled = 2048, DirtyClipPath = 256, DirtyClipRegion = 128,
  DirtyCompositionMode = 1024, DirtyFont = 8, DirtyHints = 512, DirtyOpacity = 4096,
  DirtyPen = 1, DirtyTransform = 64
}
  More...
 
enum  PaintEngineFeature {
  AllFeatures = -1, AlphaBlend = 128, Antialiasing = 1024, BlendModes = 32768,
  BrushStroke = 2048, ConicalGradientFill = 64, ConstantOpacity = 4096, LinearGradientFill = 16,
  MaskedBrush = 8192, ObjectBoundingModeGradients = 65536, PaintOutsidePaintEvent = 536870912, PainterPaths = 512,
  PatternBrush = 8, PatternTransform = 2, PerspectiveTransform = 16384, PixmapTransform = 4,
  PorterDuff = 256, PrimitiveTransform = 1, RadialGradientFill = 32, RasterOpModes = 131072
}
  More...
 
enum  PolygonDrawMode { ConvexMode = 2, OddEvenMode = 0, PolylineMode = 3, WindingMode = 1 }
 
enum  Type {
  Blitter = 16, CoreGraphics = 3, Direct3D = 11, MacPrinter = 4,
  MaxUser = 100, OpenGL = 7, OpenGL2 = 14, OpenVG = 13,
  PaintBuffer = 15, Pdf = 12, Picture = 8, PostScript = 6,
  QWindowSystem = 5, QuickDraw = 2, Raster = 10, SVG = 9,
  User = 50, Windows = 1, X11 = 0
}
 

Public Member Functions

 QPaintEngine (QPaintEngine.PaintEngineFeature features=0)
 
 
virtual void CreateProxy ()
 
abstract bool Begin (IQPaintDevice pdev)
 
 
new void ClearDirty (QPaintEngine.DirtyFlag df)
 
virtual QPoint CoordinateOffset ()
 
virtual void DrawEllipse (QRectF r)
 
 
virtual void DrawEllipse (QRect r)
 
 
virtual void DrawImage (QRectF r, QImage pm, QRectF sr, Qt.ImageConversionFlag flags=Qt.ImageConversionFlag.AutoColor)
 
 
virtual void DrawLines (QLine lines, int lineCount)
 
 
virtual void DrawLines (QLineF lines, int lineCount)
 
 
virtual void DrawPath (QPainterPath path)
 
 
abstract void DrawPixmap (QRectF r, QPixmap pm, QRectF sr)
 
 
virtual void DrawPoints (QPointF points, int pointCount)
 
 
virtual void DrawPoints (QPoint points, int pointCount)
 
 
virtual void DrawPolygon (QPointF points, int pointCount, QPaintEngine.PolygonDrawMode mode)
 
 
virtual void DrawPolygon (QPoint points, int pointCount, QPaintEngine.PolygonDrawMode mode)
 
 
virtual void DrawRects (QRect rects, int rectCount)
 
 
virtual void DrawRects (QRectF rects, int rectCount)
 
 
virtual void DrawTextItem (QPointF p, QTextItem textItem)
 
 
virtual void DrawTiledPixmap (QRectF r, QPixmap pixmap, QPointF s)
 
 
abstract bool End ()
 
 
new void Fix_neg_rect (ref int x, ref int y, ref int w, ref int h)
 
virtual System.IntPtr GetDC ()
 
new bool HasFeature (QPaintEngine.PaintEngineFeature feature)
 
 
new bool IsActive ()
 
 
new bool IsExtended ()
 
new QPainter Painter ()
 
 
virtual void ReleaseDC (System.IntPtr hdc)
 
new void SetActive (bool newState)
 
 
new void SetDirty (QPaintEngine.DirtyFlag df)
 
new void SyncState ()
 
new bool TestDirty (QPaintEngine.DirtyFlag df)
 
abstract QPaintEngine.Type type ()
 
 
abstract void UpdateState (QPaintEngineState state)
 
 
new void Dispose ()
 

Protected Member Functions

 QPaintEngine (System.Type dummy)
 

Protected Attributes

SmokeInvocation interceptor
 

Properties

new IQPaintDevice PaintDevice [get, set]
 
 
new QRegion SystemClip [get, set]
 
new QRect SystemRect [get, set]
 
virtual System.IntPtr SmokeObject [get, set]
 
new uint Active [get, set]
 
new uint Extended [get, set]
 
new QPaintEngine.PaintEngineFeature Gccaps [get, set]
 
new uint SelfDestruct [get, set]
 
new QPaintEngineState State [get, set]
 

Detailed Description

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

Qt 4.0 provides several premade implementations of 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 QPaintEngine implementations for OpenGL (accessible through 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 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.

The big advantage of the QPaintEngine approach opposed to Qt 3's 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.

See also QPainter, QPaintDevice::paintEngine(), and Paint System.

Member Enumeration Documentation

These types are used by QPainter to trigger lazy updates of the various states in the QPaintEngine using QPaintEngine::updateState().

A paint engine must update every dirty state.

Enumerator:
AllDirty 

Convenience enum used internally.

DirtyBackground 

The background is dirty and needs to be updated.

DirtyBackgroundMode 

The background mode is dirty and needs to be updated.

DirtyBrush 

The brush is dirty and needs to be updated.

DirtyBrushOrigin 

The brush origin is dirty and needs to updated.

DirtyClipEnabled 

Whether clipping is enabled or not is dirty and needs to be updated.

DirtyClipPath 

The clip path is dirty and needs to be updated.

DirtyClipRegion 

The clip region is dirty and needs to be updated.

DirtyCompositionMode 

The composition mode is dirty and needs to be updated.

DirtyFont 

The font is dirty and needs to be updated.

DirtyHints 

The render hints is dirty and needs to be updated.

DirtyOpacity 

The constant opacity has changed and needs to be updated as part of the state change in QPaintEngine::updateState().

DirtyPen 

The pen is dirty and needs to be updated.

DirtyTransform 

The transform is dirty and needs to be updated.

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

Enumerator:
AllFeatures 

All of the above features. This enum value is usually used as a bit mask.

AlphaBlend 

The engine can alpha blend primitives.

Antialiasing 

The engine can use antialising to improve the appearance of rendered primitives.

BlendModes 

The engine supports blending modes.

BrushStroke 

The engine supports drawing strokes that contain brushes as fills, not just solid colors (e.g. a dashed gradient line of width 2).

ConicalGradientFill 

The engine supports conical gradient fills.

ConstantOpacity 

The engine supports the feature provided by QPainter::setOpacity().

LinearGradientFill 

The engine supports linear gradient fills.

MaskedBrush 

The engine is capable of rendering brushes that has a texture with an alpha channel or a mask.

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.

PaintOutsidePaintEvent 

The engine is capable of painting outside of paint events.

PainterPaths 

The engine has path support.

PatternBrush 

The engine is capable of rendering brushes with the brush patterns specified in Qt::BrushStyle.

PatternTransform 

The engine has support for transforming brush patterns.

PerspectiveTransform 

The engine has support for performing perspective transformations on primitives.

PixmapTransform 

The engine can transform pixmaps, including rotation and shearing.

PorterDuff 

The engine supports Porter-Duff operations

PrimitiveTransform 

The engine has support for transforming drawing primitives.

RadialGradientFill 

The engine supports radial gradient fills.

RasterOpModes 

The engine supports bitwise raster operations.

Enumerator:
ConvexMode 

The polygon is a convex polygon and can be drawn using specialized algorithms where available.

OddEvenMode 

The polygon should be drawn using OddEven fill rule.

PolylineMode 

Only the outline of the polygon should be drawn.

WindingMode 

The polygon should be drawn using Winding fill rule.

Enumerator:
Blitter 
CoreGraphics 

Mac OS X's Quartz2D (CoreGraphics)

Direct3D 

Windows only, Direct3D based engine

MacPrinter 
MaxUser 

Last user type ID

OpenGL 
OpenGL2 
OpenVG 
PaintBuffer 
Pdf 

Portable Document Format

Picture 

QPicture format

PostScript 
QWindowSystem 

Qt for Embedded Linux

QuickDraw 

Mac OS X's QuickDraw

Raster 
SVG 

Scalable Vector Graphics XML format

User 

First user type ID

Windows 
X11 

Constructor & Destructor Documentation

QtGui.QPaintEngine.QPaintEngine ( System.Type  dummy)
protected
QtGui.QPaintEngine.QPaintEngine ( QPaintEngine.PaintEngineFeature  features = 0)

Creates a paint engine with the featureset specified by caps.

Member Function Documentation

abstract bool QtGui.QPaintEngine.Begin ( IQPaintDevice  pdev)
pure virtual

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

new void QtGui.QPaintEngine.ClearDirty ( QPaintEngine.DirtyFlag  df)
virtual QPoint QtGui.QPaintEngine.CoordinateOffset ( )
virtual
virtual void QtGui.QPaintEngine.CreateProxy ( )
virtual
new void QtGui.QPaintEngine.Dispose ( )
virtual void QtGui.QPaintEngine.DrawEllipse ( QRectF  r)
virtual

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

The default implementation calls drawPolygon().

virtual void QtGui.QPaintEngine.DrawEllipse ( QRect  r)
virtual

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

virtual void QtGui.QPaintEngine.DrawImage ( QRectF  r,
QImage  pm,
QRectF  sr,
Qt.ImageConversionFlag  flags = Qt.ImageConversionFlag.AutoColor 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawLines ( QLine  lines,
int  lineCount 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawLines ( QLineF  lines,
int  lineCount 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawPath ( QPainterPath  path)
virtual

The default implementation ignores the path and does nothing.

abstract void QtGui.QPaintEngine.DrawPixmap ( QRectF  r,
QPixmap  pm,
QRectF  sr 
)
pure virtual

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

virtual void QtGui.QPaintEngine.DrawPoints ( QPointF  points,
int  pointCount 
)
virtual

Draws the first pointCount points in the buffer points

virtual void QtGui.QPaintEngine.DrawPoints ( QPoint  points,
int  pointCount 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawPolygon ( QPointF  points,
int  pointCount,
QPaintEngine.PolygonDrawMode  mode 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawPolygon ( QPoint  points,
int  pointCount,
QPaintEngine.PolygonDrawMode  mode 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawRects ( QRect  rects,
int  rectCount 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawRects ( QRectF  rects,
int  rectCount 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawTextItem ( QPointF  p,
QTextItem  textItem 
)
virtual

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.

virtual void QtGui.QPaintEngine.DrawTiledPixmap ( QRectF  r,
QPixmap  pixmap,
QPointF  s 
)
virtual

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.

abstract bool QtGui.QPaintEngine.End ( )
pure virtual

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

new void QtGui.QPaintEngine.Fix_neg_rect ( ref int  x,
ref int  y,
ref int  w,
ref int  h 
)
virtual System.IntPtr QtGui.QPaintEngine.GetDC ( )
virtual
new bool QtGui.QPaintEngine.HasFeature ( QPaintEngine.PaintEngineFeature  feature)

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

new bool QtGui.QPaintEngine.IsActive ( )

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

See also setActive().

new bool QtGui.QPaintEngine.IsExtended ( )
new QPainter QtGui.QPaintEngine.Painter ( )

Returns the paint engine's painter.

virtual void QtGui.QPaintEngine.ReleaseDC ( System.IntPtr  hdc)
virtual
new void QtGui.QPaintEngine.SetActive ( bool  newState)

Sets the active state of the paint engine to state.

See also isActive().

new void QtGui.QPaintEngine.SetDirty ( QPaintEngine.DirtyFlag  df)
new void QtGui.QPaintEngine.SyncState ( )
new bool QtGui.QPaintEngine.TestDirty ( QPaintEngine.DirtyFlag  df)
abstract QPaintEngine.Type QtGui.QPaintEngine.type ( )
pure virtual

Reimplement this function to return the paint engine Type.

abstract void QtGui.QPaintEngine.UpdateState ( QPaintEngineState  state)
pure virtual

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.

Member Data Documentation

SmokeInvocation QtGui.QPaintEngine.interceptor
protected

Property Documentation

new uint QtGui.QPaintEngine.Active
getsetprotected
new uint QtGui.QPaintEngine.Extended
getsetprotected
new QPaintEngine.PaintEngineFeature QtGui.QPaintEngine.Gccaps
getsetprotected
new IQPaintDevice QtGui.QPaintEngine.PaintDevice
getset

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

new uint QtGui.QPaintEngine.SelfDestruct
getsetprotected
virtual System.IntPtr QtGui.QPaintEngine.SmokeObject
getset
new QPaintEngineState QtGui.QPaintEngine.State
getsetprotected
new QRegion QtGui.QPaintEngine.SystemClip
getset
new QRect QtGui.QPaintEngine.SystemRect
getset