26#include "kis_global.h"
28#include "kis_paint_device.h"
30#include "kis_filter.h"
31#include "kis_progress_subject.h"
32#include "kis_paintop.h"
35#include <koffice_export.h>
56class KRITACORE_EXPORT KisPainter : public KisProgressSubject {
57 typedef KisProgressSubject super;
68 virtual void cancel() { m_cancelRequested = true; }
74 void begin(KisPaintDeviceSP device);
82 void beginTransaction( const TQString& customName = TQString());
85 KCommand *endTransaction();
88 void beginTransaction( KisTransaction* command);
95 KisPaintDeviceSP device() const { return m_device; }
106 const KisCompositeOp& op,
107 KisPaintDeviceSP src,
108 TQ_INT32 sx, TQ_INT32 sy,
109 TQ_INT32 sw, TQ_INT32 sh)
111 bitBlt(dx, dy, op, src, OPACITY_OPAQUE, sx, sy, sw, sh);
118 void bitBlt(TQ_INT32 dx, TQ_INT32 dy,
119 const KisCompositeOp& op,
120 KisPaintDeviceSP src,
122 TQ_INT32 sx, TQ_INT32 sy,
123 TQ_INT32 sw, TQ_INT32 sh);
129 void bltMask(TQ_INT32 dx, TQ_INT32 dy,
130 const KisCompositeOp &op,
131 KisPaintDeviceSP src,
132 KisPaintDeviceSP selMask,
134 TQ_INT32 sx, TQ_INT32 sy,
135 TQ_INT32 sw, TQ_INT32 sh);
141 void bltSelection(TQ_INT32 dx, TQ_INT32 dy,
142 const KisCompositeOp &op,
143 KisPaintDeviceSP src,
144 KisSelectionSP selMask,
146 TQ_INT32 sx, TQ_INT32 sy,
147 TQ_INT32 sw, TQ_INT32 sh);
153 void bltSelection(TQ_INT32 dx, TQ_INT32 dy,
154 const KisCompositeOp &op,
155 KisPaintDeviceSP src,
157 TQ_INT32 sx, TQ_INT32 sy,
158 TQ_INT32 sw, TQ_INT32 sh);
174 TQRect addDirtyRect(TQRect r) { m_dirtyRect |= r; return m_dirtyRect; }
181 void paintPolyline( const TQValueVector <KisPoint> &points,
182 int index = 0, int numPoints = -1);
191 double paintLine( const KisPoint &pos1,
192 const double pressure1,
196 const double pressure2,
199 const double savedDist = -1);
208 double paintBezierCurve( const KisPoint &pos1,
209 const double pressure1,
215 const double pressure2,
218 const double savedDist = -1);
224 void getBezierCurvePoints( const KisPoint &pos1,
234 void paintRect( const KisPoint &startPoint,
236 const double pressure,
244 void paintEllipse( const KisPoint &startPoint,
246 const double pressure,
254 void paintPolygon( const vKisPoint& points);
258 const double pressure,
269 { m_varyBrushSpacingWithPressureWhenDrawingALine = varyBrushSpacingWithPressureWhenDrawingALine; }
270 bool varyBrushSpacingWithPressureWhenDrawingALine() { return m_varyBrushSpacingWithPressureWhenDrawingALine; }
273 void setBrush(KisBrush* brush) { m_brush = brush; }
275 KisBrush * brush() const { return m_brush; }
278 void setPattern(KisPattern * pattern) { m_pattern = pattern; }
280 KisPattern * pattern() const { return m_pattern; }
302 FillStyleForegroundColor,
303 FillStyleBackgroundColor,
328 TQ_UINT8 opacity() const { return m_opacity; }
339 void setFilter(KisFilterSP filter) { m_filter = filter; }
341 KisFilterSP filter() { return m_filter; }
352 inline void setDuplicateHealing( bool v) { m_duplicateHealing = v; }
353 inline bool duplicateHealing() { return m_duplicateHealing; }
355 inline void setDuplicateHealingRadius( int r) { m_duplicateHealingRadius = r; }
356 inline int duplicateHealingRadius() { return m_duplicateHealingRadius; }
358 inline void setDuplicatePerspectiveCorrection( bool v) { m_duplicatePerspectiveCorrection = v; }
359 inline bool duplicatePerspectiveCorrection() { return m_duplicatePerspectiveCorrection; }
361 void setDuplicateStart( const KisPoint start) { m_duplicateStart = start;}
362 KisPoint duplicateStart() { return m_duplicateStart;}
374 void setPaintOp(KisPaintOp * paintOp) { delete m_paintOp; m_paintOp = paintOp; }
376 KisPaintOp * paintOp() const { return m_paintOp; }
379 void setDab(KisPaintDeviceSP dab) { m_dab = dab; }
381 KisPaintDeviceSP dab() const { return m_dab; }
396 void fillPolygon( const vKisPoint& points, FillStyle fillStyle);
399 KisPaintDeviceSP m_device;
400 KisTransaction *m_transaction;
407 FillStyle m_fillStyle;
408 StrokeStyle m_strokeStyle;
410 KisPattern *m_pattern;
413 bool m_duplicateHealing;
414 int m_duplicateHealingRadius;
415 bool m_duplicatePerspectiveCorrection;
417 KisCompositeOp m_compositeOp;
418 KisFilterSP m_filter;
419 KisPaintOp * m_paintOp;
421 bool m_cancelRequested;
422 TQ_INT32 m_pixelSize;
424 KisProfile * m_profile;
425 KisPaintDeviceSP m_dab;
426 bool m_varyBrushSpacingWithPressureWhenDrawingALine;
A colorspace is the definition of a certain color model in Chalk.
A KisColor describes a color in a certain colorspace.
KisPainter contains the graphics primitives necessary to draw on a KisPaintDevice.
TQRect addDirtyRect(TQRect r) Add the r to the current dirty rect, and return the dirtyRect after adding r to it.
FillStyle This enum contains the styles with which we can fill things like polygons and ellipses.
KisPaintDeviceSP dab() const Get the currently set dab.
KisColor paintColor() const Returns the color that will be used to paint with.
StrokeStyle strokeStyle() const Returns the current brush stroke style.
void setFillColor(const KisColor &color) Set the current fill color.
void setPressure(double pressure) Sets the current pressure for things that like to use this.
KisColor backgroundColor() const Returns the current background color.
KisPattern * pattern() const Returns the currently set pattern.
void setBackgroundColor(const KisColor &color) Set the current background color.
void setPaintColor(const KisColor &color) Set the color that will be used to paint with.
void setCompositeOp(const KisCompositeOp &op) Sets the current composite operation.
void setStrokeStyle(StrokeStyle strokeStyle) Set the current brush stroke style.
KisTransaction * transaction() Return the current transcation.
KisCompositeOp compositeOp() const Returns the current composite operation.
KisPaintDeviceSP device() const Returns the current paint device.
KisPaintOp * paintOp() const Returns the current paint operation.
bool cancelRequested() const Is cancel Requested by the KisProgressSubject for this painter.
void setDab(KisPaintDeviceSP dab) Set a current 'dab'. This usually is a paint device containing a rendered brush.
TQ_UINT8 opacity() const Returns the opacity that is used in painting.
void setVaryBrushSpacingWithPressureWhenDrawingALine(bool varyBrushSpacingWithPressureWhenDrawingALine) Determines whether the brush spacing should vary when drawing lines with the pressure.
FillStyle fillStyle() const Returns the current fill style.
double pressure() Returns the current pressure.
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) Blast the specified region from src onto the current paint device.
StrokeStyle The style of the brush stroke around polygons and so.
void setFilter(KisFilterSP filter) Sets the current KisFilter, used by the paintops that support it (like KisFilterOp)
KisColor fillColor() const Returns the current fill color.
KisFilterSP filter() Returns the current KisFilter.
void setOpacity(TQ_UINT8 opacity) Set the opacity which is used in painting (like filling polygons)
void setFillStyle(FillStyle fillStyle) Set the current style with which to fill.
KisPoint duplicateOffset() Returns the offset for duplication.
KisBrush * brush() const Returns the currently set brush.
void setPattern(KisPattern *pattern) Set the current pattern.
void setDuplicateOffset(const KisPoint &offset) The offset for paint operations that use it (like KisDuplicateOp).
void setPaintOp(KisPaintOp *paintOp) Set the current paint operation.
void setBrush(KisBrush *brush) Set the current brush.
A double-based point class that can return it's coordinates approximated to integers.
|