lib/java-psd-library-encontra/psd-parser/src/psd/parser/layer/additional/LayerEffectsParser.java
private PSDEffect parseBevel(PsdInputStream stream) throws IOException {

        int version = stream.readInt();     //0 (Photoshop 5.0) or 2 (Photoshop 5.5)
        int angle = stream.readShort();       //Angle in degrees
        int strength = stream.readInt();    //Strength. Depth in pixels
        int blur = stream.readInt();        //Blur value in pixels

        stream.skipBytes(2);

        //	Highlight blend mode: 4 bytes for signature and 4 bytes for the key
        String blendSig = stream.readString(4);
        if (!blendSig.equals("8BIM")){
            throw new Error("Invalid Blend mode signature for Effect: " + blendSig );
        }

        /*
        4 bytes.
        Blend mode key.
        */
        String blendModeKey = stream.readString(4);

        //Shadow blend mode: 4 bytes for signature and 4 bytes for the key
        String blendSigShadow = stream.readString(4);
        if (!blendSigShadow.equals("8BIM")){
            throw new Error("Invalid Blend mode signature for Effect: " + blendSigShadow );
        }

        /*
        4 bytes.
        Blend mode Shadow key.
        */
        String blendModeShadowKey = stream.readString(4);

        //Highlight color: 2 bytes for space followed by 4 * 2 byte color component
        stream.skipBytes(3);

        int colorR = stream.readUnsignedByte();
        stream.skipBytes(1);
        int colorG = stream.readUnsignedByte();
        stream.skipBytes(1);
        int colorB = stream.readUnsignedByte();

        stream.skipBytes(2);

        Color highlightColor = new Color(colorR, colorG, colorB);

        //Shadow color: 2 bytes for space followed by 4 * 2 byte color component
        stream.skipBytes(3);

        colorR = stream.readUnsignedByte();
        stream.skipBytes(1);
        colorG = stream.readUnsignedByte();
        stream.skipBytes(1);
        colorB = stream.readUnsignedByte();

        Color shadowColor = new Color(colorR, colorG, colorB);

        stream.skipBytes(2);

        //Bevel style
        int bevelStyle = stream.readUnsignedByte();

        //Hightlight opacity as a percent
        float highlightOpacity = new Float(stream.readUnsignedByte()/255.0);

        //Shadow opacity as a percent
        float shadowOpacity = new Float(stream.readUnsignedByte()/255.0);

        //Effect enabled
        boolean isEffectEnabled = stream.readBoolean();

        //Use this angle in all of the layer effects
        boolean useInAllLayerEffects = stream.readBoolean();

        //Bevel Up or down
        int direction = stream.readUnsignedByte();

        Color realHighlightColor = null, realShadowColor = null;
        if (version == 2) {
            //Real Highlight color: 2 bytes for space followed by 4 * 2 byte color component
            stream.skipBytes(3);

            int realColorR = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realColorG = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realColorB = stream.readUnsignedByte();

            realHighlightColor = new Color(realColorR, realColorG, realColorB);

            stream.skipBytes(2);

            //Real Shadow color: 2 bytes for space followed by 4 * 2 byte color component
            stream.skipBytes(3);

            int realShadowColorR = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realShadowColorG = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realShadowColorB = stream.readUnsignedByte();

            realShadowColor = new Color(realShadowColorR, realShadowColorG, realShadowColorB);

            stream.skipBytes(2);
        }

        BevelEffect effect = new BevelEffect();
        effect.setAngle(angle);
        effect.setVersion(version);
        effect.setUseInAllLayerEffects(useInAllLayerEffects);
        effect.setStrength(strength);
        effect.setBevelStyle(bevelStyle);
        effect.setBlendMode(BlendMode.getByName(blendModeKey));
        effect.setBlendShadowMode(BlendMode.getByName(blendModeShadowKey));
        effect.setBlur(blur);
        effect.setDirection(direction);
        effect.setEnabled(isEffectEnabled);
        effect.setHighlightColor(highlightColor);
        effect.setHighlightOpacity(highlightOpacity);
        effect.setShadowColor(shadowColor);
        effect.setShadowOpacity(shadowOpacity);

        if (realHighlightColor != null) {
            effect.setRealHighlightColor(realHighlightColor);
            effect.setRealShadowColor(realShadowColor);
        }

        return effect;
    }
/**
     * Parses the stream to create a Bevel effect
     * @param stream
     * @return
     * @throws IOException
     */
Parses the stream to create a Bevel effect
@param stream
@return
@throws IOException
Parses the stream to create a Bevel effect @param stream @return @throws IOException
private PSDEffect parseBevel(PsdInputStream stream) throws IOException {
        int version = stream.readInt();     
        int angle = stream.readShort();       
        int strength = stream.readInt();    
        int blur = stream.readInt();        
        stream.skipBytes(2);
        String blendSig = stream.readString(4);
        if (!blendSig.equals("8BIM")){
            throw new Error("Invalid Blend mode signature for Effect: " + blendSig );
        }
        /*
        4 bytes.
        Blend mode key.
        */
        String blendModeKey = stream.readString(4);
        String blendSigShadow = stream.readString(4);
        if (!blendSigShadow.equals("8BIM")){
            throw new Error("Invalid Blend mode signature for Effect: " + blendSigShadow );
        }
        /*
        4 bytes.
        Blend mode Shadow key.
        */
        String blendModeShadowKey = stream.readString(4);
        stream.skipBytes(3);
        int colorR = stream.readUnsignedByte();
        stream.skipBytes(1);
        int colorG = stream.readUnsignedByte();
        stream.skipBytes(1);
        int colorB = stream.readUnsignedByte();
        stream.skipBytes(2);
        Color highlightColor = new Color(colorR, colorG, colorB);
        stream.skipBytes(3);
        colorR = stream.readUnsignedByte();
        stream.skipBytes(1);
        colorG = stream.readUnsignedByte();
        stream.skipBytes(1);
        colorB = stream.readUnsignedByte();
        Color shadowColor = new Color(colorR, colorG, colorB);
        stream.skipBytes(2);
        int bevelStyle = stream.readUnsignedByte();
        float highlightOpacity = new Float(stream.readUnsignedByte()/255.0);
        float shadowOpacity = new Float(stream.readUnsignedByte()/255.0);
        boolean isEffectEnabled = stream.readBoolean();
        boolean useInAllLayerEffects = stream.readBoolean();
        int direction = stream.readUnsignedByte();
        Color realHighlightColor = null, realShadowColor = null;
        if (version == 2) {
            stream.skipBytes(3);
            int realColorR = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realColorG = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realColorB = stream.readUnsignedByte();
            realHighlightColor = new Color(realColorR, realColorG, realColorB);
            stream.skipBytes(2);
            stream.skipBytes(3);
            int realShadowColorR = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realShadowColorG = stream.readUnsignedByte();
            stream.skipBytes(1);
            int realShadowColorB = stream.readUnsignedByte();
            realShadowColor = new Color(realShadowColorR, realShadowColorG, realShadowColorB);
            stream.skipBytes(2);
        }
        BevelEffect effect = new BevelEffect();
        effect.setAngle(angle);
        effect.setVersion(version);
        effect.setUseInAllLayerEffects(useInAllLayerEffects);
        effect.setStrength(strength);
        effect.setBevelStyle(bevelStyle);
        effect.setBlendMode(BlendMode.getByName(blendModeKey));
        effect.setBlendShadowMode(BlendMode.getByName(blendModeShadowKey));
        effect.setBlur(blur);
        effect.setDirection(direction);
        effect.setEnabled(isEffectEnabled);
        effect.setHighlightColor(highlightColor);
        effect.setHighlightOpacity(highlightOpacity);
        effect.setShadowColor(shadowColor);
        effect.setShadowOpacity(shadowOpacity);
        if (realHighlightColor != null) {
            effect.setRealHighlightColor(realHighlightColor);
            effect.setRealShadowColor(realShadowColor);
        }
        return effect;
    }
private PSDEffect parseBevel ( PsdInputStream stream ) throws IOException { int version = stream . readInt ( ) ; int angle = stream . readShort ( ) ; int strength = stream . readInt ( ) ; int blur = stream . readInt ( ) ; stream . skipBytes ( 2 ) ; String blendSig = stream . readString ( 4 ) ; if ( ! blendSig . equals ( "8BIM" ) ) { throw new Error ( "Invalid Blend mode signature for Effect: " + blendSig ) ; } /*
        4 bytes.
        Blend mode key.
        */ String blendModeKey = stream . readString ( 4 ) ; String blendSigShadow = stream . readString ( 4 ) ; if ( ! blendSigShadow . equals ( "8BIM" ) ) { throw new Error ( "Invalid Blend mode signature for Effect: " + blendSigShadow ) ; } /*
        4 bytes.
        Blend mode Shadow key.
        */ String blendModeShadowKey = stream . readString ( 4 ) ; stream . skipBytes ( 3 ) ; int colorR = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; int colorG = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; int colorB = stream . readUnsignedByte ( ) ; stream . skipBytes ( 2 ) ; Color highlightColor = new Color ( colorR , colorG , colorB ) ; stream . skipBytes ( 3 ) ; colorR = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; colorG = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; colorB = stream . readUnsignedByte ( ) ; Color shadowColor = new Color ( colorR , colorG , colorB ) ; stream . skipBytes ( 2 ) ; int bevelStyle = stream . readUnsignedByte ( ) ; float highlightOpacity = new Float ( stream . readUnsignedByte ( ) / 255.0 ) ; float shadowOpacity = new Float ( stream . readUnsignedByte ( ) / 255.0 ) ; boolean isEffectEnabled = stream . readBoolean ( ) ; boolean useInAllLayerEffects = stream . readBoolean ( ) ; int direction = stream . readUnsignedByte ( ) ; Color realHighlightColor = null , realShadowColor = null ; if ( version == 2 ) { stream . skipBytes ( 3 ) ; int realColorR = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; int realColorG = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; int realColorB = stream . readUnsignedByte ( ) ; realHighlightColor = new Color ( realColorR , realColorG , realColorB ) ; stream . skipBytes ( 2 ) ; stream . skipBytes ( 3 ) ; int realShadowColorR = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; int realShadowColorG = stream . readUnsignedByte ( ) ; stream . skipBytes ( 1 ) ; int realShadowColorB = stream . readUnsignedByte ( ) ; realShadowColor = new Color ( realShadowColorR , realShadowColorG , realShadowColorB ) ; stream . skipBytes ( 2 ) ; } BevelEffect effect = new BevelEffect ( ) ; effect . setAngle ( angle ) ; effect . setVersion ( version ) ; effect . setUseInAllLayerEffects ( useInAllLayerEffects ) ; effect . setStrength ( strength ) ; effect . setBevelStyle ( bevelStyle ) ; effect . setBlendMode ( BlendMode . getByName ( blendModeKey ) ) ; effect . setBlendShadowMode ( BlendMode . getByName ( blendModeShadowKey ) ) ; effect . setBlur ( blur ) ; effect . setDirection ( direction ) ; effect . setEnabled ( isEffectEnabled ) ; effect . setHighlightColor ( highlightColor ) ; effect . setHighlightOpacity ( highlightOpacity ) ; effect . setShadowColor ( shadowColor ) ; effect . setShadowOpacity ( shadowOpacity ) ; if ( realHighlightColor != null ) { effect . setRealHighlightColor ( realHighlightColor ) ; effect . setRealShadowColor ( realShadowColor ) ; } return effect ; }
Parses the stream to create a Bevel effect
 @param stream
 @return
 @throws IOException
Parses the stream to create a Bevel effect @param stream @return @throws IOException
//0 (Photoshop 5.0) or 2 (Photoshop 5.5) //Angle in degrees //Strength. Depth in pixels //Blur value in pixels //	Highlight blend mode: 4 bytes for signature and 4 bytes for the key //Shadow blend mode: 4 bytes for signature and 4 bytes for the key //Highlight color: 2 bytes for space followed by 4 * 2 byte color component //Shadow color: 2 bytes for space followed by 4 * 2 byte color component //Bevel style //Hightlight opacity as a percent //Shadow opacity as a percent //Effect enabled //Use this angle in all of the layer effects //Bevel Up or down //Real Highlight color: 2 bytes for space followed by 4 * 2 byte color component //Real Shadow color: 2 bytes for space followed by 4 * 2 byte color component