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
c895ffd7
Commit
c895ffd7
authored
Jul 21, 2014
by
Ryan LeFevre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start on channel image parsing
parent
7998c9a7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
3 deletions
+66
-3
channel_image.coffee
lib/psd/channel_image.coffee
+52
-0
layer.coffee
lib/psd/layer.coffee
+2
-2
channel_image.coffee
lib/psd/layer/channel_image.coffee
+9
-0
layer_mask.coffee
lib/psd/layer_mask.coffee
+3
-1
No files found.
lib/psd/channel_image.coffee
0 → 100644
View file @
c895ffd7
_
=
require
'lodash'
Image
=
require
'./image.coffee'
module
.
exports
=
class
ChannelImage
extends
Image
constructor
:
(
file
,
header
,
@
layer
)
->
@
width
=
@
layer
.
width
@
height
=
@
layer
.
height
super
(
file
,
header
)
@
channelsInfo
=
@
layer
.
channelsInfo
@
hasMask
=
_
.
any
@
channelsInfo
,
(
c
)
->
c
.
id
<
-
1
@
opacity
=
@
layer
.
opacity
/
255.0
@
maskData
=
[]
skip
:
->
for
chan
in
@
channelsInfo
@
file
.
seek
chan
.
length
,
true
channels
:
->
@
layer
.
channels
parse
:
->
@
chanPos
=
0
for
chan
in
@
channelsInfo
if
chan
.
length
<=
0
@
parseCompression
()
continue
@
chan
=
chan
if
chan
.
id
<
-
1
@
width
=
@
layer
.
mask
.
width
@
height
=
@
layer
.
mask
.
height
else
@
width
=
@
layer
.
width
@
height
=
@
layer
.
height
@
length
=
@
width
*
@
height
start
=
@
file
.
tell
()
@
parseImageData
()
finish
=
@
file
.
tell
()
if
finish
isnt
start
+
@
chan
.
length
@
file
.
seek
(
start
+
@
chan
.
length
)
@
width
=
@
layer
.
width
@
height
=
@
layer
.
height
@
processImageData
()
lib/psd/layer.coffee
View file @
c895ffd7
...
...
@@ -8,7 +8,7 @@ module.exports = class Layer extends Module
@
includes
require
(
'./layer/name.coffee'
)
@
includes
require
(
'./layer/info.coffee'
)
@
includes
require
(
'./layer/helpers.coffee'
)
#
@includes require('./layer/channel_image.coffee')
@
includes
require
(
'./layer/channel_image.coffee'
)
constructor
:
(
@
file
,
@
header
)
->
@
mask
=
{}
...
...
lib/psd/layer/channel_image.coffee
0 → 100644
View file @
c895ffd7
ChannelImage
=
require
'../channel_image.coffee'
module
.
exports
=
parseChannelImage
:
->
image
=
new
ChannelImage
(
@
file
,
@
header
,
@
)
@
image
=
new
LazyExecute
(
image
,
@
file
)
.
now
(
'skip'
)
.
later
(
'parse'
)
.
get
()
lib/psd/layer_mask.coffee
View file @
c895ffd7
...
...
@@ -36,6 +36,8 @@ module.exports = class LayerMask
for
i
in
[
0
...
layerCount
]
@
layers
.
push
new
Layer
(
@
file
,
@
header
).
parse
()
layer
.
parseChannelImage
()
for
layer
in
@
layers
parseGlobalMask
:
->
length
=
@
file
.
readInt
()
return
if
length
<=
0
...
...
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