| 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 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|---|
| 11 |
* you may not use this file except in compliance with the License. |
|---|
| 12 |
* You may obtain a copy of the License at |
|---|
| 13 |
* |
|---|
| 14 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 15 |
* |
|---|
| 16 |
* Unless required by applicable law or agreed to in writing, software |
|---|
| 17 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 18 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
|---|
| 19 |
* either express or implied. See the License for the specific language |
|---|
| 20 |
* governing permissions and limitations under the License. |
|---|
| 21 |
*/ |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
package com.voidelement.images.psd.resources { |
|---|
| 25 |
import com.voidelement.images.psd.PSDParser; |
|---|
| 26 |
import com.voidelement.images.psd.core.Rect; |
|---|
| 27 |
import com.voidelement.images.psd.core.VString; |
|---|
| 28 |
|
|---|
| 29 |
import flash.utils.ByteArray; |
|---|
| 30 |
|
|---|
| 31 |
public class Slices { |
|---|
| 32 |
private var _bounds:Rect; |
|---|
| 33 |
public function get bounds():Rect { return _bounds; } |
|---|
| 34 |
|
|---|
| 35 |
private var _name:VString; |
|---|
| 36 |
public function get name():VString { return _name; } |
|---|
| 37 |
|
|---|
| 38 |
private var _count:uint; |
|---|
| 39 |
public function get count():uint { return _count; } |
|---|
| 40 |
|
|---|
| 41 |
private var _slices:Array; |
|---|
| 42 |
public function get slices():Array { return _slices; } |
|---|
| 43 |
|
|---|
| 44 |
public function Slices( stream:ByteArray ) { |
|---|
| 45 |
parseHeader( stream ); |
|---|
| 46 |
|
|---|
| 47 |
for ( var i:int = 0; i < count; ++i ) { |
|---|
| 48 |
PSDParser.log(" [slice" + i + "]"); |
|---|
| 49 |
slices[i] = new Slice( stream ); |
|---|
| 50 |
} |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
private function parseHeader( stream:ByteArray ):void { |
|---|
| 54 |
var version:int = stream.readInt(); |
|---|
| 55 |
|
|---|
| 56 |
_bounds = new Rect( stream ); |
|---|
| 57 |
_name = new VString( stream ); |
|---|
| 58 |
_count = stream.readUnsignedInt(); |
|---|
| 59 |
|
|---|
| 60 |
_slices = new Array( count ); |
|---|
| 61 |
|
|---|
| 62 |
PSDParser.log(" bounds: " + bounds.left + ", " + bounds.top + ", " + bounds.width + ", " + bounds.height ); |
|---|
| 63 |
PSDParser.log(" name: " + name ); |
|---|
| 64 |
PSDParser.log(" count: " + count ); |
|---|
| 65 |
} |
|---|
| 66 |
} |
|---|
| 67 |
} |
|---|