#include <kis_painter.h>
Public Types | |
| enum | FillStyle { FillStyleNone , FillStyleForegroundColor , FillStyleBackgroundColor , FillStylePattern , FillStyleGradient , FillStyleStrokes } |
| enum | StrokeStyle { StrokeStyleNone , StrokeStyleBrush } |
Public Member Functions | |
| KisPainter () | |
| KisPainter (KisPaintDeviceSP device) | |
| void | begin (KisPaintDeviceSP device) |
| KCommand * | end () |
| void | beginTransaction (const TQString &customName=TQString()) |
| KCommand * | endTransaction () |
| void | beginTransaction (KisTransaction *command) |
| KisTransaction * | transaction () |
| KisPaintDeviceSP | device () const |
| void | bitBlt (TQ_INT32 dx, TQ_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 sw, TQ_INT32 sh) |
| void | bitBlt (TQ_INT32 dx, TQ_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, TQ_UINT8 opacity, TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 sw, TQ_INT32 sh) |
| void | bltMask (TQ_INT32 dx, TQ_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, KisPaintDeviceSP selMask, TQ_UINT8 opacity, TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 sw, TQ_INT32 sh) |
| void | bltSelection (TQ_INT32 dx, TQ_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, KisSelectionSP selMask, TQ_UINT8 opacity, TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 sw, TQ_INT32 sh) |
| void | bltSelection (TQ_INT32 dx, TQ_INT32 dy, const KisCompositeOp &op, KisPaintDeviceSP src, TQ_UINT8 opacity, TQ_INT32 sx, TQ_INT32 sy, TQ_INT32 sw, TQ_INT32 sh) |
| TQRect | dirtyRect () |
| TQRect | addDirtyRect (TQRect r) |
| void | paintPolyline (const TQValueVector< 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 | setVaryBrushSpacingWithPressureWhenDrawingALine (bool varyBrushSpacingWithPressureWhenDrawingALine) |
| bool | varyBrushSpacingWithPressureWhenDrawingALine () |
| 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 (TQ_UINT8 opacity) |
| TQ_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 | setDuplicateHealing (bool v) |
| bool | duplicateHealing () |
| void | setDuplicateHealingRadius (int r) |
| int | duplicateHealingRadius () |
| void | setDuplicatePerspectiveCorrection (bool v) |
| bool | duplicatePerspectiveCorrection () |
| void | setDuplicateStart (const KisPoint start) |
| KisPoint | duplicateStart () |
| 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 |
| TQRect | 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 |
| KisPoint | m_duplicateStart |
| bool | m_duplicateHealing |
| int | m_duplicateHealingRadius |
| bool | m_duplicatePerspectiveCorrection |
| TQ_UINT8 | m_opacity |
| KisCompositeOp | m_compositeOp |
| KisFilterSP | m_filter |
| KisPaintOp * | m_paintOp |
| double | m_pressure |
| bool | m_cancelRequested |
| TQ_INT32 | m_pixelSize |
| KisColorSpace * | m_colorSpace |
| KisProfile * | m_profile |
| KisPaintDeviceSP | m_dab |
| bool | m_varyBrushSpacingWithPressureWhenDrawingALine |
Detailed Description
KisPainter contains the graphics primitives necessary to draw on a KisPaintDevice.
This is the same kind of abstraction as used in TQt itself, where you have TQPainter and TQPaintDevice.
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.
Member Enumeration Documentation
◆ FillStyle
This enum contains the styles with which we can fill things like polygons and ellipses.
Definition at line 300 of file kis_painter.h.
◆ StrokeStyle
The style of the brush stroke around polygons and so.
Definition at line 315 of file kis_painter.h.
Constructor & Destructor Documentation
◆ KisPainter() [1/2]
| KisPainter::KisPainter | ( | ) |
Construct painter without a device.
Definition at line 69 of file kis_painter.cpp.
◆ KisPainter() [2/2]
| KisPainter::KisPainter | ( | KisPaintDeviceSP | device | ) |
Construct a painter, and begin painting on the device.
Definition at line 74 of file kis_painter.cpp.
◆ ~KisPainter()
|
virtual |
Definition at line 100 of file kis_painter.cpp.
Member Function Documentation
◆ addDirtyRect()
|
inline |
Add the r to the current dirty rect, and return the dirtyRect after adding r to it.
Definition at line 174 of file kis_painter.h.
◆ backgroundColor()
|
inline |
Returns the current background color.
Definition at line 291 of file kis_painter.h.
◆ begin()
| void KisPainter::begin | ( | KisPaintDeviceSP | device | ) |
Start painting on the specified device.
Not undoable.
Definition at line 107 of file kis_painter.cpp.
◆ beginTransaction() [1/2]
| void KisPainter::beginTransaction | ( | const TQString & | customName = TQString() | ) |
Begin an undoable paint operation.
Definition at line 124 of file kis_painter.cpp.
◆ beginTransaction() [2/2]
| void KisPainter::beginTransaction | ( | KisTransaction * | command | ) |
begin a transaction with the given command
Definition at line 132 of file kis_painter.cpp.
◆ bitBlt() [1/2]
|
inline |
Blast the specified region from src onto the current paint device.
Definition at line 105 of file kis_painter.h.
◆ bitBlt() [2/2]
| void KisPainter::bitBlt | ( | TQ_INT32 | dx, |
| TQ_INT32 | dy, | ||
| const KisCompositeOp & | op, | ||
| KisPaintDeviceSP | src, | ||
| TQ_UINT8 | opacity, | ||
| TQ_INT32 | sx, | ||
| TQ_INT32 | sy, | ||
| TQ_INT32 | sw, | ||
| TQ_INT32 | sh | ||
| ) |
Overloaded version of the previous, differs in that it is possible to specify a value for opacity.
Definition at line 154 of file kis_painter.cpp.
◆ bltMask()
| void KisPainter::bltMask | ( | TQ_INT32 | dx, |
| TQ_INT32 | dy, | ||
| const KisCompositeOp & | op, | ||
| KisPaintDeviceSP | src, | ||
| KisPaintDeviceSP | selMask, | ||
| TQ_UINT8 | opacity, | ||
| TQ_INT32 | sx, | ||
| TQ_INT32 | sy, | ||
| TQ_INT32 | sw, | ||
| TQ_INT32 | sh | ||
| ) |
A version of bitBlt that renders using an external mask, ignoring the src device's own selection, if it has one.
Definition at line 267 of file kis_painter.cpp.
◆ bltSelection() [1/2]
| void KisPainter::bltSelection | ( | TQ_INT32 | dx, |
| TQ_INT32 | dy, | ||
| const KisCompositeOp & | op, | ||
| KisPaintDeviceSP | src, | ||
| KisSelectionSP | selMask, | ||
| TQ_UINT8 | opacity, | ||
| TQ_INT32 | sx, | ||
| TQ_INT32 | sy, | ||
| TQ_INT32 | sw, | ||
| TQ_INT32 | sh | ||
| ) |
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 244 of file kis_painter.cpp.
◆ bltSelection() [2/2]
| void KisPainter::bltSelection | ( | TQ_INT32 | dx, |
| TQ_INT32 | dy, | ||
| const KisCompositeOp & | op, | ||
| KisPaintDeviceSP | src, | ||
| TQ_UINT8 | opacity, | ||
| TQ_INT32 | sx, | ||
| TQ_INT32 | sy, | ||
| TQ_INT32 | sw, | ||
| TQ_INT32 | sh | ||
| ) |
A version of bitBlt that renders using the src device's selection mask, if it has one.
Definition at line 371 of file kis_painter.cpp.
◆ brush()
|
inline |
Returns the currently set brush.
Definition at line 275 of file kis_painter.h.
◆ cancelRequested()
|
inline |
Is cancel Requested by the KisProgressSubject for this painter.
Definition at line 384 of file kis_painter.h.
◆ compositeOp()
|
inline |
Returns the current composite operation.
Definition at line 336 of file kis_painter.h.
◆ dab()
|
inline |
Get the currently set dab.
Definition at line 381 of file kis_painter.h.
◆ device()
|
inline |
Returns the current paint device.
Definition at line 95 of file kis_painter.h.
◆ dirtyRect()
| TQRect KisPainter::dirtyRect | ( | ) |
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 148 of file kis_painter.cpp.
◆ duplicateHealing()
|
inline |
Definition at line 353 of file kis_painter.h.
◆ duplicateHealingRadius()
|
inline |
Definition at line 356 of file kis_painter.h.
◆ duplicateOffset()
|
inline |
Returns the offset for duplication.
Definition at line 350 of file kis_painter.h.
◆ duplicatePerspectiveCorrection()
|
inline |
Definition at line 359 of file kis_painter.h.
◆ duplicateStart()
|
inline |
Definition at line 362 of file kis_painter.h.
◆ end()
| KCommand * KisPainter::end | ( | ) |
Finish painting on the current device.
Definition at line 119 of file kis_painter.cpp.
◆ endTransaction()
| KCommand * KisPainter::endTransaction | ( | ) |
Finish the undoable paint operation.
Definition at line 140 of file kis_painter.cpp.
◆ fillColor()
|
inline |
Returns the current fill color.
Definition at line 296 of file kis_painter.h.
◆ fillPolygon()
|
protected |
Fill the polygon defined by points with the fillStyle.
Definition at line 771 of file kis_painter.cpp.
◆ fillStyle()
|
inline |
Returns the current fill style.
Definition at line 312 of file kis_painter.h.
◆ filter()
|
inline |
Returns the current KisFilter.
Definition at line 341 of file kis_painter.h.
◆ getBezierCurvePoints()
| void KisPainter::getBezierCurvePoints | ( | const KisPoint & | pos1, |
| const KisPoint & | control1, | ||
| const KisPoint & | control2, | ||
| const KisPoint & | pos2, | ||
| vKisPoint & | points | ||
| ) |
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 516 of file kis_painter.cpp.
◆ init()
|
protected |
Initialize, set everything to '0' or defaults.
Definition at line 81 of file kis_painter.cpp.
◆ opacity()
|
inline |
Returns the opacity that is used in painting.
Definition at line 328 of file kis_painter.h.
◆ paintAt()
| void KisPainter::paintAt | ( | const KisPoint & | pos, |
| const double | pressure, | ||
| const double | xTilt, | ||
| const double | yTilt | ||
| ) |
Draw a spot at pos using the currently set paint op, brush and color.
Definition at line 664 of file kis_painter.cpp.
◆ paintBezierCurve()
| double KisPainter::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 |
||
| ) |
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.
- Returns
- the drag distance, that is the remains of the distance between p1 and p2 not covered because the currenlty set brush has a spacing greater than that distance.
Definition at line 549 of file kis_painter.cpp.
◆ paintColor()
|
inline |
Returns the color that will be used to paint with.
Definition at line 286 of file kis_painter.h.
◆ paintEllipse()
| void KisPainter::paintEllipse | ( | const KisPoint & | startPoint, |
| const KisPoint & | endPoint, | ||
| const double | pressure, | ||
| const double | , | ||
| const double | |||
| ) |
Paint the ellipse with given begin and end points.
Definition at line 619 of file kis_painter.cpp.
◆ paintLine()
| double KisPainter::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 |
||
| ) |
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.
- Returns
- the drag distance, that is the remains of the distance between p1 and p2 not covered because the currenlty set brush has a spacing greater than that distance.
Definition at line 386 of file kis_painter.cpp.
◆ paintOp()
|
inline |
Returns the current paint operation.
Definition at line 376 of file kis_painter.h.
◆ paintPolygon()
| void KisPainter::paintPolygon | ( | const vKisPoint & | points | ) |
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 911 of file kis_painter.cpp.
◆ paintPolyline()
| void KisPainter::paintPolyline | ( | const TQValueVector< KisPoint > & | points, |
| int | index = 0, |
||
| int | numPoints = -1 |
||
| ) |
Paint a line that connects the dots in points.
Definition at line 496 of file kis_painter.cpp.
◆ paintRect()
| void KisPainter::paintRect | ( | const KisPoint & | startPoint, |
| const KisPoint & | endPoint, | ||
| const double | pressure, | ||
| const double | xTilt, | ||
| const double | yTilt | ||
| ) |
Paint the rectangle with given begin and end points.
Definition at line 601 of file kis_painter.cpp.
◆ pattern()
|
inline |
Returns the currently set pattern.
Definition at line 280 of file kis_painter.h.
◆ pointToLineDistance()
|
staticprotected |
Calculate the distance that point p is from the line made by connecting l0 and l1.
Definition at line 673 of file kis_painter.cpp.
◆ pressure()
|
inline |
Returns the current pressure.
Definition at line 367 of file kis_painter.h.
◆ setBackgroundColor()
|
inline |
Set the current background color.
Definition at line 289 of file kis_painter.h.
◆ setBrush()
|
inline |
Set the current brush.
Definition at line 273 of file kis_painter.h.
◆ setCompositeOp()
|
inline |
Sets the current composite operation.
Everything painted will be composited on the destination layer with this composite op.
Definition at line 334 of file kis_painter.h.
◆ setDab()
|
inline |
Set a current 'dab'. This usually is a paint device containing a rendered brush.
Definition at line 379 of file kis_painter.h.
◆ setDuplicateHealing()
|
inline |
Definition at line 352 of file kis_painter.h.
◆ setDuplicateHealingRadius()
|
inline |
Definition at line 355 of file kis_painter.h.
◆ setDuplicateOffset()
|
inline |
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 348 of file kis_painter.h.
◆ setDuplicatePerspectiveCorrection()
|
inline |
Definition at line 358 of file kis_painter.h.
◆ setDuplicateStart()
|
inline |
Definition at line 361 of file kis_painter.h.
◆ setFillColor()
|
inline |
Set the current fill color.
Definition at line 294 of file kis_painter.h.
◆ setFillStyle()
|
inline |
Set the current style with which to fill.
Definition at line 310 of file kis_painter.h.
◆ setFilter()
|
inline |
Sets the current KisFilter, used by the paintops that support it (like KisFilterOp)
Definition at line 339 of file kis_painter.h.
◆ setOpacity()
|
inline |
Set the opacity which is used in painting (like filling polygons)
Definition at line 326 of file kis_painter.h.
◆ setPaintColor()
|
inline |
Set the color that will be used to paint with.
Definition at line 283 of file kis_painter.h.
◆ setPaintOp()
|
inline |
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 374 of file kis_painter.h.
◆ setPattern()
|
inline |
Set the current pattern.
Definition at line 278 of file kis_painter.h.
◆ setPressure()
|
inline |
Sets the current pressure for things that like to use this.
Definition at line 365 of file kis_painter.h.
◆ setStrokeStyle()
|
inline |
Set the current brush stroke style.
Definition at line 321 of file kis_painter.h.
◆ setVaryBrushSpacingWithPressureWhenDrawingALine()
|
inline |
Determines whether the brush spacing should vary when drawing lines with the pressure.
Definition at line 268 of file kis_painter.h.
◆ strokeStyle()
|
inline |
Returns the current brush stroke style.
Definition at line 323 of file kis_painter.h.
◆ transaction()
|
inline |
Return the current transcation.
Definition at line 91 of file kis_painter.h.
◆ varyBrushSpacingWithPressureWhenDrawingALine()
|
inline |
Definition at line 270 of file kis_painter.h.
Member Data Documentation
◆ m_backgroundColor
|
protected |
Definition at line 405 of file kis_painter.h.
◆ m_brush
|
protected |
Definition at line 409 of file kis_painter.h.
◆ m_cancelRequested
|
protected |
Definition at line 421 of file kis_painter.h.
◆ m_colorSpace
|
protected |
Definition at line 423 of file kis_painter.h.
◆ m_compositeOp
|
protected |
Definition at line 417 of file kis_painter.h.
◆ m_dab
|
protected |
Definition at line 425 of file kis_painter.h.
◆ m_device
|
protected |
Definition at line 399 of file kis_painter.h.
◆ m_dirtyRect
|
protected |
Definition at line 402 of file kis_painter.h.
◆ m_duplicateHealing
|
protected |
Definition at line 413 of file kis_painter.h.
◆ m_duplicateHealingRadius
|
protected |
Definition at line 414 of file kis_painter.h.
◆ m_duplicateOffset
|
protected |
Definition at line 411 of file kis_painter.h.
◆ m_duplicatePerspectiveCorrection
|
protected |
Definition at line 415 of file kis_painter.h.
◆ m_duplicateStart
|
protected |
Definition at line 412 of file kis_painter.h.
◆ m_fillColor
|
protected |
Definition at line 406 of file kis_painter.h.
◆ m_fillStyle
|
protected |
Definition at line 407 of file kis_painter.h.
◆ m_filter
|
protected |
Definition at line 418 of file kis_painter.h.
◆ m_opacity
|
protected |
Definition at line 416 of file kis_painter.h.
◆ m_paintColor
|
protected |
Definition at line 404 of file kis_painter.h.
◆ m_paintOp
|
protected |
Definition at line 419 of file kis_painter.h.
◆ m_pattern
|
protected |
Definition at line 410 of file kis_painter.h.
◆ m_pixelSize
|
protected |
Definition at line 422 of file kis_painter.h.
◆ m_pressure
|
protected |
Definition at line 420 of file kis_painter.h.
◆ m_profile
|
protected |
Definition at line 424 of file kis_painter.h.
◆ m_strokeStyle
|
protected |
Definition at line 408 of file kis_painter.h.
◆ m_transaction
|
protected |
Definition at line 400 of file kis_painter.h.
◆ m_varyBrushSpacingWithPressureWhenDrawingALine
|
protected |
Definition at line 426 of file kis_painter.h.
The documentation for this class was generated from the following files:
