Krita Source Code Documentation
Loading...
Searching...
No Matches
psd.cpp File Reference
#include "psd.h"
#include <QPoint>
#include <kis_debug.h>
#include <KoColorModelStandardIds.h>
#include <KoCompositeOpRegistry.h>
#include "kis_global.h"

Go to the source code of this file.

Functions

QString composite_op_to_psd_blendmode (const QString &compositeop)
 
QString psd_blendmode_to_composite_op (const QString &blendmode)
 
QPair< QString, QString > psd_colormode_to_colormodelid (psd_color_mode colormode, quint16 channelDepth)
 

Function Documentation

◆ composite_op_to_psd_blendmode()

QString composite_op_to_psd_blendmode ( const QString & compositeop)

Definition at line 150 of file psd.cpp.

151{
152 // 'pass' = pass through
153 if (compositeop == COMPOSITE_PASS_THROUGH)
154 return "pass";
155 // 'norm' = normal
156 if (compositeop == COMPOSITE_OVER)
157 return "norm";
158 // 'diss' = dissolve
159 if (compositeop == COMPOSITE_DISSOLVE)
160 return "diss";
161 // 'dark' = darken
162 if (compositeop == COMPOSITE_DARKEN)
163 return "dark";
164 // 'mul ' = multiply
165 if (compositeop == COMPOSITE_MULT)
166 return "mul ";
167 // 'idiv' = color burn
168 if (compositeop == COMPOSITE_BURN)
169 return "idiv";
170 // 'lbrn' = linear burn
171 if (compositeop == COMPOSITE_LINEAR_BURN)
172 return "lbrn";
173 // 'dkCl' = darker color
174 if (compositeop == COMPOSITE_DARKER_COLOR)
175 return "dkCl";
176 // 'lite' = lighten
177 if (compositeop == COMPOSITE_LIGHTEN)
178 return "lite";
179 // 'scrn' = screen
180 if (compositeop == COMPOSITE_SCREEN)
181 return "scrn";
182 // 'div ' = color dodge
183 if (compositeop == COMPOSITE_DODGE)
184 return "div ";
185 // 'lddg' = linear dodge
186 if (compositeop == COMPOSITE_LINEAR_DODGE)
187 return "lddg";
188 // 'lgCl' = lighter color
189 if (compositeop == COMPOSITE_LIGHTER_COLOR)
190 return "lgCl";
191 // 'over' = overlay
192 if (compositeop == COMPOSITE_OVERLAY)
193 return "over";
194 // 'sLit' = soft light
195 if (compositeop == COMPOSITE_SOFT_LIGHT_PHOTOSHOP)
196 return "sLit";
197 if (compositeop == COMPOSITE_SOFT_LIGHT_SVG)
198 return "sLit";
199 // 'hLit' = hard light
200 if (compositeop == COMPOSITE_HARD_LIGHT)
201 return "hLit";
202 // 'vLit' = vivid light
203 if (compositeop == COMPOSITE_VIVID_LIGHT)
204 return "vLit";
205 // 'lLit' = linear light
206 if (compositeop == COMPOSITE_LINEAR_LIGHT)
207 return "lLit";
208 // 'pLit' = pin light
209 if (compositeop == COMPOSITE_PIN_LIGHT)
210 return "pLit";
211 // 'hMix' = hard mix
212 if (compositeop == COMPOSITE_HARD_MIX_PHOTOSHOP)
213 return "hMix";
214 // 'diff' = difference
215 if (compositeop == COMPOSITE_DIFF)
216 return "diff";
217 // 'smud' = exclusion
218 if (compositeop == COMPOSITE_EXCLUSION)
219 return "smud";
220 // 'fsub' = subtract
221 if (compositeop == COMPOSITE_SUBTRACT)
222 return "fsub";
223 // 'fdiv' = divide
224 if (compositeop == COMPOSITE_DIVIDE)
225 return "fdiv";
226 // 'hue ' = hue
227 if (compositeop == COMPOSITE_HUE)
228 return "hue ";
229 // 'sat ' = saturation
230 if (compositeop == COMPOSITE_SATURATION)
231 return "sat ";
232 // 'colr' = color
233 if (compositeop == COMPOSITE_COLOR)
234 return "colr";
235 // 'lum ' = luminosity
236 if (compositeop == COMPOSITE_LUMINIZE)
237 return "lum ";
238
239 dbgKrita << "Krita blending mode" << compositeop << "does not exist in Photoshop, returning Normal";
240 return "norm";
241}
const QString COMPOSITE_OVER
const QString COMPOSITE_DARKEN
const QString COMPOSITE_OVERLAY
const QString COMPOSITE_DIVIDE
const QString COMPOSITE_DODGE
const QString COMPOSITE_SOFT_LIGHT_SVG
const QString COMPOSITE_LIGHTEN
const QString COMPOSITE_LINEAR_BURN
const QString COMPOSITE_SOFT_LIGHT_PHOTOSHOP
const QString COMPOSITE_LIGHTER_COLOR
const QString COMPOSITE_MULT
const QString COMPOSITE_SATURATION
const QString COMPOSITE_LINEAR_LIGHT
const QString COMPOSITE_HARD_LIGHT
const QString COMPOSITE_SCREEN
const QString COMPOSITE_PIN_LIGHT
const QString COMPOSITE_DIFF
const QString COMPOSITE_HUE
const QString COMPOSITE_SUBTRACT
const QString COMPOSITE_DISSOLVE
const QString COMPOSITE_BURN
const QString COMPOSITE_LINEAR_DODGE
const QString COMPOSITE_COLOR
const QString COMPOSITE_EXCLUSION
const QString COMPOSITE_DARKER_COLOR
const QString COMPOSITE_VIVID_LIGHT
const QString COMPOSITE_LUMINIZE
const QString COMPOSITE_HARD_MIX_PHOTOSHOP
const QString COMPOSITE_PASS_THROUGH
#define dbgKrita
Definition kis_debug.h:45

References COMPOSITE_BURN, COMPOSITE_COLOR, COMPOSITE_DARKEN, COMPOSITE_DARKER_COLOR, COMPOSITE_DIFF, COMPOSITE_DISSOLVE, COMPOSITE_DIVIDE, COMPOSITE_DODGE, COMPOSITE_EXCLUSION, COMPOSITE_HARD_LIGHT, COMPOSITE_HARD_MIX_PHOTOSHOP, COMPOSITE_HUE, COMPOSITE_LIGHTEN, COMPOSITE_LIGHTER_COLOR, COMPOSITE_LINEAR_BURN, COMPOSITE_LINEAR_DODGE, COMPOSITE_LINEAR_LIGHT, COMPOSITE_LUMINIZE, COMPOSITE_MULT, COMPOSITE_OVER, COMPOSITE_OVERLAY, COMPOSITE_PASS_THROUGH, COMPOSITE_PIN_LIGHT, COMPOSITE_SATURATION, COMPOSITE_SCREEN, COMPOSITE_SOFT_LIGHT_PHOTOSHOP, COMPOSITE_SOFT_LIGHT_SVG, COMPOSITE_SUBTRACT, COMPOSITE_VIVID_LIGHT, and dbgKrita.

◆ psd_blendmode_to_composite_op()

QString psd_blendmode_to_composite_op ( const QString & blendmode)

Convert the Photoshop blend mode strings to Pigment compositeop id's

Definition at line 59 of file psd.cpp.

60{
61 // 'pass' = pass through
62 if (blendmode == "pass")
64 // 'norm' = normal
65 if (blendmode == "norm")
66 return COMPOSITE_OVER;
67 // 'diss' = dissolve
68 if (blendmode == "diss")
69 return COMPOSITE_DISSOLVE;
70 // 'dark' = darken
71 if (blendmode == "dark")
72 return COMPOSITE_DARKEN;
73 // 'mul ' = multiply
74 if (blendmode == "mul ")
75 return COMPOSITE_MULT;
76 // 'idiv' = color burn
77 if (blendmode == "idiv")
78 return COMPOSITE_BURN;
79 // 'lbrn' = linear burn
80 if (blendmode == "lbrn")
82 // 'dkCl' = darker color
83 if (blendmode == "dkCl")
85 // 'lite' = lighten
86 if (blendmode == "lite")
87 return COMPOSITE_LIGHTEN;
88 // 'scrn' = screen
89 if (blendmode == "scrn")
90 return COMPOSITE_SCREEN;
91 // 'div ' = color dodge
92 if (blendmode == "div ")
93 return COMPOSITE_DODGE;
94 // 'lddg' = linear dodge
95 if (blendmode == "lddg")
97 // 'lgCl' = lighter color
98 if (blendmode == "lgCl")
100 // 'over' = overlay
101 if (blendmode == "over")
102 return COMPOSITE_OVERLAY;
103 // 'sLit' = soft light
104 if (blendmode == "sLit")
106 // 'hLit' = hard light
107 if (blendmode == "hLit")
109 // 'vLit' = vivid light
110 if (blendmode == "vLit")
112 // 'lLit' = linear light
113 if (blendmode == "lLit")
115 // 'pLit' = pin light
116 if (blendmode == "pLit")
117 return COMPOSITE_PIN_LIGHT;
118 // 'hMix' = hard mix
119 if (blendmode == "hMix")
121 // 'diff' = difference
122 if (blendmode == "diff")
123 return COMPOSITE_DIFF;
124 // 'smud' = exclusion
125 if (blendmode == "smud")
126 return COMPOSITE_EXCLUSION;
127 // 'fsub' = subtract
128 if (blendmode == "fsub")
129 return COMPOSITE_SUBTRACT;
130 // 'fdiv' = divide
131 if (blendmode == "fdiv")
132 return COMPOSITE_DIVIDE;
133 // 'hue ' = hue
134 if (blendmode == "hue ")
135 return COMPOSITE_HUE;
136 // 'sat ' = saturation
137 if (blendmode == "sat ")
139 // 'colr' = color
140 if (blendmode == "colr")
141 return COMPOSITE_COLOR;
142 // 'lum ' = luminosity
143 if (blendmode == "lum ")
144 return COMPOSITE_LUMINIZE;
145
146 dbgKrita << "Unknown blendmode:" << blendmode << ". Returning Normal";
147 return COMPOSITE_OVER;
148}

References COMPOSITE_BURN, COMPOSITE_COLOR, COMPOSITE_DARKEN, COMPOSITE_DARKER_COLOR, COMPOSITE_DIFF, COMPOSITE_DISSOLVE, COMPOSITE_DIVIDE, COMPOSITE_DODGE, COMPOSITE_EXCLUSION, COMPOSITE_HARD_LIGHT, COMPOSITE_HARD_MIX_PHOTOSHOP, COMPOSITE_HUE, COMPOSITE_LIGHTEN, COMPOSITE_LIGHTER_COLOR, COMPOSITE_LINEAR_BURN, COMPOSITE_LINEAR_DODGE, COMPOSITE_LINEAR_LIGHT, COMPOSITE_LUMINIZE, COMPOSITE_MULT, COMPOSITE_OVER, COMPOSITE_OVERLAY, COMPOSITE_PASS_THROUGH, COMPOSITE_PIN_LIGHT, COMPOSITE_SATURATION, COMPOSITE_SCREEN, COMPOSITE_SOFT_LIGHT_PHOTOSHOP, COMPOSITE_SUBTRACT, COMPOSITE_VIVID_LIGHT, and dbgKrita.

◆ psd_colormode_to_colormodelid()

QPair< QString, QString > psd_colormode_to_colormodelid ( psd_color_mode colormode,
quint16 channelDepth )

Convert PsdColorMode to pigment colormodelid and colordepthid.

See also
KoColorModelStandardIds
Returns
a QPair containing ColorModelId and ColorDepthID

Definition at line 16 of file psd.cpp.

17{
18 QPair<QString, QString> colorSpaceId;
19 switch (colormode) {
20 case (Bitmap):
21 case (Indexed):
22 case (MultiChannel):
23 case (RGB):
24 colorSpaceId.first = RGBAColorModelID.id();
25 break;
26 case (CMYK):
27 colorSpaceId.first = CMYKAColorModelID.id();
28 break;
29 case (Grayscale):
30 colorSpaceId.first = GrayAColorModelID.id();
31 break;
32 case (DuoTone):
33 colorSpaceId.first = GrayAColorModelID.id();
34 break;
35 case (Lab):
36 colorSpaceId.first = LABAColorModelID.id();
37 break;
38 default:
39 return colorSpaceId;
40 }
41
42 switch (channelDepth) {
43 case (1):
44 case (8):
45 colorSpaceId.second = Integer8BitsColorDepthID.id();
46 break;
47 case (16):
48 colorSpaceId.second = Integer16BitsColorDepthID.id();
49 break;
50 case (32):
51 colorSpaceId.second = Float32BitsColorDepthID.id();
52 break;
53 default:
54 break;
55 }
56 return colorSpaceId;
57}
const KoID Float32BitsColorDepthID("F32", ki18n("32-bit float/channel"))
const KoID GrayAColorModelID("GRAYA", ki18n("Grayscale/Alpha"))
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID CMYKAColorModelID("CMYKA", ki18n("CMYK/Alpha"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
QString id() const
Definition KoID.cpp:63
@ Lab
Definition psd.h:58
@ RGB
Definition psd.h:54
@ DuoTone
Definition psd.h:57
@ CMYK
Definition psd.h:55
@ Indexed
Definition psd.h:53
@ MultiChannel
Definition psd.h:56
@ Grayscale
Definition psd.h:52
@ Bitmap
Definition psd.h:51

References Bitmap, CMYK, CMYKAColorModelID, DuoTone, Float32BitsColorDepthID, GrayAColorModelID, Grayscale, KoID::id(), Indexed, Integer16BitsColorDepthID, Integer8BitsColorDepthID, Lab, LABAColorModelID, MultiChannel, RGB, and RGBAColorModelID.