root/as3/PSDParser/src/com/voidelement/images/psd/core/Rect.as

リビジョン 97, 1.9 kB (コミッタ: munegon, コミット時期: 5 年 前)

--

Line 
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.core {
25         import flash.utils.ByteArray;
26        
27         public class Rect {
28                 private var _top:int;
29                 public function get top():int { return _top; }
30                 public function set top( value:int ):void { _top = value; }
31                
32                 private var _left:int;
33                 public function get left():int { return _left; }
34                 public function set left( value:int ):void { _left = value; }
35                
36                 private var _bottom:int;
37                 public function get bottom():int { return _bottom; }
38                 public function set bottom( value:int ):void { _bottom = value; }
39                
40                 private var _right:int;
41                 public function get right():int { return _right; }
42                 public function set right( value:int ):void { _right = value; }
43                
44                 public function get width():int {
45                         return _right - _left;
46                 }
47                
48                 public function get height():int {
49                         return _bottom - _top;
50                 }
51                
52                
53                 public function Rect( stream:ByteArray ) {
54                         _top = stream.readInt();
55                         _left = stream.readInt();
56                         _bottom = stream.readInt();
57                         _right = stream.readInt();
58                 }
59                
60                 public function toString():String {
61                         return left + ", " + top + ", " + width + ", " + height;
62                 }
63         }
64 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。