krita
KisPainter Class Reference
#include <kis_painter.h>
Inheritance diagram for KisPainter:

Detailed Description
KisPainter contains the graphics primitives necessary to draw on a KisPaintDevice.This is the same kind of abstraction as used in Qt itself, where you have QPainter and QPaintDevice.
However, KisPainter works on a tiled image and supports different colour models, and that's a lot more complicated.
KisPainter supports transactions that can group various paint operations in one undoable step.
For more complex operations, you might want to have a look at the subclasses of KisPainter: KisConvolutionPainter, KisFillPainter and KisGradientPainter
Definition at line 56 of file kis_painter.h.
Public Types | |
enum | FillStyle { FillStyleNone, FillStyleForegroundColor, FillStyleBackgroundColor, FillStylePattern, FillStyleGradient, FillStyleStrokes } |
enum | StrokeStyle { StrokeStyleNone, StrokeStyleBrush } |
Public Member Functions | |
KisPainter () | |
KisPainter (KisPaintDeviceSP device) | |
virtual | ~KisPainter () |
void | begin (KisPaintDeviceSP device) |
KCommand * | end () |
void | beginTransaction (const QString &customName=QString::null) |
KCommand * | endTransaction () |
void | beginTransaction (KisTransaction *command) |
KisTransaction * | transaction () |
KisPaintDeviceSP | device () const |
void | bitBlt (Q_INT32 dx, Q_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, Q_INT32 sx, Q_INT32 sy, Q_INT32 sw, Q_INT32 sh) |
void | bitBlt (Q_INT32 dx, Q_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, Q_UINT8 opacity, Q_INT32 sx, Q_INT32 sy, Q_INT32 sw, Q_INT32 sh) |
void | bltSelection (Q_INT32 dx, Q_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, KisSelectionSP selMask, Q_UINT8 opacity, Q_INT32 sx, Q_INT32 sy, Q_INT32 sw, Q_INT32 sh) |
void | bltSelection (Q_INT32 dx, Q_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, Q_UINT8 opacity, Q_INT32 sx, Q_INT32 sy, Q_INT32 sw, Q_INT32 sh) |
QRect | dirtyRect () |
QRect | addDirtyRect (QRect r) |
void | paintPolyline (const QValueVector< KisPoint > &points, int index=0, int numPoints=-1) |
double | paintLine (const KisPoint &pos1, const double pressure1, const double xTilt1, const double yTilt1, const KisPoint &pos2, const double pressure2, const double xTilt2, const double yTilt2, const double savedDist=-1) |
double | paintBezierCurve (const KisPoint &pos1, const double pressure1, const double xTilt1, const double yTilt1, const KisPoint &control1, const KisPoint &control2, const KisPoint &pos2, const double pressure2, const double xTilt2, const double yTilt2, const double savedDist=-1) |
void | getBezierCurvePoints (const KisPoint &pos1, const KisPoint &control1, const KisPoint &control2, const KisPoint &pos2, vKisPoint &points) |
void | paintRect (const KisPoint &startPoint, const KisPoint &endPoint, const double pressure, const double xTilt, const double yTilt) |
void | paintEllipse (const KisPoint &startPoint, const KisPoint &endPoint, const double pressure, const double, const double) |
void | paintPolygon (const vKisPoint &points) |
void | paintAt (const KisPoint &pos, const double pressure, const double, const double) |
void | setBrush (KisBrush *brush) |
KisBrush * | brush () const |
void | setPattern (KisPattern *pattern) |
KisPattern * | pattern () const |
void | setPaintColor (const KisColor &color) |
KisColor | paintColor () const |
void | setBackgroundColor (const KisColor &color) |
KisColor | backgroundColor () const |
void | setFillColor (const KisColor &color) |
KisColor | fillColor () const |
void | setFillStyle (FillStyle fillStyle) |
FillStyle | fillStyle () const |
void | setStrokeStyle (StrokeStyle strokeStyle) |
StrokeStyle | strokeStyle () const |
void | setOpacity (Q_UINT8 opacity) |
Q_UINT8 | opacity () const |
void | setCompositeOp (const KisCompositeOp &op) |
KisCompositeOp | compositeOp () const |
void | setFilter (KisFilterSP filter) |
KisFilterSP | filter () |
void | setDuplicateOffset (const KisPoint &offset) |
KisPoint | duplicateOffset () |
void | setPressure (double pressure) |
double | pressure () |
void | setPaintOp (KisPaintOp *paintOp) |
KisPaintOp * | paintOp () const |
void | setDab (KisPaintDeviceSP dab) |
KisPaintDeviceSP | dab () const |
bool | cancelRequested () const |
Protected Member Functions | |
void | init () |
KisPainter (const KisPainter &) | |
KisPainter & | operator= (const KisPainter &) |
void | fillPolygon (const vKisPoint &points, FillStyle fillStyle) |
Static Protected Member Functions | |
static double | pointToLineDistance (const KisPoint &p, const KisPoint &l0, const KisPoint &l1) |
Protected Attributes | |
KisPaintDeviceSP | m_device |
KisTransaction * | m_transaction |
QRect | m_dirtyRect |
KisColor | m_paintColor |
KisColor | m_backgroundColor |
KisColor | m_fillColor |
FillStyle | m_fillStyle |
StrokeStyle | m_strokeStyle |
KisBrush * | m_brush |
KisPattern * | m_pattern |
KisPoint | m_duplicateOffset |
Q_UINT8 | m_opacity |
KisCompositeOp | m_compositeOp |
KisFilterSP | m_filter |
KisPaintOp * | m_paintOp |
double | m_pressure |
bool | m_cancelRequested |
Q_INT32 | m_pixelSize |
KisColorSpace * | m_colorSpace |
KisProfile * | m_profile |
KisPaintDeviceSP | m_dab |
Member Enumeration Documentation
|
This enum contains the styles with which we can fill things like polygons and ellipses.
Definition at line 283 of file kis_painter.h. |
|
The style of the brush stroke around polygons and so.
Definition at line 298 of file kis_painter.h. |
Constructor & Destructor Documentation
|
Construct painter without a device.
Definition at line 69 of file kis_painter.cc. |
|
Construct a painter, and begin painting on the device.
Definition at line 74 of file kis_painter.cc. |
Member Function Documentation
|
Add the r to the current dirty rect, and return the dirtyRect after adding r to it.
Definition at line 163 of file kis_painter.h. |
|
Returns the current background color.
Definition at line 274 of file kis_painter.h. |
|
Start painting on the specified device. Not undoable. Definition at line 103 of file kis_painter.cc. |
|
begin a transaction with the given command
Definition at line 128 of file kis_painter.cc. |
|
Begin an undoable paint operation.
Definition at line 120 of file kis_painter.cc. |
|
Overloaded version of the previous, differs in that it is possible to specify a value for opacity.
Definition at line 150 of file kis_painter.cc. |
|
Blast the specified region from src onto the current paint device.
Definition at line 105 of file kis_painter.h. |
|
A version of bitBlt that renders using the src device's selection mask, if it has one.
Definition at line 344 of file kis_painter.cc. |
|
A version of bitBlt that renders using an external selection mask, ignoring the src device's own selection, if it has one.
Definition at line 236 of file kis_painter.cc. |
|
Returns the currently set brush.
Definition at line 258 of file kis_painter.h. |
|
Is cancel Requested by the KisProgressSubject for this painter.
Definition at line 354 of file kis_painter.h. |
|
Returns the current composite operation.
Definition at line 319 of file kis_painter.h. |
|
Get the currently set dab.
Definition at line 351 of file kis_painter.h. |
|
Returns the current paint device.
Definition at line 95 of file kis_painter.h. |
|
The methods below are 'higher' level than the above methods. They need brushes, colors etc. set before they can be called. The methods do not directly tell the image to update, but you can call dirtyRect() to get the rect that needs to be notified by your painting code. Call will RESET the dirtyRect! Definition at line 144 of file kis_painter.cc. |
|
Returns the offset for duplication.
Definition at line 332 of file kis_painter.h. |
|
Finish painting on the current device.
Definition at line 115 of file kis_painter.cc. |
|
Finish the undoable paint operation.
Definition at line 136 of file kis_painter.cc. |
|
Returns the current fill color.
Definition at line 279 of file kis_painter.h. |
|
Fill the polygon defined by points with the fillStyle.
Definition at line 734 of file kis_painter.cc. |
|
Returns the current fill style.
Definition at line 295 of file kis_painter.h. |
|
Returns the current KisFilter.
Definition at line 324 of file kis_painter.h. |
|
Fill the given vector points with the points needed to draw the Bezier curve between pos1 and pos2 using control points 1 and 2, excluding the final pos2.
Definition at line 479 of file kis_painter.cc. |
|
Initialize, set everything to '0' or defaults.
Definition at line 81 of file kis_painter.cc. |
|
Returns the opacity that is used in painting.
Definition at line 311 of file kis_painter.h. |
|
Draw a spot at pos using the currently set paint op, brush and color.
Definition at line 627 of file kis_painter.cc. |
|
Draw a Bezier curve between pos1 and pos2 using control points 1 and 2. If savedDist is less than zero, the brush is painted at pos1 before being painted along the curve using the spacing setting.
Definition at line 512 of file kis_painter.cc. |
|
Returns the color that will be used to paint with.
Definition at line 269 of file kis_painter.h. |
|
Paint the ellipse with given begin and end points.
Definition at line 582 of file kis_painter.cc. |
|
Draw a line between pos1 and pos2 using the currently set brush and color. If savedDist is less than zero, the brush is painted at pos1 before being painted along the line using the spacing setting.
Definition at line 359 of file kis_painter.cc. |
|
Returns the current paint operation.
Definition at line 346 of file kis_painter.h. |
|
Paint the polygon with the points given in points. It automatically closes the polygon by drawing the line from the last point to the first. Definition at line 874 of file kis_painter.cc. |
|
Paint a line that connects the dots in points.
|
|
Paint the rectangle with given begin and end points.
Definition at line 564 of file kis_painter.cc. |
|
Returns the currently set pattern.
Definition at line 263 of file kis_painter.h. |
|
Calculate the distance that point p is from the line made by connecting l0 and l1.
Definition at line 636 of file kis_painter.cc. |
|
Returns the current pressure.
Definition at line 337 of file kis_painter.h. |
|
Set the current background color.
Definition at line 272 of file kis_painter.h. |
|
Set the current brush.
Definition at line 256 of file kis_painter.h. |
|
Sets the current composite operation. Everything painted will be composited on the destination layer with this composite op. Definition at line 317 of file kis_painter.h. |
|
Set a current 'dab'. This usually is a paint device containing a rendered brush.
Definition at line 349 of file kis_painter.h. |
|
The offset for paint operations that use it (like KisDuplicateOp). It will use as source the part of the layer that is at its paintedPosition - duplicateOffset Definition at line 330 of file kis_painter.h. |
|
Set the current fill color.
Definition at line 277 of file kis_painter.h. |
|
Set the current style with which to fill.
Definition at line 293 of file kis_painter.h. |
|
Sets the current KisFilter, used by the paintops that support it (like KisFilterOp).
Definition at line 322 of file kis_painter.h. |
|
Set the opacity which is used in painting (like filling polygons).
Definition at line 309 of file kis_painter.h. |
|
Set the color that will be used to paint with.
Definition at line 266 of file kis_painter.h. |
|
Set the current paint operation. This is used for all drawing functions. The painter will DELETE the paint op itself!! That means no that you should not delete it yourself (or put it on the stack) Definition at line 344 of file kis_painter.h. |
|
Set the current pattern.
Definition at line 261 of file kis_painter.h. |
|
Sets the current pressure for things that like to use this.
Definition at line 335 of file kis_painter.h. |
|
Set the current brush stroke style.
Definition at line 304 of file kis_painter.h. |
|
Returns the current brush stroke style.
Definition at line 306 of file kis_painter.h. |
|
Return the current transcation.
Definition at line 91 of file kis_painter.h. |
The documentation for this class was generated from the following files: