Krita Source Code Documentation
Loading...
Searching...
No Matches
psd.h File Reference
#include "kritapsdutils_export.h"
#include <QPair>
#include <QString>
#include <QVector>
#include <cstdint>
#include <KoColor.h>
#include <KoColorModelStandardIds.h>
#include <KoCompositeOpRegistry.h>
#include <KoPattern.h>
#include <resources/KoAbstractGradient.h>
#include <KisResourcesInterface.h>

Go to the source code of this file.

Classes

struct  psd_gradient_color
 
struct  psd_gradient_color_stop
 
struct  psd_gradient_transparency_stop
 
struct  psd_layer_effects_bevel_emboss
 
struct  psd_layer_effects_color_overlay
 
struct  psd_layer_effects_context
 
class  psd_layer_effects_drop_shadow
 
class  psd_layer_effects_glow_common
 
struct  psd_layer_effects_gradient_overlay
 
class  psd_layer_effects_inner_glow
 
class  psd_layer_effects_inner_shadow
 
class  psd_layer_effects_outer_glow
 
struct  psd_layer_effects_overlay_base
 
struct  psd_layer_effects_pattern_overlay
 
struct  psd_layer_effects_satin
 
class  psd_layer_effects_shadow_base
 
class  psd_layer_effects_shadow_common
 
struct  psd_layer_effects_stroke
 
struct  psd_layer_gradient_map
 
struct  psd_pattern
 
struct  PsdResource
 

Namespaces

namespace  psd_color_sampler
 

Macros

#define PSD_LOOKUP_TABLE_SIZE   256
 

Typedefs

typedef qint32 Fixed
 

Enumerations

enum  psd_bevel_style {
  psd_bevel_outer_bevel , psd_bevel_inner_bevel , psd_bevel_emboss , psd_bevel_pillow_emboss ,
  psd_bevel_stroke_emboss
}
 
enum class  psd_byte_order : std::uint_least8_t { psdBigEndian = 0 , psdLittleEndian , psdInvalidByteOrder = 255 }
 
enum  psd_color_mode {
  Bitmap = 0 , Grayscale = 1 , Indexed = 2 , RGB = 3 ,
  CMYK = 4 , MultiChannel = 7 , DuoTone = 8 , Lab = 9 ,
  Gray16 , RGB48 , Lab48 , CMYK64 ,
  DeepMultichannel , Duotone16 , COLORMODE_UNKNOWN = 9000
}
 
enum  psd_color_stop_type { psd_color_stop_type_foreground_color , psd_color_stop_type_background_Color , psd_color_stop_type_user_stop }
 
enum  psd_compression_type : std::uint16_t {
  Uncompressed = 0 , RLE , ZIP , ZIPWithPrediction ,
  Unknown = 255
}
 
enum  psd_direction { psd_direction_up , psd_direction_down }
 
enum  psd_fill_type { psd_fill_solid_color , psd_fill_gradient , psd_fill_pattern }
 
enum  psd_glow_source { psd_glow_center , psd_glow_edge }
 
enum  psd_gradient_style {
  psd_gradient_style_linear , psd_gradient_style_radial , psd_gradient_style_angle , psd_gradient_style_reflected ,
  psd_gradient_style_diamond
}
 
enum  psd_section_type { psd_other = 0 , psd_open_folder , psd_closed_folder , psd_bounding_divider }
 
enum  psd_stroke_position { psd_stroke_outside , psd_stroke_inside , psd_stroke_center }
 
enum  psd_technique_type { psd_technique_softer , psd_technique_precise , psd_technique_slope_limit }
 
enum  psd_color_sampler::PSDColorSamplers {
  psd_color_sampler::RGB , psd_color_sampler::HSB , psd_color_sampler::CMYK , psd_color_sampler::PANTONE ,
  psd_color_sampler::FOCOLTONE , psd_color_sampler::TRUMATCH , psd_color_sampler::TOYO , psd_color_sampler::LAB ,
  psd_color_sampler::GRAYSCALE , psd_color_sampler::HKS , psd_color_sampler::DIC , psd_color_sampler::TOTAL_INK ,
  psd_color_sampler::MONITOR_RGB , psd_color_sampler::DUOTONE , psd_color_sampler::OPACITY , psd_color_sampler::ANPA = 3000
}
 

Functions

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

Variables

const int MAX_CHANNELS = 56
 
const int MAX_PSD_SIZE = 30000
 

Macro Definition Documentation

◆ PSD_LOOKUP_TABLE_SIZE

#define PSD_LOOKUP_TABLE_SIZE   256

Definition at line 220 of file psd.h.

Typedef Documentation

◆ Fixed

typedef qint32 Fixed

Definition at line 31 of file psd.h.

Enumeration Type Documentation

◆ psd_bevel_style

Enumerator
psd_bevel_outer_bevel 
psd_bevel_inner_bevel 
psd_bevel_emboss 
psd_bevel_pillow_emboss 
psd_bevel_stroke_emboss 

Definition at line 134 of file psd.h.

134 {
140};
@ psd_bevel_pillow_emboss
Definition psd.h:138
@ psd_bevel_inner_bevel
Definition psd.h:136
@ psd_bevel_stroke_emboss
Definition psd.h:139
@ psd_bevel_outer_bevel
Definition psd.h:135
@ psd_bevel_emboss
Definition psd.h:137

◆ psd_byte_order

enum class psd_byte_order : std::uint_least8_t
strong
Enumerator
psdBigEndian 
psdLittleEndian 
psdInvalidByteOrder 

Definition at line 33 of file psd.h.

33 : std::uint_least8_t {
34 psdBigEndian = 0,
37};

◆ psd_color_mode

Image color/depth modes

Enumerator
Bitmap 
Grayscale 
Indexed 
RGB 
CMYK 
MultiChannel 
DuoTone 
Lab 
Gray16 
RGB48 
Lab48 
CMYK64 
DeepMultichannel 
Duotone16 
COLORMODE_UNKNOWN 

Definition at line 50 of file psd.h.

50 {
51 Bitmap = 0,
52 Grayscale = 1,
53 Indexed = 2,
54 RGB = 3,
55 CMYK = 4,
56 MultiChannel = 7,
57 DuoTone = 8,
58 Lab = 9,
59 Gray16,
60 RGB48,
61 Lab48,
62 CMYK64,
66};
@ CMYK64
Definition psd.h:62
@ Lab
Definition psd.h:58
@ RGB
Definition psd.h:54
@ DuoTone
Definition psd.h:57
@ RGB48
Definition psd.h:60
@ Duotone16
Definition psd.h:64
@ CMYK
Definition psd.h:55
@ COLORMODE_UNKNOWN
Definition psd.h:65
@ Gray16
Definition psd.h:59
@ Indexed
Definition psd.h:53
@ MultiChannel
Definition psd.h:56
@ DeepMultichannel
Definition psd.h:63
@ Grayscale
Definition psd.h:52
@ Bitmap
Definition psd.h:51
@ Lab48
Definition psd.h:61

◆ psd_color_stop_type

Enumerator
psd_color_stop_type_foreground_color 
psd_color_stop_type_background_Color 
psd_color_stop_type_user_stop 

Definition at line 109 of file psd.h.

109 {
113};
@ psd_color_stop_type_background_Color
Definition psd.h:111
@ psd_color_stop_type_foreground_color
Definition psd.h:110
@ psd_color_stop_type_user_stop
Definition psd.h:112

◆ psd_compression_type

enum psd_compression_type : std::uint16_t
Enumerator
Uncompressed 
RLE 
ZIP 
ZIPWithPrediction 
Unknown 

Definition at line 39 of file psd.h.

39 : std::uint16_t {
40 Uncompressed = 0,
41 RLE,
42 ZIP,
44 Unknown = 255,
45};
@ RLE
Definition psd.h:41
@ Unknown
Definition psd.h:44
@ ZIPWithPrediction
Definition psd.h:43
@ Uncompressed
Definition psd.h:40
@ ZIP
Definition psd.h:42

◆ psd_direction

Enumerator
psd_direction_up 
psd_direction_down 

Definition at line 142 of file psd.h.

@ psd_direction_up
Definition psd.h:142
@ psd_direction_down
Definition psd.h:142

◆ psd_fill_type

Enumerator
psd_fill_solid_color 
psd_fill_gradient 
psd_fill_pattern 

Definition at line 123 of file psd.h.

123 {
127};
@ psd_fill_solid_color
Definition psd.h:124
@ psd_fill_gradient
Definition psd.h:125
@ psd_fill_pattern
Definition psd.h:126

◆ psd_glow_source

Enumerator
psd_glow_center 
psd_glow_edge 

Definition at line 129 of file psd.h.

129 {
132};
@ psd_glow_edge
Definition psd.h:131
@ psd_glow_center
Definition psd.h:130

◆ psd_gradient_style

Enumerator
psd_gradient_style_linear 
psd_gradient_style_radial 
psd_gradient_style_angle 
psd_gradient_style_reflected 
psd_gradient_style_diamond 

Definition at line 101 of file psd.h.

101 {
104 psd_gradient_style_angle, // 'Angl'
107};
@ psd_gradient_style_linear
Definition psd.h:102
@ psd_gradient_style_reflected
Definition psd.h:105
@ psd_gradient_style_angle
Definition psd.h:104
@ psd_gradient_style_radial
Definition psd.h:103
@ psd_gradient_style_diamond
Definition psd.h:106

◆ psd_section_type

Enumerator
psd_other 
psd_open_folder 
psd_closed_folder 
psd_bounding_divider 

Definition at line 144 of file psd.h.

@ psd_other
Definition psd.h:144
@ psd_open_folder
Definition psd.h:144
@ psd_closed_folder
Definition psd.h:144
@ psd_bounding_divider
Definition psd.h:144

◆ psd_stroke_position

Enumerator
psd_stroke_outside 
psd_stroke_inside 
psd_stroke_center 

Definition at line 121 of file psd.h.

@ psd_stroke_outside
Definition psd.h:121
@ psd_stroke_inside
Definition psd.h:121
@ psd_stroke_center
Definition psd.h:121

◆ psd_technique_type

Enumerator
psd_technique_softer 
psd_technique_precise 
psd_technique_slope_limit 

Definition at line 115 of file psd.h.

115 {
119};
@ psd_technique_softer
Definition psd.h:116
@ psd_technique_precise
Definition psd.h:117
@ psd_technique_slope_limit
Definition psd.h:118

Function Documentation

◆ composite_op_to_psd_blendmode()

QString KRITAPSDUTILS_EXPORT 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 KRITAPSDUTILS_EXPORT 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 > KRITAPSDUTILS_EXPORT 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

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

Variable Documentation

◆ MAX_CHANNELS

const int MAX_CHANNELS = 56

Definition at line 27 of file psd.h.

◆ MAX_PSD_SIZE

const int MAX_PSD_SIZE = 30000

Definition at line 29 of file psd.h.