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
143a3179
Commit
143a3179
authored
May 05, 2014
by
Ryan LeFevre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add global mask parsing
parent
d9eb995e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
parse.js
examples/parse.js
+2
-1
layer_mask.coffee
lib/psd/layer_mask.coffee
+21
-1
No files found.
examples/parse.js
View file @
143a3179
...
...
@@ -2,7 +2,8 @@ var PSD = require('../');
psd
=
PSD
.
open
(
'./examples/images/example.psd'
,
function
(
psd
)
{
console
.
log
(
psd
.
header
.
export
());
console
.
log
(
psd
.
tree
().
children
()[
0
].
children
()[
0
].
nextSibling
().
export
());
console
.
log
(
psd
.
tree
().
export
());
console
.
log
(
psd
.
layerMask
.
globalMask
);
});
// psd.image.saveAsPng('./output.png').then(function () {
// console.log("Finished!");
...
...
lib/psd/layer_mask.coffee
View file @
143a3179
...
...
@@ -35,4 +35,24 @@ module.exports = class LayerMask
for
i
in
[
0
...
layerCount
]
@
layers
.
push
new
Layer
(
@
file
,
@
header
).
parse
()
parseGlobalMask
:
->
\ No newline at end of file
parseGlobalMask
:
->
length
=
@
file
.
readInt
()
return
if
length
<=
0
maskEnd
=
@
file
.
tell
()
+
length
@
globalMask
=
_
({}).
tap
(
mask
)
->
mask
.
overlayColorSpace
=
@
file
.
readShort
()
mask
.
colorComponents
=
[
@
file
.
readShort
()
>>
8
@
file
.
readShort
()
>>
8
@
file
.
readShort
()
>>
8
@
file
.
readShort
()
>>
8
]
mask
.
opacity
=
@
file
.
readShort
()
/
16.0
# 0 = color selected, 1 = color protected, 128 = use value per layer
mask
.
kind
=
@
file
.
readByte
()
@
file
.
seek
maskEnd
\ 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