|
Krita Source Code Documentation
|
#include <kis_preset_live_preview_view.h>
Inheritance diagram for KisPresetLivePreviewView:Public Member Functions | |
| KisPresetLivePreviewView (QWidget *parent) | |
| void | requestUpdateStroke () |
| void | setCurrentPreset (KisPaintOpPresetSP preset) |
| set the current preset from resource manager for the live preview to use. Good to call this every stroke update in case the preset has changed | |
| void | setup (KoCanvasResourceProvider *resourceManager) |
| one time setup for initialization of many variables. This live preview might be in a UI file, so make sure to call this before starting to use it | |
| ~KisPresetLivePreviewView () | |
Private Slots | |
| void | slotPreviewGenerationCompleted () |
| void | updateStroke () |
Private Member Functions | |
| void | changeEvent (QEvent *) override |
| void | paintBackground () |
| works as both clearing the previous stroke, providing striped backgrounds for smudging brushes, and text if there is no preview | |
| void | setupAndPaintStroke () |
| creates and performs the actual stroke that goes on top of the background this is internally and should always be called after the paintBackground() | |
Private Attributes | |
| QGraphicsScene * | m_brushPreviewScene {nullptr} |
| the scene that can add items like text and the brush stroke image | |
| QPointF | m_canvasCenterPoint |
| QRect | m_canvasSize |
| const KoColorSpace * | m_colorSpace {nullptr} |
| internally sets the color space for brush preview | |
| float | m_currentBrushSize {1.0} |
| KisDistanceInformation | m_currentDistance |
| KisPaintOpPresetSP | m_currentPreset |
| QPainterPath | m_curvedLine |
| KisPaintInformation | m_curvePointPI1 |
| KisPaintInformation | m_curvePointPI2 |
| KisImageSP | m_image |
| internally sets the image area for brush preview | |
| KisLayerSP | m_layer |
| internally sets the layer area for brush preview | |
| const float | m_maxBrushVal {100.0} |
| const qreal | m_maxScale {0.3} |
| const float | m_maxStrokeScale {1.0} |
| const float | m_minBrushVal {10.0} |
| the range of brush sizes that will control zooming in/out | |
| const qreal | m_minScale {1.0} |
| range of scale values. 1.0 == 100% | |
| const float | m_minStrokeScale {0.4} |
| multiplier that is used for lengthening the brush stroke points | |
| QGraphicsTextItem * | m_noPreviewText {nullptr} |
| holds the 'no preview available' text object | |
| KoColor | m_paintColor |
| the color which is used for rendering the stroke | |
| bool | m_previewGenerationInProgress {false} |
| KoCanvasResourceProvider * | m_resourceManager {nullptr} |
| internally sets the Resource Provider for brush preview (allowing gradients in preview) | |
| QGraphicsPixmapItem * | m_sceneImageItem {nullptr} |
| holds the preview brush stroke data | |
| KisSignalCompressor | m_updateCompressor |
Widget for displaying a live brush preview of your selected brush. It listens for signalsetting changes that the brush preset outputs and updates the preview accordingly. This class can be added to a UI file similar to how a QGraphicsView is added
Definition at line 35 of file kis_preset_live_preview_view.h.
| KisPresetLivePreviewView::KisPresetLivePreviewView | ( | QWidget * | parent | ) |
Definition at line 22 of file kis_preset_live_preview_view.cpp.
References connect(), m_updateCompressor, and updateStroke().
| KisPresetLivePreviewView::~KisPresetLivePreviewView | ( | ) |
Definition at line 29 of file kis_preset_live_preview_view.cpp.
References m_brushPreviewScene, and m_noPreviewText.
|
overrideprivate |
Definition at line 389 of file kis_preset_live_preview_view.cpp.
References m_currentPreset, and requestUpdateStroke().
|
private |
works as both clearing the previous stroke, providing striped backgrounds for smudging brushes, and text if there is no preview
Definition at line 111 of file kis_preset_live_preview_view.cpp.
References KisImage::bounds(), KisPaintDevice::colorSpace(), KisTransaction::end(), KisPaintDevice::fill(), KoColor::fromQColor(), KisImage::height(), KisBaseNode::image, m_colorSpace, m_currentPreset, m_image, m_layer, m_noPreviewText, m_paintColor, KisBaseNode::paintDevice(), palette, and KisImage::width().
| void KisPresetLivePreviewView::requestUpdateStroke | ( | ) |
Definition at line 71 of file kis_preset_live_preview_view.cpp.
References m_updateCompressor, and KisSignalCompressor::start().
| void KisPresetLivePreviewView::setCurrentPreset | ( | KisPaintOpPresetSP | preset | ) |
set the current preset from resource manager for the live preview to use. Good to call this every stroke update in case the preset has changed
| preset | the current preset from the resource manager |
Definition at line 66 of file kis_preset_live_preview_view.cpp.
References m_currentPreset.
| void KisPresetLivePreviewView::setup | ( | KoCanvasResourceProvider * | resourceManager | ) |
one time setup for initialization of many variables. This live preview might be in a UI file, so make sure to call this before starting to use it
Definition at line 35 of file kis_preset_live_preview_view.cpp.
References KoColorSpaceRegistry::instance(), m_brushPreviewScene, m_canvasCenterPoint, m_canvasSize, m_colorSpace, m_image, m_layer, m_noPreviewText, m_resourceManager, m_sceneImageItem, OPACITY_OPAQUE_U8, and KoColorSpaceRegistry::rgb8().
|
private |
creates and performs the actual stroke that goes on top of the background this is internally and should always be called after the paintBackground()
Definition at line 217 of file kis_preset_live_preview_view.cpp.
References KisImage::addJob(), connect(), KisImage::endStroke(), KisBrush::fromXML(), KisGlobalResourcesInterface::instance(), kundo2_noi18n(), m_canvasCenterPoint, m_currentPreset, m_curvePointPI1, m_curvePointPI2, m_image, m_layer, m_paintColor, m_previewGenerationInProgress, m_resourceManager, KisPaintInformation::pos(), KisPaintInformation::pressure(), KisPaintInformation::setCurrentTime(), KisResourcesSnapshot::setFGColorOverride(), KisResourcesSnapshot::setMirroring(), KisResourcesSnapshot::setOpacity(), KisPaintInformation::setPos(), KisPaintInformation::setPressure(), slotPreviewGenerationCompleted(), and KisImage::startStroke().
|
privateslot |
Definition at line 96 of file kis_preset_live_preview_view.cpp.
References KisImage::bounds(), KisPaintDevice::convertToQImage(), m_brushPreviewScene, m_image, m_layer, m_previewGenerationInProgress, m_sceneImageItem, and KisBaseNode::paintDevice().
|
privateslot |
Definition at line 76 of file kis_preset_live_preview_view.cpp.
References m_currentPreset, m_previewGenerationInProgress, m_updateCompressor, paintBackground(), setupAndPaintStroke(), slotPreviewGenerationCompleted(), and KisSignalCompressor::start().
|
private |
the scene that can add items like text and the brush stroke image
Definition at line 82 of file kis_preset_live_preview_view.h.
|
private |
convenience variable used internally when positioning the objects and points in the scene
Definition at line 97 of file kis_preset_live_preview_view.h.
|
private |
holds the width and height of the image of the brush preview Probably can later add set functions to make this customizable It is hard-coded to 1200 x 400 for right now for image size
Definition at line 93 of file kis_preset_live_preview_view.h.
|
private |
internally sets the color space for brush preview
Definition at line 76 of file kis_preset_live_preview_view.h.
|
private |
internal reference for internal brush size used to check if our brush size has changed do zooming and other things internally if it has changed
Definition at line 114 of file kis_preset_live_preview_view.h.
|
private |
internal variables for constructing the stroke start and end shape there are two points that construct the "S" curve with this
Definition at line 101 of file kis_preset_live_preview_view.h.
|
private |
internally stores the current preset. See setCurrentPreset(KisPaintOpPresetSP preset) for setting this externally
Definition at line 109 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 102 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 103 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 104 of file kis_preset_live_preview_view.h.
|
private |
internally sets the image area for brush preview
Definition at line 70 of file kis_preset_live_preview_view.h.
|
private |
internally sets the layer area for brush preview
Definition at line 73 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 121 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 125 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 129 of file kis_preset_live_preview_view.h.
|
private |
the range of brush sizes that will control zooming in/out
Definition at line 120 of file kis_preset_live_preview_view.h.
|
private |
range of scale values. 1.0 == 100%
Definition at line 124 of file kis_preset_live_preview_view.h.
|
private |
multiplier that is used for lengthening the brush stroke points
Definition at line 128 of file kis_preset_live_preview_view.h.
|
private |
holds the 'no preview available' text object
Definition at line 88 of file kis_preset_live_preview_view.h.
|
private |
the color which is used for rendering the stroke
Definition at line 79 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 116 of file kis_preset_live_preview_view.h.
|
private |
internally sets the Resource Provider for brush preview (allowing gradients in preview)
Definition at line 67 of file kis_preset_live_preview_view.h.
|
private |
holds the preview brush stroke data
Definition at line 85 of file kis_preset_live_preview_view.h.
|
private |
Definition at line 117 of file kis_preset_live_preview_view.h.