Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psd.js
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
regiostart
psd.js
Commits
28ac2075
Commit
28ac2075
authored
Apr 15, 2014
by
Ryan LeFevre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Name, blending ranges, mask data
parent
32ef374a
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
1 deletion
+89
-1
file.coffee
lib/psd/file.coffee
+1
-1
layer.coffee
lib/psd/layer.coffee
+3
-0
blending_ranges.coffee
lib/psd/layer/blending_ranges.coffee
+23
-0
mask.coffee
lib/psd/layer/mask.coffee
+5
-0
name.coffee
lib/psd/layer/name.coffee
+13
-0
mask.coffee
lib/psd/mask.coffee
+44
-0
No files found.
lib/psd/file.coffee
View file @
28ac2075
...
...
@@ -37,5 +37,5 @@ module.exports = class File
seek
:
(
amt
,
rel
=
false
)
->
if
rel
then
@
pos
+=
amt
else
@
pos
=
amt
readString
:
(
length
)
->
@
read
(
length
).
toString
()
readString
:
(
length
)
->
@
read
(
length
).
toString
()
.
replace
/\u0000/g
,
''
readByte
:
->
@
read
(
1
)[
0
]
\ No newline at end of file
lib/psd/layer.coffee
View file @
28ac2075
...
...
@@ -5,6 +5,7 @@ module.exports = class Layer extends Module
@
includes
require
(
'./layer/blend_modes.coffee'
)
@
includes
require
(
'./layer/mask.coffee'
)
@
includes
require
(
'./layer/blending_ranges.coffee'
)
@
includes
require
(
'./layer/name.coffee'
)
# @includes require('./layer/channel_image.coffee')
constructor
:
(
@
file
,
@
header
)
->
...
...
@@ -26,11 +27,13 @@ module.exports = class Layer extends Module
@
parseMaskData
()
@
parseBlendingRanges
()
@
parseLegacyLayerName
()
@
file
.
seek
@
layerEnd
return
@
export
:
->
name
:
@
name
top
:
@
top
right
:
@
right
bottom
:
@
bottom
...
...
lib/psd/layer/blending_ranges.coffee
0 → 100644
View file @
28ac2075
module
.
exports
=
parseBlendingRanges
:
->
length
=
@
file
.
readInt
()
@
blendingRanges
.
grey
=
source
:
black
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
white
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
dest
:
black
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
white
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
numChannels
=
(
length
-
8
)
/
8
@
blendingRanges
.
channels
=
[]
for
i
in
[
0
...
numChannels
]
@
blendingRanges
.
channels
.
push
source
:
black
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
white
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
dest
:
black
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
white
:
[
@
file
.
readByte
(),
@
file
.
readByte
()]
\ No newline at end of file
lib/psd/layer/mask.coffee
0 → 100644
View file @
28ac2075
Mask
=
require
'../mask.coffee'
module
.
exports
=
parseMaskData
:
->
@
mask
=
new
Mask
(
@
file
).
parse
()
\ No newline at end of file
lib/psd/layer/name.coffee
0 → 100644
View file @
28ac2075
Util
=
require
'../util.coffee'
module
.
exports
=
parseLegacyLayerName
:
->
len
=
Util
.
pad4
@
file
.
readByte
()
@
legacyName
=
@
file
.
readString
(
len
)
Object
.
defineProperty
@
,
'name'
,
get
:
->
if
@
adjustments
[
'name'
]
?
@
adjustments
[
'name'
].
data
else
@
legacyName
\ No newline at end of file
lib/psd/mask.coffee
0 → 100644
View file @
28ac2075
module
.
exports
=
class
Mask
constructor
:
(
@
file
)
->
@
top
=
0
@
right
=
0
@
bottom
=
0
@
left
=
0
parse
:
->
@
size
=
@
file
.
readInt
()
return
@
if
@
size
is
0
maskEnd
=
@
file
.
tell
()
+
@
size
@
top
=
@
file
.
readInt
()
@
left
=
@
file
.
readInt
()
@
bottom
=
@
file
.
readInt
()
@
right
=
@
file
.
readInt
()
@
width
=
@
right
-
@
left
@
height
=
@
bottom
-
@
top
@
relative
=
(
@
flags
&
0x01
)
>
0
@
disabled
=
(
@
flags
&
(
0x01
<<
1
))
>
0
@
invert
=
(
@
flags
&
(
0x01
<<
2
))
>
0
@
defaultColor
=
@
file
.
readByte
()
@
flags
=
@
file
.
readByte
()
@
file
.
seek
maskEnd
return
@
export
:
->
return
{}
if
@
size
is
0
top
:
@
top
left
:
@
left
bottom
:
@
bottom
right
:
@
right
width
:
@
width
height
:
@
height
defaultColor
:
@
defaultColor
relative
:
@
relative
disabled
:
@
disabled
invert
:
@
invert
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment