root/as3/PSDParser/src/com/voidelement/images/psd/resources/ResolutionInfo.as

リビジョン 97, 2.3 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.resources {
25         import com.voidelement.images.psd.PSDParser;
26        
27         import flash.utils.ByteArray;
28        
29         public class ResolutionInfo {
30                 private var _hRes:uint;
31                 public function get hRes():uint { return _hRes; }
32                
33                 private var _hResUnit:uint;
34                 public function get hResUnit():uint { return _hResUnit; }
35                
36                 private var _widthUnit:uint;
37                 public function get widthUnit():uint { return _widthUnit; }
38                
39                 private var _vRes:uint;
40                 public function get vRes():uint { return _vRes; }
41                
42                 private var _vResUnit:uint;
43                 public function get vResUnit():uint { return _vResUnit; }
44                
45                 private var _heightUnit:uint;
46                 public function get heightUnit():uint { return _heightUnit; }
47                
48                
49                 public function ResolutionInfo( stream:ByteArray ) {
50                         _hRes = stream.readUnsignedInt();
51                         _hResUnit = stream.readUnsignedShort();
52                         _widthUnit = stream.readUnsignedShort();
53                         _vRes = stream.readUnsignedInt();
54                         _vResUnit = stream.readUnsignedShort();
55                         _heightUnit = stream.readUnsignedShort();
56                        
57                         PSDParser.log("  hRes: " + hRes );
58                         PSDParser.log("  hResUnit: " + hResUnit + " [ pixel/" + ["inch", "cm"][hResUnit-1] + " ]");
59                         PSDParser.log("  widthUnit: " + widthUnit + " [ " + ["in", "cm", "pt", "picas", "columns"][widthUnit-1] + " ]");
60                         PSDParser.log("  vRes: " + vRes );
61                         PSDParser.log("  vResUnit: " + vResUnit + " [ pixel/" + ["inch", "cm"][vResUnit-1] + " ]");
62                         PSDParser.log("  heightUnit: " + heightUnit + " [ " + ["in", "cm", "pt", "picas", "columns"][heightUnit-1] + " ]");
63                 }
64         }
65 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。