blob: d6103dff4464d2e372c47f50ae03ef127f3bfa21 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
class PSDHueSaturation
constructor: (@layer, @length) ->
@file = @layer.file
parse: ->
version = @file.getShortInt()
assert version is 2
@data.colorization = @file.readBoolean()
@file.seek 1 # padding byte
# Photoshop 5.0 has a new hue system
# Hue is [-180, 180]
# Saturation is [0, 100]
# Lightness is [-100, 100]
#
# Photoshop 4.0 uses HSB color space
# Hue: [-100, 100]
# Saturation: [0, 100]
# Lightness: [-100, 1000]
@data.hue = @file.getShortInt()
@data.saturation = @file.getShortInt()
@data.lightness = @file.getShortInt()
@data.masterHue = @file.getShortInt()
@data.masterSaturation = @file.getShortInt()
@data.masterLightness = @file.getShortInt()
# 6 sets of 14 bytes (4 range values followed by 3 settings values)
@data.rangeValues = []
@data.settingValues = []
for i in [0...6]
@data.rangeValues[i] = []
@data.settingValues[i] = []
# For RGB and CMYK
@data.rangeValues[i][j] = @file.getShortInt() for j in [0...4]
# For Lab color
@data.settingValues[i][j] = @file.getShortInt() for j in [0...3]
@data
|