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
fe58a3f6
Commit
fe58a3f6
authored
May 10, 2014
by
Ryan LeFevre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish Descriptor implementation
parent
91584282
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2044 additions
and
22 deletions
+2044
-22
Cakefile
Cakefile
+2
-1
psd.js
dist/psd.js
+1984
-18
descriptor.coffee
lib/psd/descriptor.coffee
+58
-3
No files found.
Cakefile
View file @
fe58a3f6
...
...
@@ -13,4 +13,5 @@ task 'compile', 'Compile with browserify for the web', ->
.
bundle
(
err
,
src
)
->
return
console
.
log
(
err
)
if
err
?
fs
.
writeFile
'./dist/psd.js'
,
src
,
->
console
.
log
"Compiled to ./dist/psd.js"
\ No newline at end of file
fs
.
stat
'./dist/psd.js'
,
(
err
,
stats
)
->
console
.
log
"Compiled to ./dist/psd.js -
#{
Math
.
round
(
stats
.
size
/
1024
)
}
KB"
\ No newline at end of file
dist/psd.js
View file @
fe58a3f6
This diff is collapsed.
Click to expand it.
lib/psd/descriptor.coffee
View file @
fe58a3f6
...
...
@@ -7,7 +7,7 @@ module.exports = class Descriptor
numItems
=
@
file
.
readInt
()
for
i
in
[
0
...
numItems
]
id
,
value
=
@
parseKeyItem
()
[
id
,
value
]
=
@
parseKeyItem
()
@
data
[
id
]
=
value
@
data
...
...
@@ -23,7 +23,7 @@ module.exports = class Descriptor
parseKeyItem
:
->
id
=
@
parseId
()
value
=
@
parseItem
()
return
id
,
value
return
[
id
,
value
]
parseItem
:
(
type
=
null
)
->
type
=
@
file
.
readString
(
4
)
unless
type
?
...
...
@@ -93,4 +93,59 @@ module.exports = class Descriptor
items
parseObjectArray
:
->
\ No newline at end of file
parseObjectArray
:
->
throw
"Descriptor object array not implemented yet @
#{
@
file
.
tell
()
}
"
parseRawData
:
->
len
=
@
file
.
readInt
()
@
file
.
read
(
len
)
parseReference
:
->
numItems
=
@
file
.
readInt
()
items
=
[]
for
i
in
[
0
...
numItems
]
type
=
@
file
.
readString
(
4
)
value
=
switch
type
when
'prop'
then
@
parseProperty
()
when
'Clss'
then
@
parseClass
()
when
'Enmr'
then
@
parseEnumReference
()
when
'Idnt'
then
@
parseIdentifier
()
when
'indx'
then
@
parseIndex
()
when
'name'
then
@
file
.
readUnicodeString
()
when
'rele'
then
@
parseOffset
()
items
.
push
type
:
type
,
value
:
value
items
parseUnitDouble
:
->
unitId
=
@
file
.
readString
(
4
)
unit
=
switch
unitId
when
'#Ang'
then
'Angle'
when
'#Rsl'
then
'Density'
when
'#Rlt'
then
'Distance'
when
'#Nne'
then
'None'
when
'#Prc'
then
'Percent'
when
'#Pxl'
then
'Pixels'
when
'#Mlm'
then
'Millimeters'
when
'#Pnt'
then
'Points'
value
=
@
file
.
readDouble
()
id
:
unitId
,
unit
:
unit
,
value
:
value
parseUnitFloat
:
->
unitId
=
@
file
.
readString
(
4
)
unit
=
switch
unitId
when
'#Ang'
then
'Angle'
when
'#Rsl'
then
'Density'
when
'#Rlt'
then
'Distance'
when
'#Nne'
then
'None'
when
'#Prc'
then
'Percent'
when
'#Pxl'
then
'Pixels'
when
'#Mlm'
then
'Millimeters'
when
'#Pnt'
then
'Points'
value
=
@
file
.
readFloat
()
id
:
unitId
,
unit
:
unit
,
value
:
value
\ 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