|
Krita Source Code Documentation
|
The Scratchpad class A scratchpad is a type of blank canvas area that can be painted on with the normal painting devices. More...
#include <Scratchpad.h>
Inheritance diagram for Scratchpad:Classes | |
| struct | Private |
Public Slots | |
| bool | canvasZoomLink () |
| return if scratchpad zoom level is linked with current view zoom level | |
| void | clear () |
| Clears out scratchpad with color specified set during setup. | |
| QRect | contentBounds () const |
| The content of scratchpad can be bigger or smaller than scratchpad dimension. The bounds return the area in which there's some content. | |
| QImage | copyScratchpadImageData () |
| Take what is on the scratchpad area and grab image. | |
| void | fillBackground () |
| Fill the entire scratchpad with current background color. | |
| void | fillDefault () |
| Fill the entire scratchpad with default color. | |
| void | fillDocument (bool fullContent=true) |
| Fill the entire scratchpad with current document projection content. | |
| void | fillForeground () |
| Fill the entire scratchpad with current foreground color. | |
| void | fillGradient (const QPoint &gradientVectorStart=QPoint(), const QPoint &gradientVectorEnd=QPoint(), const QString &gradientShape="linear", const QString &gradientRepeat="none", bool reverseGradient=false, bool dither=false) |
| Fill the entire scratchpad with current gradient. | |
| void | fillLayer (bool fullContent=true) |
| Fill the entire scratchpad with current layer content. | |
| void | fillPattern (QTransform transform=QTransform()) |
| Fill the entire scratchpad with current pattern. | |
| void | fillTransparent () |
| Fill the entire scratchpad with a transparent color. | |
| void | linkCanvasZoom (bool value) |
| DEPRECATED – USE setCanvasZoomLink() instead Makes a connection between the zoom of the canvas and scratchpad area so they zoom in sync. | |
| void | loadScratchpadImage (QImage image) |
| Load image data to the scratchpad. | |
| void | panCenter () |
| pan scratchpad content to center content in viewport | |
| void | panTo (qint32 x, qint32 y) |
| pan scratchpad content to top-left position of scratchpad viewport Provided value are absolute | |
| qreal | scale () |
| return current zoom level applied on scratchpad (whatever the zoom source is: view zoom level or set manually) | |
| void | scaleReset () |
| reset scale and pan to origin Note: call method is ignored if canvasZoomLink() is True | |
| void | scaleToFit () |
| calculate scale automatically to fit scratchpad content in scratchpad viewport Note: call method is ignored if canvasZoomLink() is True | |
| void | setCanvasZoomLink (bool value) |
| Makes a connection between the zoom of the canvas and scratchpad area so they zoom in sync. | |
| void | setFillColor (QColor color) |
| Define default fill color for scratchpad. | |
| void | setMode (QString modeName) |
| Manually set what mode scratchpad is in. Ignored if "setModeManually is set to false. | |
| void | setModeManually (bool value) |
| Switches between a GUI controlling the current mode and when mouse clicks control mode. | |
| bool | setScale (qreal scale) const |
| allow to manually set scratchpad zoom level Note: call method is ignored if canvasZoomLink() is True, | |
| QRect | viewportBounds () const |
| The viewport indicates which part of scratchpad content is visible. It takes in account the current translation & scale. | |
Signals | |
| void | contentChanged () |
| signal is emitted when scratchpad content is changed (stroke or fill) | |
| void | scaleChanged (qreal scale) |
| signal is emitted when scratchpad scale is changed (from zoom canvas or manually) | |
| void | viewportChanged (const QRect rect) |
| signal is emitted when scratchpad viewport has been modified (pan, zoom) | |
Public Member Functions | |
| Scratchpad (View *view, const QColor &defaultColor, QWidget *parent=0) | |
| ~Scratchpad () | |
Private Attributes | |
| const QScopedPointer< Private > | d |
The Scratchpad class A scratchpad is a type of blank canvas area that can be painted on with the normal painting devices.
Definition at line 31 of file Scratchpad.h.
| Scratchpad::Scratchpad | ( | View * | view, |
| const QColor & | defaultColor, | ||
| QWidget * | parent = 0 ) |
Definition at line 28 of file Scratchpad.cpp.
References connect(), contentChanged(), d, KisView::resourceProvider(), scaleChanged(), View::view(), and viewportChanged().
| Scratchpad::~Scratchpad | ( | ) |
Definition at line 48 of file Scratchpad.cpp.
|
slot |
return if scratchpad zoom level is linked with current view zoom level
Definition at line 73 of file Scratchpad.cpp.
References d.
|
slot |
Clears out scratchpad with color specified set during setup.
Definition at line 131 of file Scratchpad.cpp.
References d.
|
slot |
The content of scratchpad can be bigger or smaller than scratchpad dimension. The bounds return the area in which there's some content.
Definition at line 222 of file Scratchpad.cpp.
References d.
|
signal |
signal is emitted when scratchpad content is changed (stroke or fill)
|
slot |
Take what is on the scratchpad area and grab image.
Definition at line 126 of file Scratchpad.cpp.
References d.
|
slot |
Fill the entire scratchpad with current background color.
Definition at line 152 of file Scratchpad.cpp.
References d.
|
slot |
Fill the entire scratchpad with default color.
Definition at line 142 of file Scratchpad.cpp.
References d.
|
slot |
Fill the entire scratchpad with current document projection content.
| fullContent | when True, full document projection is loaded in scratchpad, otherwise only content matching scratchpad viewport is loaded |
Definition at line 207 of file Scratchpad.cpp.
References d.
|
slot |
Fill the entire scratchpad with current foreground color.
Definition at line 157 of file Scratchpad.cpp.
References d.
|
slot |
Fill the entire scratchpad with current gradient.
| gradientVectorStart | is a QPoint to define origin of gradient Set an empty QPoint() to use default scratchpad top-left |
| gradientVectorEnd | is a QPoint to define end of gradient set an empty QPoint() to use default scratchpad bottom-right |
| gradientShape | define which gradient to apply, can be:
|
| gradientRepeat | define how to repeat gradient, can be:
|
| reverseGradient | a boolean to define if gradient is reversed or not |
| dither | a boolean to define if gradient is dithered or not |
Definition at line 162 of file Scratchpad.cpp.
References d, KisGradientPainter::GradientRepeatAlternate, KisGradientPainter::GradientRepeatForwards, KisGradientPainter::GradientRepeatNone, KisGradientPainter::GradientShapeBiLinear, KisGradientPainter::GradientShapeConical, KisGradientPainter::GradientShapeConicalSymetric, KisGradientPainter::GradientShapeLinear, KisGradientPainter::GradientShapePolygonal, KisGradientPainter::GradientShapeRadial, KisGradientPainter::GradientShapeReverseSpiral, KisGradientPainter::GradientShapeSpiral, and KisGradientPainter::GradientShapeSquare.
|
slot |
Fill the entire scratchpad with current layer content.
| fullContent | when True, full layer content is loaded in scratchpad, otherwise only content matching scratchpad viewport is loaded |
Definition at line 202 of file Scratchpad.cpp.
References d.
|
slot |
Fill the entire scratchpad with current pattern.
| transform | is QTransform that let define pattern scale/rotation property |
Definition at line 212 of file Scratchpad.cpp.
References d.
|
slot |
Fill the entire scratchpad with a transparent color.
Definition at line 147 of file Scratchpad.cpp.
References d.
|
slot |
DEPRECATED – USE setCanvasZoomLink() instead Makes a connection between the zoom of the canvas and scratchpad area so they zoom in sync.
| value | If True (default) the scratchpad will share the current view zoom level. If False, then use scratchpad scale methods to define current zoom level |
Definition at line 62 of file Scratchpad.cpp.
|
slot |
Load image data to the scratchpad.
| image | Image object to load |
Definition at line 121 of file Scratchpad.cpp.
References d.
|
slot |
pan scratchpad content to center content in viewport
Definition at line 116 of file Scratchpad.cpp.
References d.
|
slot |
pan scratchpad content to top-left position of scratchpad viewport Provided value are absolute
| x | abscissa position to pan to |
| y | ordinate position to pan to |
Definition at line 111 of file Scratchpad.cpp.
References d.
|
slot |
return current zoom level applied on scratchpad (whatever the zoom source is: view zoom level or set manually)
Definition at line 78 of file Scratchpad.cpp.
References d.
|
signal |
signal is emitted when scratchpad scale is changed (from zoom canvas or manually)
| scale | updated scale value (1.00 = 100%) |
|
slot |
reset scale and pan to origin Note: call method is ignored if canvasZoomLink() is True
Definition at line 102 of file Scratchpad.cpp.
References d.
|
slot |
calculate scale automatically to fit scratchpad content in scratchpad viewport Note: call method is ignored if canvasZoomLink() is True
Definition at line 93 of file Scratchpad.cpp.
References d.
|
slot |
Makes a connection between the zoom of the canvas and scratchpad area so they zoom in sync.
| value | If True (default) the scratchpad will share the current view zoom level. If False, then use scratchpad scale methods to define current zoom level |
Definition at line 68 of file Scratchpad.cpp.
|
slot |
Define default fill color for scratchpad.
| Color | to fill the canvas with |
Definition at line 137 of file Scratchpad.cpp.
References d.
|
slot |
Manually set what mode scratchpad is in. Ignored if "setModeManually is set to false.
| modeName | Available options are:
|
Definition at line 57 of file Scratchpad.cpp.
References d.
|
slot |
|
slot |
allow to manually set scratchpad zoom level Note: call method is ignored if canvasZoomLink() is True,
| scale | zoom level to apply (1.00 = 100%) |
Definition at line 84 of file Scratchpad.cpp.
|
slot |
The viewport indicates which part of scratchpad content is visible. It takes in account the current translation & scale.
Example 1:
Example 2:
Definition at line 217 of file Scratchpad.cpp.
References d.
|
signal |
signal is emitted when scratchpad viewport has been modified (pan, zoom)
| rect | new viewport bounds |
|
private |
Definition at line 257 of file Scratchpad.h.