diff --git a/krita/krita.action b/krita/krita.action
index 5852241769..13e3cd169c 100644
--- a/krita/krita.action
+++ b/krita/krita.action
@@ -1,2936 +1,2948 @@
General
Open Resources Folder
Opens a file browser at the location Krita saves resources such as brushes to.
Opens a file browser at the location Krita saves resources such as brushes to.
Open Resources Folder
0
0
false
Cleanup removed files...
Cleanup removed files
Cleanup removed files
0
0
false
C&ascade
Cascade
Cascade
10
0
false
&Tile
Tile
Tile
10
0
false
Create Resource Bundle...
Create Resource Bundle
Create Resource Bundle
0
0
false
Show File Toolbar
Show File Toolbar
Show File Toolbar
false
Show color selector
Show color selector
Show color selector
Shift+I
false
Show MyPaint shade selector
Show MyPaint shade selector
Show MyPaint shade selector
Shift+M
false
Show minimal shade selector
Show minimal shade selector
Show minimal shade selector
Shift+N
false
Show color history
Show color history
Show color history
H
false
Show common colors
Show common colors
Show common colors
U
false
Show Tool Options
Show Tool Options
Show Tool Options
\
false
Show Brush Editor
Show Brush Editor
Show Brush Editor
F5
false
Show Brush Presets
Show Brush Presets
Show Brush Presets
F6
false
Toggle Tablet Debugger
Toggle Tablet Debugger
Toggle Tablet Debugger
0
0
Ctrl+Shift+T
false
Rename Composition...
Rename Composition
Rename Composition
0
0
false
Update Composition
Update Composition
Update Composition
0
0
false
Painting
Make brush color lighter
Make brush color lighter
Make brush color lighter
0
0
L
false
Make brush color darker
Make brush color darker
Make brush color darker
0
0
K
false
Make brush color more saturated
Make brush color more saturated
Make brush color more saturated
false
Make brush color more desaturated
Make brush color more desaturated
Make brush color more desaturated
false
Shift brush color hue clockwise
Shift brush color hue clockwise
Shift brush color hue clockwise
false
Shift brush color hue counter-clockwise
Shift brush color hue counter-clockwise
Shift brush color hue counter-clockwise
false
Make brush color more red
Make brush color more red
Make brush color more red
false
Make brush color more green
Make brush color more green
Make brush color more green
false
Make brush color more blue
Make brush color more blue
Make brush color more blue
false
Make brush color more yellow
Make brush color more yellow
Make brush color more yellow
false
Increase opacity
Increase opacity
Increase opacity
0
0
O
false
Decrease opacity
Decrease opacity
Decrease opacity
0
0
I
false
draw-eraser
Set eraser mode
Set eraser mode
Set eraser mode
10000
0
E
true
view-refresh
Reload Original Preset
Reload Original Preset
Reload Original Preset
10000
false
transparency-unlocked
Preserve Alpha
Preserve Alpha
Preserve Alpha
10000
true
transform_icons_penPressure
Use Pen Pressure
Use Pen Pressure
Use Pen Pressure
10000
true
symmetry-horizontal
Horizontal Mirror Tool
Horizontal Mirror Tool
Horizontal Mirror Tool
10000
true
symmetry-vertical
Vertical Mirror Tool
Vertical Mirror Tool
Vertical Mirror Tool
10000
true
Paste at cursor
Paste at cursor
Paste at cursor
0
0
false
&Invert Selection
Invert current selection
Invert Selection
10000000000
100
Ctrl+Shift+I
false
Fill with Foreground Color (Opacity)
Fill with Foreground Color (Opacity)
Fill with Foreground Color (Opacity)
10000
1
Ctrl+Shift+Backspace
false
Fill with Background Color (Opacity)
Fill with Background Color (Opacity)
Fill with Background Color (Opacity)
10000
1
Ctrl+Backspace
false
Fill with Pattern (Opacity)
Fill with Pattern (Opacity)
Fill with Pattern (Opacity)
10000
1
false
&Toggle Selection Display Mode
Toggle Selection Display Mode
Toggle Selection Display Mode
0
0
false
Next Favourite Preset
Next Favourite Preset
Next Favourite Preset
,
false
Previous Favourite Preset
Previous Favourite Preset
Previous Favourite Preset
.
false
preset-switcher
Switch to Previous Preset
Switch to Previous Preset
Switch to Previous Preset
/
false
Hide Brushes and Stuff Toolbar
Hide Brushes and Stuff Toolbar
Hide Brushes and Stuff Toolbar
true
Reset Foreground and Background Color
Reset Foreground and Background Color
Reset Foreground and Background Color
D
false
Swap Foreground and Background Color
Swap Foreground and Background Color
Swap Foreground and Background Color
X
false
smoothing-weighted
Brush Smoothing: Weighted
Brush Smoothing: Weighted
Brush Smoothing: Weighted
false
smoothing-no
Brush Smoothing: Disabled
Brush Smoothing: Disabled
Brush Smoothing: Disabled
false
smoothing-stabilizer
Brush Smoothing: Stabilizer
Brush Smoothing: Stabilizer
Brush Smoothing: Stabilizer
false
Decrease Brush Size
Decrease Brush Size
Decrease Brush Size
0
0
[
false
smoothing-basic
Brush Smoothing: Basic
Brush Smoothing: Basic
Brush Smoothing: Basic
false
Increase Brush Size
Increase Brush Size
Increase Brush Size
0
0
]
false
Toggle Assistant
Toggle Assistant
ToggleAssistant
Ctrl+Shift+L
true
Undo Polygon Selection Points
Undo Polygon Selection Points
Undo Polygon Selection Points
Shift+Z
false
Fill with Foreground Color (Opacity)
Fill with Foreground Color (Opacity)
Fill with Foreground Color (Opacity)
10000
1
Ctrl+Shift+Backspace
false
Fill with Background Color (Opacity)
Fill with Background Color (Opacity)
Fill with Background Color (Opacity)
10000
1
Ctrl+Backspace
false
Fill with Pattern (Opacity)
Fill with Pattern (Opacity)
Fill with Pattern (Opacity)
10000
1
false
Convert &to Shape
Convert to Shape
Convert to Shape
10000000000
0
false
&Select Opaque
Select Opaque
Select Opaque
100000
100
false
&Show Global Selection Mask
Shows global selection as a usual selection mask in <interface>Layers</interface> docker
Show Global Selection Mask
100000
100
true
Filters
color-to-alpha
&Color to Alpha...
Color to Alpha
Color to Alpha
10000
0
false
&Top Edge Detection
Top Edge Detection
Top Edge Detection
10000
0
false
&Index Colors...
Index Colors
Index Colors
10000
0
false
Emboss Horizontal &Only
Emboss Horizontal Only
Emboss Horizontal Only
10000
0
false
D&odge
Dodge
Dodge
10000
0
false
&Sharpen
Sharpen
Sharpen
10000
0
false
B&urn
Burn
Burn
10000
0
false
&Mean Removal
Mean Removal
Mean Removal
10000
0
false
&Gaussian Blur...
Gaussian Blur
Gaussian Blur
10000
0
false
Emboss &in All Directions
Emboss in All Directions
Emboss in All Directions
10000
0
false
&Small Tiles...
Small Tiles
Small Tiles
10000
0
false
&Levels...
Levels
Levels
10000
0
Ctrl+L
false
&Sobel...
Sobel
Sobel
10000
0
false
&Wave...
Wave
Wave
10000
0
false
&Motion Blur...
Motion Blur
Motion Blur
10000
0
false
&Color Adjustment curves...
Color Adjustment curves
Color Adjustment curves
10000
0
Ctrl+M
false
Pi&xelize...
Pixelize
Pixelize
10000
0
false
Emboss (&Laplacian)
Emboss (Laplacian)
Emboss (Laplacian)
10000
0
false
&Left Edge Detection
Left Edge Detection
Left Edge Detection
10000
0
false
&Blur...
Blur
Blur
10000
0
false
&Raindrops...
Raindrops
Raindrops
10000
0
false
&Bottom Edge Detection
Bottom Edge Detection
Bottom Edge Detection
10000
0
false
&Random Noise...
Random Noise
Random Noise
10000
0
false
&Brightness/Contrast curve...
Brightness/Contrast curve
Brightness/Contrast curve
10000
0
false
Colo&r Balance..
Color Balance..
Color Balance..
10000
0
Ctrl+B
false
&PhongBumpmap...
PhongBumpmap
PhongBumpmap
10000
0
false
&Desaturate
Desaturate
Desaturate
10000
0
Ctrl+Shift+U
false
Color &Transfer...
Color Transfer
Color Transfer
10000
0
false
Emboss &Vertical Only
Emboss Vertical Only
Emboss Vertical Only
10000
0
false
&Lens Blur...
Lens Blur
Lens Blur
10000
0
false
M&inimize Channel
Minimize Channel
Minimize Channel
10000
0
false
M&aximize Channel
Maximize Channel
Maximize Channel
10000
0
false
&Oilpaint...
Oilpaint
Oilpaint
10000
0
false
&Right Edge Detection
Right Edge Detection
Right Edge Detection
10000
0
false
&Auto Contrast
Auto Contrast
Auto Contrast
10000
0
false
&Round Corners...
Round Corners
Round Corners
10000
0
false
&Unsharp Mask...
Unsharp Mask
Unsharp Mask
10000
0
false
&Emboss with Variable Depth...
Emboss with Variable Depth
Emboss with Variable Depth
10000
0
false
Emboss &Horizontal && Vertical
Emboss Horizontal & Vertical
Emboss Horizontal & Vertical
10000
0
false
Random &Pick...
Random Pick
Random Pick
10000
0
false
&Gaussian Noise Reduction...
Gaussian Noise Reduction
Gaussian Noise Reduction
10000
0
false
&Posterize...
Posterize
Posterize
10000
0
false
&Wavelet Noise Reducer...
Wavelet Noise Reducer
Wavelet Noise Reducer
10000
0
false
&HSV Adjustment...
HSV Adjustment
HSV Adjustment
10000
0
Ctrl+U
false
Tool Shortcuts
Dynamic Brush Tool
Dynamic Brush Tool
Dynamic Brush Tool
false
Crop Tool
Crop the image to an area
Crop the image to an area
C
false
Polygon Tool
Polygon Tool. Shift-mouseclick ends the polygon.
Polygon Tool. Shift-mouseclick ends the polygon.
false
References
References
References
false
Rectangle Tool
Rectangle Tool
Rectangle Tool
false
Multibrush Tool
Multibrush Tool
Multibrush Tool
Q
false
Shape Manipulation Tool
Shape Manipulation Tool
Shape Manipulation Tool
false
Color Picker
Select a color from the image or current layer
Select a color from the image or current layer
P
false
Text Editing Tool
Text editing
Text editing
false
Outline Selection Tool
Outline Selection Tool
Outline Selection Tool
false
Artistic Text Tool
Artistic text editing
Artistic text editing
false
Bezier Curve Selection Tool
Select a
Bezier Curve Selection Tool
false
Similar Color Selection Tool
Select a
Similar Color Selection Tool
false
Fill Tool
Fill a contiguous area of color with a color, or fill a selection.
Fill a contiguous area of color with a color, or fill a selection.
F
false
Line Tool
Line Tool
Line Tool
false
Freehand Path Tool
Freehand Path Tool
Freehand Path Tool
false
Bezier Curve Tool
Bezier Curve Tool. Shift-mouseclick ends the curve.
Bezier Curve Tool. Shift-mouseclick ends the curve.
false
Ellipse Tool
Ellipse Tool
Ellipse Tool
false
Freehand Brush Tool
Freehand Brush Tool
Freehand Brush Tool
B
false
Create object
Create object
Create object
false
Elliptical Selection Tool
Elliptical Selection Tool
Elliptical Selection Tool
J
false
Contiguous Selection Tool
Contiguous Selection Tool
Contiguous Selection Tool
false
Pattern editing
Pattern editing
Pattern editing
false
Review
Review
Review
false
Draw a gradient.
Draw a gradient.
Draw a gradient.
G
false
Polygonal Selection Tool
Polygonal Selection Tool
Polygonal Selection Tool
false
Measurement Tool
Measure the distance between two points
Measure the distance between two points
false
Rectangular Selection Tool
Rectangular Selection Tool
Rectangular Selection Tool
Ctrl+R
false
Move Tool
Move a layer
Move a layer
T
false
Vector Image Tool
Vector Image (EMF/WMF/SVM/SVG) tool
Vector Image (EMF/WMF/SVM/SVG) tool
false
Calligraphy
Calligraphy
Calligraphy
false
Path editing
Path editing
Path editing
false
Polyline Tool
Polyline Tool. Shift-mouseclick ends the polyline.
Polyline Tool. Shift-mouseclick ends the polyline.
false
Transform Tool
Transform a layer or a selection
Transform a layer or a selection
Ctrl+T
false
Ruler assistant editor tool
Ruler assistant editor tool
Ruler assistant editor tool
false
Text tool
Text tool
Text tool
false
Gradient Editing Tool
Gradient editing
Gradient editing
false
Blending Modes
Select Normal Blending Mode
Select Normal Blending Mode
Select Normal Blending Mode
0
0
Alt+Shift+N
false
Select Dissolve Blending Mode
Select Dissolve Blending Mode
Select Dissolve Blending Mode
0
0
Alt+Shift+I
false
Select Behind Blending Mode
Select Behind Blending Mode
Select Behind Blending Mode
0
0
Alt+Shift+Q
false
Select Clear Blending Mode
Select Clear Blending Mode
Select Clear Blending Mode
0
0
Alt+Shift+R
false
Select Darken Blending Mode
Select Darken Blending Mode
Select Darken Blending Mode
0
0
Alt+Shift+K
false
Select Multiply Blending Mode
Select Multiply Blending Mode
Select Multiply Blending Mode
0
0
Alt+Shift+M
false
Select Color Burn Blending Mode
Select Color Burn Blending Mode
Select Color Burn Blending Mode
0
0
Alt+Shift+B
false
Select Linear Burn Blending Mode
Select Linear Burn Blending Mode
Select Linear Burn Blending Mode
0
0
Alt+Shift+A
false
Select Lighten Blending Mode
Select Lighten Blending Mode
Select Lighten Blending Mode
0
0
Alt+Shift+G
false
Select Screen Blending Mode
Select Screen Blending Mode
Select Screen Blending Mode
0
0
Alt+Shift+S
false
Select Color Dodge Blending Mode
Select Color Dodge Blending Mode
Select Color Dodge Blending Mode
0
0
Alt+Shift+D
false
Select Linear Dodge Blending Mode
Select Linear Dodge Blending Mode
Select Linear Dodge Blending Mode
0
0
Alt+Shift+W
false
Select Overlay Blending Mode
Select Overlay Blending Mode
Select Overlay Blending Mode
0
0
Alt+Shift+O
false
+
+
+ Select Hard Overlay Blending Mode
+
+ Select Hard Overlay Blending Mode
+ Select Hard Overlay Blending Mode
+ 0
+ 0
+ Alt+Shift+P
+ false
+
+
Select Soft Light Blending Mode
Select Soft Light Blending Mode
Select Soft Light Blending Mode
0
0
Alt+Shift+F
false
Select Hard Light Blending Mode
Select Hard Light Blending Mode
Select Hard Light Blending Mode
0
0
Alt+Shift+H
false
Select Vivid Light Blending Mode
Select Vivid Light Blending Mode
Select Vivid Light Blending Mode
0
0
Alt+Shift+V
false
Select Linear Light Blending Mode
Select Linear Light Blending Mode
Select Linear Light Blending Mode
0
0
Alt+Shift+J
false
Select Pin Light Blending Mode
Select Pin Light Blending Mode
Select Pin Light Blending Mode
0
0
Alt+Shift+Z
false
Select Hard Mix Blending Mode
Select Hard Mix Blending Mode
Select Hard Mix Blending Mode
0
0
Alt+Shift+L
false
Select Difference Blending Mode
Select Difference Blending Mode
Select Difference Blending Mode
0
0
Alt+Shift+E
false
Select Exclusion Blending Mode
Select Exclusion Blending Mode
Select Exclusion Blending Mode
0
0
Alt+Shift+X
false
Select Hue Blending Mode
Select Hue Blending Mode
Select Hue Blending Mode
0
0
Alt+Shift+U
false
Select Saturation Blending Mode
Select Saturation Blending Mode
Select Saturation Blending Mode
0
0
Alt+Shift+T
false
Select Color Blending Mode
Select Color Blending Mode
Select Color Blending Mode
0
0
Alt+Shift+C
false
Select Luminosity Blending Mode
Select Luminosity Blending Mode
Select Luminosity Blending Mode
0
0
Alt+Shift+Y
false
Animation
Previous frame
Move to previous frame
Move to previous frame
1
0
false
Next frame
Move to next frame
Move to next frame
1
0
false
Play / pause animation
Play / pause animation
Play / pause animation
1
0
false
Add blank frame
Add blank frame
Add blank frame
100000
0
false
Copy Frame
Add duplicate frame
Add duplicate frame
100000
0
false
Toggle onion skin
Toggle onion skin
Toggle onion skin
100000
0
false
Previous Keyframe
false
Next Keyframe
false
First Frame
false
Last Frame
false
Auto Frame Mode
true
true
Add blank frame
Add blank frame
Add blank frame
100000
0
false
Show in Timeline
true
Layers
Activate next layer
Activate next layer
Activate next layer
1000
0
PgUp
false
Activate previous layer
Activate previous layer
Activate previous layer
1000
0
PgDown
false
groupLayer
&Group Layer
Group Layer
Group Layer
1000
0
false
cloneLayer
&Clone Layer
Clone Layer
Clone Layer
1000
0
false
vectorLayer
&Vector Layer
Vector Layer
Vector Layer
1000
0
false
filterLayer
&Filter Layer...
Filter Layer
Filter Layer
1000
0
false
fillLayer
&Fill Layer...
Fill Layer
Fill Layer
1000
0
false
fileLayer
&File Layer...
File Layer
File Layer
1000
0
false
transparencyMask
&Transparency Mask
Transparency Mask
Transparency Mask
100000
0
false
filterMask
&Filter Mask...
Filter Mask
Filter Mask
100000
0
false
filterMask
&Colorize Mask
Colorize Mask
Colorize Mask
100000
0
false
transformMask
&Transform Mask...
Transform Mask
Transform Mask
100000
0
false
selectionMask
&Local Selection
Local Selection
Local Selection
100000
0
false
view-filter
&Isolate Layer
Isolate Layer
Isolate Layer
1000
0
true
paintLayer
&Paint Layer
Paint Layer
Paint Layer
1000
0
Insert
false
&New Layer From Visible
New layer from visible
New layer from visible
1000
0
false
duplicatelayer
&Duplicate Layer or Mask
Duplicate Layer or Mask
Duplicate Layer or Mask
1000
0
Ctrl+J
false
&Cut Selection to New Layer
Cut Selection to New Layer
Cut Selection to New Layer
100000000
1
Ctrl+Shift+J
false
Copy &Selection to New Layer
Copy Selection to New Layer
Copy Selection to New Layer
100000000
0
Ctrl+Alt+J
false
Copy Layer
Copy layer to clipboard
Copy layer to clipboard
10000
0
false
Cut Layer
Cut layer to clipboard
Cut layer to clipboard
10000
0
false
Paste Layer
Paste layer from clipboard
Paste layer from clipboard
10000
0
false
Quick Group
Create a group layer containing selected layers
Quick Group
100000
0
Ctrl+G
false
Quick Ungroup
Remove grouping of the layers or remove one layer out of the group
Quick Ungroup
100000
0
Ctrl+Alt+G
false
Quick Clipping Group
Group selected layers and add a layer with clipped alpha channel
Quick Clipping Group
100000
0
Ctrl+Shift+G
false
All Layers
Select all layers
Select all layers
10000
0
false
Visible Layers
Select all visible layers
Select all visible layers
10000
0
false
Locked Layers
Select all locked layers
Select all locked layers
10000
0
false
Invisible Layers
Select all invisible layers
Select all invisible layers
10000
0
false
Unlocked Layers
Select all unlocked layers
Select all unlocked layers
10000
0
false
document-save
&Save Layer/Mask...
Save Layer/Mask
Save Layer/Mask
1000
0
false
document-save
Save &Group Layers...
Save Group Layers
Save Group Layers
100000
0
false
Convert group to &animated layer
Convert child layers into animation frames
Convert child layers into animation frames
100000
0
false
I&mport Layer...
Import Layer
Import Layer
100000
0
false
paintLayer
&as Paint Layer...
as Paint Layer
as Paint Layer
1000
0
false
transparencyMask
as &Transparency Mask...
as Transparency Mask
as Transparency Mask
1000
0
false
filterMask
as &Filter Mask...
as Filter Mask
as Filter Mask
1000
0
false
selectionMask
as &Selection Mask...
as Selection Mask
as Selection Mask
1000
0
false
paintLayer
to &Paint Layer
to Paint Layer
to Paint Layer
1000
0
false
transparencyMask
to &Transparency Mask
to Transparency Mask
to Transparency Mask
1000
0
false
filterMask
to &Filter Mask...
to Filter Mask
to Filter Mask
1000
0
false
selectionMask
to &Selection Mask
to Selection Mask
to Selection Mask
1000
0
false
transparencyMask
&Alpha into Mask
Alpha into Mask
Alpha into Mask
100000
10
false
transparency-enabled
&Write as Alpha
Write as Alpha
Write as Alpha
1000000
1
false
document-save
&Save Merged...
Save Merged
Save Merged
1000000
0
false
split-layer
Split Layer...
Split Layer
Split Layer
1000
0
false
Wavelet Decompose ...
Wavelet Decompose
Wavelet Decompose
1000
1
false
symmetry-horizontal
Mirror Layer Hori&zontally
Mirror Layer Horizontally
Mirror Layer Horizontally
1000
1
false
symmetry-vertical
Mirror Layer &Vertically
Mirror Layer Vertically
Mirror Layer Vertically
1000
1
false
&Rotate Layer...
Rotate Layer
Rotate Layer
100000
1
false
object-rotate-right
Rotate &Layer 90° to the Right
Rotate Layer 90° to the Right
Rotate Layer 90° to the Right
100000
1
false
object-rotate-left
Rotate Layer &90° to the Left
Rotate Layer 90° to the Left
Rotate Layer 90° to the Left
100000
1
false
Rotate Layer &180°
Rotate Layer 180°
Rotate Layer 180°
100000
1
false
Scale &Layer to new Size...
Scale Layer to new Size
Scale Layer to new Size
100000
1
false
&Shear Layer...
Shear Layer
Shear Layer
100000
1
false
&Offset Layer...
Offset Layer
Offset Layer
100000
1
false
Clones &Array...
Clones Array
Clones Array
100000
0
false
&Edit metadata...
Edit metadata
Edit metadata
100000
1
false
&Histogram...
Histogram
Histogram
100000
0
false
&Convert Layer Color Space...
Convert Layer Color Space
Convert Layer Color Space
100000
1
false
merge-layer-below
&Merge with Layer Below
Merge with Layer Below
Merge with Layer Below
100000
0
Ctrl+E
false
&Flatten Layer
Flatten Layer
Flatten Layer
100000
0
false
Ras&terize Layer
Rasterize Layer
Rasterize Layer
10000000
1
false
Flatten ima&ge
Flatten image
Flatten image
100000
0
Ctrl+Shift+E
false
La&yer Style...
Layer Style
Layer Style
100000
1
false
Move into previous group
Move into previous group
Move into previous group
0
0
false
Move into next group
Move into next group
Move into next group
0
0
false
Rename current layer
Rename current layer
Rename current layer
100000
0
F2
false
deletelayer
&Remove Layer
Remove Layer
Remove Layer
1000
1
Shift+Delete
false
arrowupblr
Move Layer or Mask Up
Move Layer or Mask Up
Ctrl+PgUp
false
arrowdown
Move Layer or Mask Down
Move Layer or Mask Down
Ctrl+PgDown
false
properties
&Properties...
Properties
Properties
1000
1
F3
false
diff --git a/libs/pigment/KoCompositeOpRegistry.cpp b/libs/pigment/KoCompositeOpRegistry.cpp
index 00b741f7b0..8716763785 100644
--- a/libs/pigment/KoCompositeOpRegistry.cpp
+++ b/libs/pigment/KoCompositeOpRegistry.cpp
@@ -1,212 +1,213 @@
/*
* Copyright (c) 2005 Adrian Page
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "KoCompositeOpRegistry.h"
#include
#include
#include
#include
#include "KoCompositeOp.h"
#include "KoColorSpace.h"
Q_GLOBAL_STATIC(KoCompositeOpRegistry, registry)
KoCompositeOpRegistry::KoCompositeOpRegistry()
{
m_categories
<< KoID("arithmetic", i18n("Arithmetic"))
<< KoID("dark" , i18n("Darken"))
<< KoID("light" , i18n("Lighten"))
<< KoID("negative" , i18n("Negative"))
<< KoID("mix" , i18n("Mix"))
<< KoID("misc" , i18n("Misc"))
<< KoID("hsy" , i18n("HSY"))
<< KoID("hsi" , i18n("HSI"))
<< KoID("hsl" , i18n("HSL"))
<< KoID("hsv" , i18n("HSV"));
m_map.insert(m_categories[0], KoID(COMPOSITE_ADD , i18n("Addition")));
m_map.insert(m_categories[0], KoID(COMPOSITE_SUBTRACT , i18n("Subtract")));
m_map.insert(m_categories[0], KoID(COMPOSITE_MULT , i18n("Multiply")));
m_map.insert(m_categories[0], KoID(COMPOSITE_DIVIDE , i18n("Divide")));
m_map.insert(m_categories[0], KoID(COMPOSITE_INVERSE_SUBTRACT, i18n("Inverse Subtract")));
m_map.insert(m_categories[1], KoID(COMPOSITE_BURN , i18n("Burn")));
m_map.insert(m_categories[1], KoID(COMPOSITE_LINEAR_BURN, i18n("Linear Burn")));
m_map.insert(m_categories[1], KoID(COMPOSITE_DARKEN , i18n("Darken")));
m_map.insert(m_categories[1], KoID(COMPOSITE_GAMMA_DARK , i18n("Gamma Dark")));
m_map.insert(m_categories[1], KoID(COMPOSITE_DARKER_COLOR , i18n("Darker Color")));
m_map.insert(m_categories[2], KoID(COMPOSITE_DODGE , i18n("Color Dodge")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LINEAR_DODGE, i18n("Linear Dodge")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LIGHTEN , i18n("Lighten")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LINEAR_LIGHT, i18n("Linear Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_SCREEN , i18n("Screen")));
m_map.insert(m_categories[2], KoID(COMPOSITE_PIN_LIGHT , i18n("Pin Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_VIVID_LIGHT , i18n("Vivid Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_HARD_LIGHT , i18n("Hard Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_SOFT_LIGHT_PHOTOSHOP, i18n("Soft Light (Photoshop)")));
m_map.insert(m_categories[2], KoID(COMPOSITE_SOFT_LIGHT_SVG, i18n("Soft Light (SVG)")));
m_map.insert(m_categories[2], KoID(COMPOSITE_GAMMA_LIGHT , i18n("Gamma Light")));
m_map.insert(m_categories[2], KoID(COMPOSITE_LIGHTER_COLOR , i18n("Lighter Color")));
m_map.insert(m_categories[3], KoID(COMPOSITE_DIFF , i18n("Difference")));
m_map.insert(m_categories[3], KoID(COMPOSITE_EQUIVALENCE , i18n("Equivalence")));
m_map.insert(m_categories[3], KoID(COMPOSITE_ADDITIVE_SUBTRACTIVE, i18n("Additive Subtractive")));
m_map.insert(m_categories[3], KoID(COMPOSITE_EXCLUSION , i18n("Exclusion")));
m_map.insert(m_categories[3], KoID(COMPOSITE_ARC_TANGENT , i18n("Arcus Tangent")));
m_map.insert(m_categories[4], KoID(COMPOSITE_OVER , i18n("Normal")));
m_map.insert(m_categories[4], KoID(COMPOSITE_BEHIND , i18n("Behind")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GREATER , i18n("Greater")));
m_map.insert(m_categories[4], KoID(COMPOSITE_OVERLAY , i18n("Overlay")));
m_map.insert(m_categories[4], KoID(COMPOSITE_ERASE , i18n("Erase")));
m_map.insert(m_categories[4], KoID(COMPOSITE_ALPHA_DARKEN , i18n("Alpha Darken")));
m_map.insert(m_categories[4], KoID(COMPOSITE_HARD_MIX , i18n("Hard Mix")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GRAIN_MERGE , i18n("Grain Merge")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GRAIN_EXTRACT , i18n("Grain Extract")));
m_map.insert(m_categories[4], KoID(COMPOSITE_PARALLEL , i18n("Parallel")));
m_map.insert(m_categories[4], KoID(COMPOSITE_ALLANON , i18n("Allanon")));
m_map.insert(m_categories[4], KoID(COMPOSITE_GEOMETRIC_MEAN, i18n("Geometric Mean")));
+ m_map.insert(m_categories[4], KoID(COMPOSITE_HARD_OVERLAY , i18n("Hard Overlay")));
m_map.insert(m_categories[5], KoID(COMPOSITE_BUMPMAP , i18n("Bumpmap")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COMBINE_NORMAL, i18n("Combine Normal Map")));
m_map.insert(m_categories[5], KoID(COMPOSITE_DISSOLVE , i18n("Dissolve")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY_RED , i18n("Copy Red")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY_GREEN, i18n("Copy Green")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY_BLUE , i18n("Copy Blue")));
m_map.insert(m_categories[5], KoID(COMPOSITE_COPY , i18n("Copy")));
m_map.insert(m_categories[5], KoID(COMPOSITE_TANGENT_NORMALMAP, i18n("Tangent Normalmap")));
m_map.insert(m_categories[6], KoID(COMPOSITE_COLOR , i18n("Color")));
m_map.insert(m_categories[6], KoID(COMPOSITE_HUE , i18n("Hue")));
m_map.insert(m_categories[6], KoID(COMPOSITE_SATURATION , i18n("Saturation")));
m_map.insert(m_categories[6], KoID(COMPOSITE_LUMINIZE , i18n("Luminosity")));
m_map.insert(m_categories[6], KoID(COMPOSITE_DEC_SATURATION, i18n("Decrease Saturation")));
m_map.insert(m_categories[6], KoID(COMPOSITE_INC_SATURATION, i18n("Increase Saturation")));
m_map.insert(m_categories[6], KoID(COMPOSITE_DEC_LUMINOSITY, i18n("Decrease Luminosity")));
m_map.insert(m_categories[6], KoID(COMPOSITE_INC_LUMINOSITY, i18n("Increase Luminosity")));
m_map.insert(m_categories[7], KoID(COMPOSITE_COLOR_HSI , i18n("Color HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_HUE_HSI , i18n("Hue HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_SATURATION_HSI , i18n("Saturation HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_INTENSITY , i18n("Intensity")));
m_map.insert(m_categories[7], KoID(COMPOSITE_DEC_SATURATION_HSI, i18n("Decrease Saturation HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_INC_SATURATION_HSI, i18n("Increase Saturation HSI")));
m_map.insert(m_categories[7], KoID(COMPOSITE_DEC_INTENSITY , i18n("Decrease Intensity")));
m_map.insert(m_categories[7], KoID(COMPOSITE_INC_INTENSITY , i18n("Increase Intensity")));
m_map.insert(m_categories[8], KoID(COMPOSITE_COLOR_HSL , i18n("Color HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_HUE_HSL , i18n("Hue HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_SATURATION_HSL , i18n("Saturation HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_LIGHTNESS , i18n("Lightness")));
m_map.insert(m_categories[8], KoID(COMPOSITE_DEC_SATURATION_HSL, i18n("Decrease Saturation HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_INC_SATURATION_HSL, i18n("Increase Saturation HSL")));
m_map.insert(m_categories[8], KoID(COMPOSITE_DEC_LIGHTNESS , i18n("Decrease Lightness")));
m_map.insert(m_categories[8], KoID(COMPOSITE_INC_LIGHTNESS , i18n("Increase Lightness")));
m_map.insert(m_categories[9], KoID(COMPOSITE_COLOR_HSV , i18n("Color HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_HUE_HSV , i18n("Hue HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_SATURATION_HSV , i18n("Saturation HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_VALUE , i18n("Value")));
m_map.insert(m_categories[9], KoID(COMPOSITE_DEC_SATURATION_HSV, i18n("Decrease Saturation HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_INC_SATURATION_HSV, i18n("Increase Saturation HSV")));
m_map.insert(m_categories[9], KoID(COMPOSITE_DEC_VALUE , i18n("Decrease Value")));
m_map.insert(m_categories[9], KoID(COMPOSITE_INC_VALUE , i18n("Increase Value")));
}
const KoCompositeOpRegistry& KoCompositeOpRegistry::instance()
{
return *registry;
}
KoID KoCompositeOpRegistry::getDefaultCompositeOp() const
{
return KoID(COMPOSITE_OVER, i18n("Normal"));
}
KoID KoCompositeOpRegistry::getKoID(const QString& compositeOpID) const
{
KoIDMap::const_iterator itr = qFind(m_map.begin(), m_map.end(), KoID(compositeOpID));
return (itr != m_map.end()) ? *itr : KoID();
}
KoCompositeOpRegistry::KoIDMap KoCompositeOpRegistry::getCompositeOps() const
{
return m_map;
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCategories() const
{
return m_categories;
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCompositeOps(const KoID& category, const KoColorSpace* colorSpace) const
{
qint32 num = m_map.count(category);
KoIDMap::const_iterator beg = m_map.find(category);
KoIDMap::const_iterator end = beg + num;
KoIDList list;
list.reserve(num);
if(colorSpace) {
for(; beg!=end; ++beg){
if(colorSpace->hasCompositeOp(beg->id()))
list.push_back(*beg);
}
}
else {
for(; beg!=end; ++beg)
list.push_back(*beg);
}
return list;
}
KoCompositeOpRegistry::KoIDList KoCompositeOpRegistry::getCompositeOps(const KoColorSpace* colorSpace) const
{
KoIDMap::const_iterator beg = m_map.begin();
KoIDMap::const_iterator end = m_map.end();
KoIDList list;
list.reserve(m_map.size());
if(colorSpace) {
for(; beg!=end; ++beg){
if(colorSpace->hasCompositeOp(beg->id()))
list.push_back(*beg);
}
}
else {
for(; beg!=end; ++beg)
list.push_back(*beg);
}
return list;
}
bool KoCompositeOpRegistry::colorSpaceHasCompositeOp(const KoColorSpace* colorSpace, const KoID& compositeOp) const
{
return colorSpace ? colorSpace->hasCompositeOp(compositeOp.id()) : false;
}
diff --git a/libs/pigment/KoCompositeOpRegistry.h b/libs/pigment/KoCompositeOpRegistry.h
index bc9b610bb7..e5f153d3cc 100644
--- a/libs/pigment/KoCompositeOpRegistry.h
+++ b/libs/pigment/KoCompositeOpRegistry.h
@@ -1,173 +1,174 @@
/*
* Copyright (c) 2005 Adrian Page
* Copyright (c) 2011 Silvio Heinrich
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOMPOSITEOPREGISTRY_H
#define KOCOMPOSITEOPREGISTRY_H
#include
#include
#include
#include
#include "kritapigment_export.h"
class KoColorSpace;
#include
// TODO : convert this data blob into a modern design with an enum class.
// This will reduce the need for runtime string comparisons.
const QString COMPOSITE_OVER = "normal";
const QString COMPOSITE_ERASE = "erase";
const QString COMPOSITE_IN = "in";
const QString COMPOSITE_OUT = "out";
const QString COMPOSITE_ALPHA_DARKEN = "alphadarken";
const QString COMPOSITE_XOR = "xor";
const QString COMPOSITE_PLUS = "plus";
const QString COMPOSITE_MINUS = "minus";
const QString COMPOSITE_ADD = "add";
const QString COMPOSITE_SUBTRACT = "subtract";
const QString COMPOSITE_INVERSE_SUBTRACT = "inverse_subtract";
const QString COMPOSITE_DIFF = "diff";
const QString COMPOSITE_MULT = "multiply";
const QString COMPOSITE_DIVIDE = "divide";
const QString COMPOSITE_ARC_TANGENT = "arc_tangent";
const QString COMPOSITE_GEOMETRIC_MEAN = "geometric_mean";
const QString COMPOSITE_ADDITIVE_SUBTRACTIVE = "additive_subtractive";
const QString COMPOSITE_EQUIVALENCE = "equivalence";
const QString COMPOSITE_ALLANON = "allanon";
const QString COMPOSITE_PARALLEL = "parallel";
const QString COMPOSITE_GRAIN_MERGE = "grain_merge";
const QString COMPOSITE_GRAIN_EXTRACT = "grain_extract";
const QString COMPOSITE_EXCLUSION = "exclusion";
const QString COMPOSITE_HARD_MIX = "hard mix";
const QString COMPOSITE_OVERLAY = "overlay";
const QString COMPOSITE_BEHIND = "behind";
-const QString COMPOSITE_GREATER = "greater";
+const QString COMPOSITE_GREATER = "greater";
+const QString COMPOSITE_HARD_OVERLAY = "hard overlay";
const QString COMPOSITE_DARKEN = "darken";
const QString COMPOSITE_BURN = "burn";//this is also known as 'color burn'.
const QString COMPOSITE_LINEAR_BURN = "linear_burn";
const QString COMPOSITE_GAMMA_DARK = "gamma_dark";
const QString COMPOSITE_LIGHTEN = "lighten";
const QString COMPOSITE_DODGE = "dodge";
const QString COMPOSITE_LINEAR_DODGE = "linear_dodge";
const QString COMPOSITE_SCREEN = "screen";
const QString COMPOSITE_HARD_LIGHT = "hard_light";
const QString COMPOSITE_SOFT_LIGHT_PHOTOSHOP = "soft_light";
const QString COMPOSITE_SOFT_LIGHT_SVG = "soft_light_svg";
const QString COMPOSITE_GAMMA_LIGHT = "gamma_light";
const QString COMPOSITE_VIVID_LIGHT = "vivid_light";
const QString COMPOSITE_LINEAR_LIGHT = "linear light";
const QString COMPOSITE_PIN_LIGHT = "pin_light";
const QString COMPOSITE_HUE = "hue";
const QString COMPOSITE_COLOR = "color";
const QString COMPOSITE_SATURATION = "saturation";
const QString COMPOSITE_INC_SATURATION = "inc_saturation";
const QString COMPOSITE_DEC_SATURATION = "dec_saturation";
const QString COMPOSITE_LUMINIZE = "luminize";
const QString COMPOSITE_INC_LUMINOSITY = "inc_luminosity";
const QString COMPOSITE_DEC_LUMINOSITY = "dec_luminosity";
const QString COMPOSITE_HUE_HSV = "hue_hsv";
const QString COMPOSITE_COLOR_HSV = "color_hsv";
const QString COMPOSITE_SATURATION_HSV = "saturation_hsv";
const QString COMPOSITE_INC_SATURATION_HSV = "inc_saturation_hsv";
const QString COMPOSITE_DEC_SATURATION_HSV = "dec_saturation_hsv";
const QString COMPOSITE_VALUE = "value";
const QString COMPOSITE_INC_VALUE = "inc_value";
const QString COMPOSITE_DEC_VALUE = "dec_value";
const QString COMPOSITE_HUE_HSL = "hue_hsl";
const QString COMPOSITE_COLOR_HSL = "color_hsl";
const QString COMPOSITE_SATURATION_HSL = "saturation_hsl";
const QString COMPOSITE_INC_SATURATION_HSL = "inc_saturation_hsl";
const QString COMPOSITE_DEC_SATURATION_HSL = "dec_saturation_hsl";
const QString COMPOSITE_LIGHTNESS = "lightness";
const QString COMPOSITE_INC_LIGHTNESS = "inc_lightness";
const QString COMPOSITE_DEC_LIGHTNESS = "dec_lightness";
const QString COMPOSITE_HUE_HSI = "hue_hsi";
const QString COMPOSITE_COLOR_HSI = "color_hsi";
const QString COMPOSITE_SATURATION_HSI = "saturation_hsi";
const QString COMPOSITE_INC_SATURATION_HSI = "inc_saturation_hsi";
const QString COMPOSITE_DEC_SATURATION_HSI = "dec_saturation_hsi";
const QString COMPOSITE_INTENSITY = "intensity";
const QString COMPOSITE_INC_INTENSITY = "inc_intensity";
const QString COMPOSITE_DEC_INTENSITY = "dec_intensity";
const QString COMPOSITE_COPY = "copy";
const QString COMPOSITE_COPY_RED = "copy_red";
const QString COMPOSITE_COPY_GREEN = "copy_green";
const QString COMPOSITE_COPY_BLUE = "copy_blue";
const QString COMPOSITE_TANGENT_NORMALMAP = "tangent_normalmap";
const QString COMPOSITE_COLORIZE = "colorize";
const QString COMPOSITE_BUMPMAP = "bumpmap";
const QString COMPOSITE_COMBINE_NORMAL = "combine_normal";
const QString COMPOSITE_CLEAR = "clear";
const QString COMPOSITE_DISSOLVE = "dissolve";
const QString COMPOSITE_DISPLACE = "displace";
const QString COMPOSITE_NO = "nocomposition";
const QString COMPOSITE_PASS_THROUGH = "pass through"; // XXX: not implemented anywhere yet
const QString COMPOSITE_DARKER_COLOR = "darker color";
const QString COMPOSITE_LIGHTER_COLOR = "lighter color";
const QString COMPOSITE_UNDEF = "undefined";
class KRITAPIGMENT_EXPORT KoCompositeOpRegistry
{
typedef QMultiMap KoIDMap;
typedef QList KoIDList;
public:
KoCompositeOpRegistry();
static const KoCompositeOpRegistry& instance();
KoID getDefaultCompositeOp() const;
KoID getKoID(const QString& compositeOpID) const;
KoIDMap getCompositeOps() const;
KoIDList getCategories() const;
KoIDList getCompositeOps(const KoColorSpace* colorSpace) const;
KoIDList getCompositeOps(const KoID& category, const KoColorSpace* colorSpace=0) const;
bool colorSpaceHasCompositeOp(const KoColorSpace* colorSpace, const KoID& compositeOp) const;
template
KoIDList filterCompositeOps(TKoIdIterator begin, TKoIdIterator end, const KoColorSpace* colorSpace, bool removeInvaliOps=true) const {
KoIDList list;
for(; begin!=end; ++begin){
if( colorSpaceHasCompositeOp(colorSpace, *begin) == removeInvaliOps)
list.push_back(*begin);
}
return list;
}
private:
KoIDList m_categories;
KoIDMap m_map;
};
#endif // KOCOMPOSITEOPREGISTRY_H
diff --git a/libs/pigment/compositeops/KoCompositeOpFunctions.h b/libs/pigment/compositeops/KoCompositeOpFunctions.h
index 437c204329..502c63b788 100644
--- a/libs/pigment/compositeops/KoCompositeOpFunctions.h
+++ b/libs/pigment/compositeops/KoCompositeOpFunctions.h
@@ -1,431 +1,444 @@
/*
* Copyright (c) 2011 Silvio Heinrich
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOMPOSITEOP_FUNCTIONS_H_
#define KOCOMPOSITEOP_FUNCTIONS_H_
#include
template
inline void cfReorientedNormalMapCombine(TReal srcR, TReal srcG, TReal srcB, TReal& dstR, TReal& dstG, TReal& dstB)
{
// see http://blog.selfshadow.com/publications/blending-in-detail/ by Barre-Brisebois and Hill
TReal tx = 2*srcR-1;
TReal ty = 2*srcG-1;
TReal tz = 2*srcB;
TReal ux = -2*dstR+1;
TReal uy = -2*dstG+1;
TReal uz = 2*dstB-1;
TReal k = (tx*ux+ty*uy+tz*uz)/tz; // dot(t,u)/t.z
TReal rx = tx*k-ux;
TReal ry = ty*k-uy;
TReal rz = tz*k-uz;
k = 1/sqrt(rx*rx+ry*ry+rz*rz); // normalize result
rx *= k;
ry *= k;
rz *= k;
dstR = rx*0.5+0.5;
dstG = ry*0.5+0.5;
dstB = rz*0.5+0.5;
}
template
inline void cfColor(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal lum = getLightness(dr, dg, db);
dr = sr;
dg = sg;
db = sb;
setLightness(dr, dg, db, lum);
}
template
inline void cfLightness(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
setLightness(dr, dg, db, getLightness(sr, sg, sb));
}
template
inline void cfIncreaseLightness(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
addLightness(dr, dg, db, getLightness(sr, sg, sb));
}
template
inline void cfDecreaseLightness(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
addLightness(dr, dg, db, getLightness(sr, sg, sb) - TReal(1.0));
}
template
inline void cfSaturation(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal sat = getSaturation(sr, sg, sb);
TReal light = getLightness(dr, dg, db);
setSaturation(dr, dg, db, sat);
setLightness(dr, dg, db, light);
}
template
inline void cfIncreaseSaturation(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
using namespace Arithmetic;
TReal sat = lerp(getSaturation(dr,dg,db), unitValue(), getSaturation(sr,sg,sb));
TReal light = getLightness(dr, dg, db);
setSaturation(dr, dg, db, sat);
setLightness(dr, dg, db, light);
}
template
inline void cfDecreaseSaturation(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
using namespace Arithmetic;
TReal sat = lerp(zeroValue(), getSaturation(dr,dg,db), getSaturation(sr,sg,sb));
TReal light = getLightness(dr, dg, db);
setSaturation(dr, dg, db, sat);
setLightness(dr, dg, db, light);
}
template
inline void cfHue(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal sat = getSaturation(dr, dg, db);
TReal lum = getLightness(dr, dg, db);
dr = sr;
dg = sg;
db = sb;
setSaturation(dr, dg, db, sat);
setLightness(dr, dg, db, lum);
}
template
inline void cfTangentNormalmap(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
using namespace Arithmetic;
TReal half=halfValue();
dr = sr+(dr-half);
dg = sg+(dg-half);
db = sb+(db-unitValue());
}
template
inline void cfDarkerColor(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal lum = getLightness(dr, dg, db);
TReal lum2 = getLightness(sr, sg, sb);
if (lum
inline void cfLighterColor(TReal sr, TReal sg, TReal sb, TReal& dr, TReal& dg, TReal& db) {
TReal lum = getLightness(dr, dg, db);
TReal lum2 = getLightness(sr, sg, sb);
if (lum>lum2) {
sr = dr;
sg = dg;
sb = db;
}
else {
dr = sr;
dg = sg;
db = sb;
}
}
template
inline T cfColorBurn(T src, T dst) {
using namespace Arithmetic;
if(dst == unitValue())
return unitValue();
T invDst = inv(dst);
if(src < invDst)
return zeroValue();
return inv(clamp(div(invDst, src)));
}
template
inline T cfLinearBurn(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
return clamp(composite_type(src) + dst - unitValue());
}
template
inline T cfColorDodge(T src, T dst) {
using namespace Arithmetic;
if(dst == zeroValue())
return zeroValue();
T invSrc = inv(src);
if(invSrc < dst)
return unitValue();
return Arithmetic::clamp(div(dst, invSrc));
}
template
inline T cfAddition(T src, T dst) {
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
return Arithmetic::clamp(composite_type(src) + dst);
}
template
inline T cfSubtract(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
return clamp(composite_type(dst) - src);
}
template
inline T cfInverseSubtract(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
return clamp(composite_type(dst) - inv(src));
}
template
inline T cfExclusion(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
composite_type x = mul(src, dst);
return clamp(composite_type(dst) + src - (x + x));
}
template
inline T cfDivide(T src, T dst) {
using namespace Arithmetic;
//typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
if(src == zeroValue())
return (dst == zeroValue()) ? zeroValue() : unitValue();
return clamp(div(dst, src));
}
template
inline T cfHardLight(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
composite_type src2 = composite_type(src) + src;
if(src > halfValue()) {
// screen(src*2.0 - 1.0, dst)
src2 -= unitValue();
return T((src2+dst) - (src2*dst / unitValue()));
}
// multiply(src*2.0, dst)
return clamp(src2*dst / unitValue());
}
template
inline T cfSoftLightSvg(T src, T dst) {
using namespace Arithmetic;
qreal fsrc = scale(src);
qreal fdst = scale(dst);
if(fsrc > 0.5f) {
qreal D = (fdst > 0.25f) ? sqrt(fdst) : ((16.0f*fdst - 12.0)*fdst + 4.0f)*fdst;
return scale(fdst + (2.0f*fsrc - 1.0f) * (D - fdst));
}
return scale(fdst - (1.0f - 2.0f * fsrc) * fdst * (1.0f - fdst));
}
template
inline T cfSoftLight(T src, T dst) {
using namespace Arithmetic;
qreal fsrc = scale(src);
qreal fdst = scale(dst);
if(fsrc > 0.5f) {
return scale(fdst + (2.0f * fsrc - 1.0f) * (sqrt(fdst) - fdst));
}
return scale(fdst - (1.0f - 2.0f*fsrc) * fdst * (1.0f - fdst));
}
template
inline T cfVividLight(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
if(src < halfValue()) {
if(src == zeroValue())
return (dst == unitValue()) ? unitValue() : zeroValue();
// min(1,max(0,1-(1-dst) / (2*src)))
composite_type src2 = composite_type(src) + src;
composite_type dsti = inv(dst);
return clamp(unitValue() - (dsti * unitValue() / src2));
}
if(src == unitValue())
return (dst == zeroValue()) ? zeroValue() : unitValue();
// min(1,max(0, dst / (2*(1-src)))
composite_type srci2 = inv(src);
srci2 += srci2;
return clamp(composite_type(dst) * unitValue() / srci2);
}
template
inline T cfPinLight(T src, T dst) {
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
// TODO: verify that the formula is correct (the first max would be useless here)
// max(0, max(2*src-1, min(dst, 2*src)))
composite_type src2 = composite_type(src) + src;
composite_type a = qMin(dst, src2);
composite_type b = qMax(src2-Arithmetic::unitValue(), a);
return T(b);
}
template
inline T cfArcTangent(T src, T dst) {
using namespace Arithmetic;
if(dst == zeroValue())
return (src == zeroValue()) ? zeroValue() : unitValue();
return scale(2.0 * atan(scale(src) / scale(dst)) / Arithmetic::pi);
}
template
inline T cfAllanon(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
// (dst + src) / 2 [or (dst + src) * 0.5]
return T((composite_type(src) + dst) * halfValue() / unitValue());
}
template
inline T cfLinearLight(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
// min(1,max(0,(dst + 2*src)-1))
return clamp((composite_type(src) + src + dst) - unitValue());
}
template
inline T cfParallel(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
// min(max(2 / (1/dst + 1/src), 0), 1)
composite_type unit = unitValue();
composite_type s = (src != zeroValue()) ? div(unit, src) : unit;
composite_type d = (dst != zeroValue()) ? div(unit, dst) : unit;
return clamp((unit+unit) * unit / (d+s));
}
template
inline T cfEquivalence(T src, T dst) {
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
// 1 - abs(dst - src)
composite_type x = composite_type(dst) - src;
return (x < Arithmetic::zeroValue()) ? T(-x) : T(x);
}
template
inline T cfGrainMerge(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
return clamp(composite_type(dst) + src - halfValue());
}
template
inline T cfGrainExtract(T src, T dst) {
using namespace Arithmetic;
typedef typename KoColorSpaceMathsTraits::compositetype composite_type;
return clamp(composite_type(dst) - src + halfValue());
}
template
inline T cfHardMix(T src, T dst) {
return (dst > Arithmetic::halfValue()) ? cfColorDodge(src,dst) : cfColorBurn(src,dst);
}
template
inline T cfAdditiveSubtractive(T src, T dst) {
using namespace Arithmetic;
// min(1,max(0,abs(sqr(CB)-sqr(CT))))
qreal x = sqrt(scale(dst)) - sqrt(scale(src));
return scale((x < 0.0) ? -x : x);
}
template
inline T cfGammaDark(T src, T dst) {
using namespace Arithmetic;
if(src == zeroValue())
return zeroValue();
// power(dst, 1/src)
return scale(pow(scale(dst), 1.0/scale(src)));
}
template
inline T cfGammaLight(T src, T dst) {
using namespace Arithmetic;
return scale(pow(scale(dst), scale(src)));
}
template
inline T cfGeometricMean(T src, T dst) {
using namespace Arithmetic;
return scale(sqrt(scale(dst) * scale(src)));
}
template
inline T cfOver(T src, T dst) { Q_UNUSED(dst); return src; }
template
inline T cfOverlay(T src, T dst) { return cfHardLight(dst, src); }
template
inline T cfMultiply(T src, T dst) { return Arithmetic::mul(src, dst); }
+template
+inline T cfHardOverlay(T src, T dst) {
+ using namespace Arithmetic;
+
+ qreal fsrc = scale(src);
+ qreal fdst = scale(dst);
+
+ if(fsrc > 0.5f) {
+ return scale(cfDivide(inv(2.0 * fsrc - 1.0f), fdst));
+ }
+ return scale(mul(2.0 * fsrc, fdst));
+}
+
template
inline T cfDifference(T src, T dst) { return qMax(src,dst) - qMin(src,dst); }
template
inline T cfScreen(T src, T dst) { return Arithmetic::unionShapeOpacity(src, dst); }
template
inline T cfDarkenOnly(T src, T dst) { return qMin(src, dst); }
template
inline T cfLightenOnly(T src, T dst) { return qMax(src, dst); }
#endif // KOCOMPOSITEOP_FUNCTIONS_H_
diff --git a/libs/pigment/compositeops/KoCompositeOps.h b/libs/pigment/compositeops/KoCompositeOps.h
index e5fa0a5f44..827e35ba11 100644
--- a/libs/pigment/compositeops/KoCompositeOps.h
+++ b/libs/pigment/compositeops/KoCompositeOps.h
@@ -1,243 +1,244 @@
/*
* Copyright (c) 2007 Cyrille Berger
* Copyright (c) 2011 Silvio Heinrich
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _KOCOMPOSITEOPS_H_
#define _KOCOMPOSITEOPS_H_
#include
#include
#include
#include
#include "compositeops/KoCompositeOpGeneric.h"
#include "compositeops/KoCompositeOpOver.h"
#include "compositeops/KoCompositeOpCopyChannel.h"
#include "compositeops/KoCompositeOpAlphaDarken.h"
#include "compositeops/KoCompositeOpErase.h"
#include "compositeops/KoCompositeOpCopy2.h"
#include "compositeops/KoCompositeOpDissolve.h"
#include "compositeops/KoCompositeOpBehind.h"
#include "compositeops/KoCompositeOpGreater.h"
#include "KoOptimizedCompositeOpFactory.h"
namespace _Private {
template
struct AddGeneralOps
{
static void add(KoColorSpace* cs) { Q_UNUSED(cs); }
};
template
struct OptimizedOpsSelector
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return new KoCompositeOpAlphaDarken(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return new KoCompositeOpOver(cs);
}
};
template<>
struct OptimizedOpsSelector
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createAlphaDarkenOp32(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createOverOp32(cs);
}
};
template<>
struct OptimizedOpsSelector
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createAlphaDarkenOp32(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createOverOp32(cs);
}
};
template<>
struct OptimizedOpsSelector
{
static KoCompositeOp* createAlphaDarkenOp(const KoColorSpace *cs) {
return new KoCompositeOpAlphaDarken(cs);
}
static KoCompositeOp* createOverOp(const KoColorSpace *cs) {
return KoOptimizedCompositeOpFactory::createOverOp128(cs);
}
};
template
struct AddGeneralOps
{
typedef typename Traits::channels_type Arg;
typedef Arg (*CompositeFunc)(Arg, Arg);
static const qint32 alpha_pos = Traits::alpha_pos;
template
static void add(KoColorSpace* cs, const QString& id, const QString& description, const QString& category) {
cs->addCompositeOp(new KoCompositeOpGenericSC(cs, id, description, category));
}
static void add(KoColorSpace* cs) {
cs->addCompositeOp(OptimizedOpsSelector::createOverOp(cs));
cs->addCompositeOp(OptimizedOpsSelector::createAlphaDarkenOp(cs));
cs->addCompositeOp(new KoCompositeOpCopy2(cs));
cs->addCompositeOp(new KoCompositeOpErase(cs));
cs->addCompositeOp(new KoCompositeOpBehind(cs));
cs->addCompositeOp(new KoCompositeOpGreater(cs));
add<&cfOverlay >(cs, COMPOSITE_OVERLAY , i18n("Overlay") , KoCompositeOp::categoryMix());
add<&cfGrainMerge >(cs, COMPOSITE_GRAIN_MERGE , i18n("Grain Merge") , KoCompositeOp::categoryMix());
add<&cfGrainExtract >(cs, COMPOSITE_GRAIN_EXTRACT , i18n("Grain Extract") , KoCompositeOp::categoryMix());
add<&cfHardMix >(cs, COMPOSITE_HARD_MIX , i18n("Hard Mix") , KoCompositeOp::categoryMix());
add<&cfGeometricMean >(cs, COMPOSITE_GEOMETRIC_MEAN, i18n("Geometric Mean"), KoCompositeOp::categoryMix());
add<&cfParallel >(cs, COMPOSITE_PARALLEL , i18n("Parallel") , KoCompositeOp::categoryMix());
add<&cfAllanon >(cs, COMPOSITE_ALLANON , i18n("Allanon") , KoCompositeOp::categoryMix());
+ add<&cfHardOverlay >(cs, COMPOSITE_HARD_OVERLAY , i18n("Hard Overlay") , KoCompositeOp::categoryMix());
add<&cfScreen >(cs, COMPOSITE_SCREEN , i18n("Screen") , KoCompositeOp::categoryLight());
add<&cfColorDodge >(cs, COMPOSITE_DODGE , i18n("Color Dodge") , KoCompositeOp::categoryLight());
add<&cfAddition >(cs, COMPOSITE_LINEAR_DODGE, i18n("Linear Dodge"), KoCompositeOp::categoryLight());
add<&cfLightenOnly >(cs, COMPOSITE_LIGHTEN , i18n("Lighten") , KoCompositeOp::categoryLight());
add<&cfHardLight >(cs, COMPOSITE_HARD_LIGHT , i18n("Hard Light") , KoCompositeOp::categoryLight());
add<&cfSoftLightSvg >(cs, COMPOSITE_SOFT_LIGHT_SVG, i18n("Soft Light (SVG)") , KoCompositeOp::categoryLight());
add<&cfSoftLight >(cs, COMPOSITE_SOFT_LIGHT_PHOTOSHOP, i18n("Soft Light (Photoshop)") , KoCompositeOp::categoryLight());
add<&cfGammaLight >(cs, COMPOSITE_GAMMA_LIGHT , i18n("Gamma Light") , KoCompositeOp::categoryLight());
add<&cfVividLight >(cs, COMPOSITE_VIVID_LIGHT , i18n("Vivid Light") , KoCompositeOp::categoryLight());
add<&cfPinLight >(cs, COMPOSITE_PIN_LIGHT , i18n("Pin Light") , KoCompositeOp::categoryLight());
add<&cfLinearLight >(cs, COMPOSITE_LINEAR_LIGHT, i18n("Linear Light"), KoCompositeOp::categoryLight());
add<&cfColorBurn >(cs, COMPOSITE_BURN , i18n("Color Burn") , KoCompositeOp::categoryDark());
add<&cfLinearBurn >(cs, COMPOSITE_LINEAR_BURN , i18n("Linear Burn"), KoCompositeOp::categoryDark());
add<&cfDarkenOnly >(cs, COMPOSITE_DARKEN , i18n("Darken") , KoCompositeOp::categoryDark());
add<&cfGammaDark >(cs, COMPOSITE_GAMMA_DARK , i18n("Gamma Dark") , KoCompositeOp::categoryDark());
add<&cfAddition >(cs, COMPOSITE_ADD , i18n("Addition") , KoCompositeOp::categoryArithmetic());
add<&cfSubtract >(cs, COMPOSITE_SUBTRACT , i18n("Subtract") , KoCompositeOp::categoryArithmetic());
add<&cfInverseSubtract >(cs, COMPOSITE_INVERSE_SUBTRACT, i18n("Inversed-Subtract"), KoCompositeOp::categoryArithmetic());
add<&cfMultiply >(cs, COMPOSITE_MULT , i18n("Multiply") , KoCompositeOp::categoryArithmetic());
add<&cfDivide >(cs, COMPOSITE_DIVIDE , i18n("Divide") , KoCompositeOp::categoryArithmetic());
add<&cfArcTangent >(cs, COMPOSITE_ARC_TANGENT , i18n("Arcus Tangent") , KoCompositeOp::categoryNegative());
add<&cfDifference