forked from layervault/psd.rb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to parse resource data. Also adds additional logging …
…in descriptors.
- Loading branch information
1 parent
752d94e
commit 4a35c8b
Showing
5 changed files
with
74 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
class PSD | ||
class Resource | ||
class Section | ||
def self.factory(file, resource) | ||
Section.constants.each do |c| | ||
section = Section.const_get(c) | ||
next unless section.id == resource.id | ||
|
||
return section.new(file, resource).parse | ||
end | ||
|
||
return nil | ||
end | ||
|
||
def initialize(file, resource) | ||
@file = file | ||
@resource = resource | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
class PSD | ||
class Resource | ||
class Section | ||
class LayerComps < Section | ||
def self.id; 1065; end | ||
|
||
def parse | ||
# Descriptor version | ||
@file.seek 4, IO::SEEK_CUR | ||
@resource.data = Descriptor.new(@file).parse | ||
end | ||
end | ||
end | ||
end | ||
end |