Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/tool/kis_tool_utils.h
Context not available. | |||||
23 | #include <kis_types.h> | 23 | #include <kis_types.h> | ||
---|---|---|---|---|---|
24 | #include <kritaui_export.h> | 24 | #include <kritaui_export.h> | ||
25 | 25 | | |||
26 | class QPoint; | 26 | class KisCanvas2; | ||
27 | class KoCanvasResourceProvider; | ||||
27 | class KoColor; | 28 | class KoColor; | ||
29 | class QPoint; | ||||
30 | | ||||
31 | namespace KisToolUtils { // General tool utilities... | ||||
32 | /** | ||||
33 | * Recursively search a node with a non-transparent pixel | ||||
34 | */ | ||||
35 | KisNodeSP KRITAUI_EXPORT findNode(KisNodeSP node, const QPoint &point, bool wholeGroup, bool editableOnly = true); | ||||
36 | | ||||
37 | /** | ||||
38 | * return true if success | ||||
39 | * Clears the image. Selection is optional, use 0 to clear everything. | ||||
40 | */ | ||||
41 | bool KRITAUI_EXPORT clearImage(KisImageSP image, KisNodeSP node, KisSelectionSP selection); | ||||
42 | } | ||||
28 | 43 | | |||
29 | namespace KisToolUtils { | 44 | //============================================================================= | ||
45 | | ||||
46 | namespace KisPickerUtils { // Color picker utilities... | ||||
47 | enum SamplingSource { | ||||
48 | MERGED_VISIBLE, | ||||
49 | CURRENT_LAYER | ||||
50 | }; | ||||
51 | | ||||
52 | enum UpdateTarget { | ||||
53 | FOREGROUND, | ||||
54 | BACKGROUND, | ||||
55 | BOTH, | ||||
56 | SHIFT, // Shift FG to BG and update FG. | ||||
57 | }; | ||||
30 | 58 | | |||
31 | struct KRITAUI_EXPORT ColorPickerConfig { | 59 | struct KRITAUI_EXPORT ColorPickerConfig { | ||
32 | ColorPickerConfig(); | 60 | ColorPickerConfig(); | ||
33 | 61 | | |||
34 | bool toForegroundColor; | 62 | SamplingSource source; | ||
35 | bool updateColor; | 63 | int resampleRateMS; | ||
36 | bool addPalette; | 64 | bool update; | ||
37 | bool normaliseValues; | | |||
38 | bool sampleMerged; | | |||
39 | int radius; | 65 | int radius; | ||
40 | int blend; | 66 | int mix; | ||
67 | bool addToPalette; | ||||
68 | bool snapToPalette; | ||||
69 | bool normalizeColorData; | ||||
41 | 70 | | |||
42 | void save(bool defaultActivation = true) const; | 71 | void save(bool defaultActivation = true) const; | ||
43 | void load(bool defaultActivation = true); | 72 | void load(bool defaultActivation = true); | ||
Context not available. | |||||
51 | * out_color - Output parameter returning newly picked color. | 80 | * out_color - Output parameter returning newly picked color. | ||
52 | * dev - Paint device to pick from. | 81 | * dev - Paint device to pick from. | ||
53 | * pos - Position to pick from. | 82 | * pos - Position to pick from. | ||
54 | * blendColor - Optional color to be blended with. | 83 | * mixColor - Optional color to be mixed with. | ||
55 | * radius - Picking area radius in pixels. | 84 | * radius - Picking area radius in pixels. | ||
56 | * blend - Blend percentage. 100% all picked, 0% all blendColor. | 85 | * mix - Mix percentage. 100% all picked, 0% all mixColor. | ||
57 | * pure - Whether to bypass radius, blending, and active layer settings for pure picking. | 86 | * pure - Whether to bypass radius, mixing, and active layer settings for pure picking. | ||
58 | * | 87 | * | ||
59 | * RETURN - Returns TRUE whenever a valid color is picked. | 88 | * RETURN - Returns TRUE whenever a valid color is picked. | ||
60 | */ | 89 | */ | ||
61 | bool KRITAUI_EXPORT pickColor(KoColor &out_color, KisPaintDeviceSP dev, const QPoint &pos, | 90 | bool KRITAUI_EXPORT pickColor(KoColor &out_color, KisPaintDeviceSP sourceDevice, KisCanvas2 *canvas, const QPoint &pos, | ||
62 | KoColor const *const blendColor = nullptr, int radius = 1, | 91 | KoColor const *const mixColor = nullptr, int radius = 1, int mix = 100, bool pure = false); | ||
63 | int blend = 100, bool pure = false); | | |||
64 | 92 | | |||
65 | /** | 93 | void sampleRadius(KoColor &out_color, const KisPaintDeviceSP device, const QPoint position, const int radius); | ||
66 | * Recursively search a node with a non-transparent pixel | | |||
67 | */ | | |||
68 | KisNodeSP KRITAUI_EXPORT findNode(KisNodeSP node, const QPoint &point, bool wholeGroup, bool editableOnly = true); | | |||
69 | 94 | | |||
70 | /** | 95 | void KRITAUI_EXPORT submitColor(KoCanvasResourceProvider &resourceProvider, UpdateTarget target, KoColor &color); | ||
71 | * return true if success | | |||
72 | * Clears the image. Selection is optional, use 0 to clear everything. | | |||
73 | */ | | |||
74 | bool KRITAUI_EXPORT clearImage(KisImageSP image, KisNodeSP node, KisSelectionSP selection); | | |||
75 | } | 96 | } | ||
76 | 97 | | |||
77 | #endif // KIS_TOOL_UTILS_H | 98 | #endif // KIS_TOOL_UTILS_H | ||
Context not available. |