always118 / java-psd-library

Automatically exported from code.google.com/p/java-psd-library
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Requires two types of layers (LayerType.OPEN_FOLDER and LayerType.CLOSED_FOLDER) instead of LayerType.FOLDER #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Requires two types of layers (LayerType.OPEN_FOLDER and 
LayerType.CLOSED_FOLDER) instead of LayerType.FOLDER.
See "Section divider setting (Photoshop 6.0)" at 
http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/

In the class psd.parser.layer.additional.LayerSectionDividerParser replace the 
code from
--
        switch (dividerType) {
        case 1:
        case 2:
            type = LayerType.FOLDER;
            break;
        case 3:
            type = LayerType.HIDDEN;
            break;
        }
--
to
--
        switch (dividerType) {
        case 1:
                type = LayerType.OPEN_FOLDER;
                break;
        case 2:
            type = LayerType.CLOSED_FOLDER;
            break;
        case 3:
            type = LayerType.HIDDEN;
            break;
        }
--
and change psd.model.AbstractPsd.makeLayersHierarchy(layers) method.

When you open some files (probably from the Adobe Photoshop CS5) see the error:

Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException
    at java.util.LinkedList.remove(LinkedList.java:788)
    at java.util.LinkedList.removeFirst(LinkedList.java:134)
    at psd.model.AbstractPsd.makeLayersHierarchy(AbstractPsd.java:95)
    at psd.model.AbstractPsd.<init>(AbstractPsd.java:71)
    at psd.model.Psd.<init>(Psd.java:11)

Original issue reported on code.google.com by debugger...@gmail.com on 5 Apr 2012 at 10:24