| 1 |
/** |
|---|
| 2 |
* com.voidelement.images.psd.PSDParser Class for ActionScript 3.0 |
|---|
| 3 |
* |
|---|
| 4 |
* @author Copyright (c) 2007 munegon |
|---|
| 5 |
* @version 0.2 |
|---|
| 6 |
* |
|---|
| 7 |
* @link http://www.voidelement.com/ |
|---|
| 8 |
* @link http://void.heteml.jp/blog/ |
|---|
| 9 |
* |
|---|
| 10 |
* @link http://blog.alternativagame.com/en/2007/07/09/parser-psd-formata/ |
|---|
| 11 |
* |
|---|
| 12 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|---|
| 13 |
* you may not use this file except in compliance with the License. |
|---|
| 14 |
* You may obtain a copy of the License at |
|---|
| 15 |
* |
|---|
| 16 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 17 |
* |
|---|
| 18 |
* Unless required by applicable law or agreed to in writing, software |
|---|
| 19 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 20 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
|---|
| 21 |
* either express or implied. See the License for the specific language |
|---|
| 22 |
* governing permissions and limitations under the License. |
|---|
| 23 |
*/ |
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
package com.voidelement.images.psd { |
|---|
| 27 |
import com.voidelement.images.psd.section.*; |
|---|
| 28 |
|
|---|
| 29 |
import flash.utils.ByteArray; |
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
public class PSDParser { |
|---|
| 33 |
private static var _verbose:Boolean = false; |
|---|
| 34 |
private static function get verbose():Boolean { return _verbose; } |
|---|
| 35 |
private static function set verbose( value:Boolean ):void { _verbose = value; } |
|---|
| 36 |
|
|---|
| 37 |
private var _header:PSDFileHeader; |
|---|
| 38 |
public function get header():PSDFileHeader { return _header; } |
|---|
| 39 |
|
|---|
| 40 |
private var _colorMode:PSDColorMode; |
|---|
| 41 |
public function get colorMode():PSDColorMode { return _colorMode; } |
|---|
| 42 |
|
|---|
| 43 |
private var _imageResources:PSDImageResources; |
|---|
| 44 |
public function get imageResources():PSDImageResources { return _imageResources; } |
|---|
| 45 |
|
|---|
| 46 |
private var _layerAndMask:PSDLayerAndMask; |
|---|
| 47 |
public function get layerAndMask():PSDLayerAndMask { return _layerAndMask; } |
|---|
| 48 |
|
|---|
| 49 |
private var _imageData:PSDImageData; |
|---|
| 50 |
public function get imageData():PSDImageData { return _imageData; } |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
public function PSDParser( stream:ByteArray ) { |
|---|
| 54 |
_header = new PSDFileHeader( stream ); |
|---|
| 55 |
_colorMode = new PSDColorMode( stream ); |
|---|
| 56 |
_imageResources = new PSDImageResources( stream ); |
|---|
| 57 |
_layerAndMask = new PSDLayerAndMask( stream ); |
|---|
| 58 |
_imageData = new PSDImageData( header, stream ); |
|---|
| 59 |
} |
|---|
| 60 |
|
|---|
| 61 |
public static function log( message:String ):void { |
|---|
| 62 |
if ( verbose ) { |
|---|
| 63 |
trace( message ); |
|---|
| 64 |
} |
|---|
| 65 |
} |
|---|
| 66 |
} |
|---|
| 67 |
} |
|---|