チェンジセット 3492

差分発生行の前後
無視リスト:
コミット日時:
2010/03/06 23:04:26 (3 年前)
コミッタ:
hkrn
ログメッセージ:

It's no longer requires Logger class

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/CommandCollection.as

    r3438 r3492  
    123123        } 
    124124         
     125        /** 
     126         * 引数からコマンドオブジェクトを返す 
     127         *  
     128         * @return ICommand コマンドオブジェクト 
     129         * @throws ArgumentError 引数の値が0x80または0x40とビット演算レベルで一致する場合 
     130         */ 
     131        public function getCommand(id:uint):ICommand 
     132        { 
     133            if (id & 0x80 || id & 0x40) { 
     134                throw new ArgumentError(); 
     135            } 
     136            else { 
     137                return m_commands[id]; 
     138            } 
     139        } 
     140         
    125141        protected var m_commands:Vector.<ICommand>; 
    126142    } 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/LayerBitmapCollection.as

    r3488 r3492  
    101101         * 現在のレイヤーを下のレイヤーと合成する  
    102102         *  
     103         * @throws MergeLayersError レイヤーが一つ、あるいは対象のうち片方が不可視の場合 
    103104         */ 
    104105        public function merge():void 
     
    115116         *  
    116117         * @param index レイヤー番号 
     118         * @throws MergeLayersError レイヤーが一つ、あるいは対象のうち片方が不可視の場合 
    117119         */ 
    118120        public function mergeAt(index:int):void 
    119121        { 
    120             // 両方可視である必要がある 
     122            // レイヤーは必ず2つ以上 
    121123            if (currentIndex > 0) { 
    122124                var current:LayerBitmap = layers[index]; 
    123125                var prev:LayerBitmap = layers[index - 1]; 
     126                // 両方可視である必要がある 
    124127                if (current.visible && prev.visible) { 
    125128                    current.compositeTo(prev.bitmapData); 
     
    141144         * 現在のレイヤーを削除する 
    142145         *  
     146         * @throws RemoveLayerError レイヤーが一つの場合 
    143147         */ 
    144148        public function remove():void 
     
    154158         *  
    155159         * @param index 現在のレイヤー番号 
     160         * @throws RemoveLayerError レイヤーが一つの場合 
    156161         */ 
    157162        public function removeAt(index:int):void 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/Recorder.as

    r3487 r3492  
    11package org.libspark.gunyarapaint.framework 
    22{ 
     3    import flash.utils.ByteArray; 
     4    import flash.utils.Endian; 
     5     
    36    import org.libspark.gunyarapaint.framework.commands.ICommand; 
    47    import org.libspark.gunyarapaint.framework.events.CommandEvent; 
     
    811        public static const DEFAULT_UNDO_MAX:uint = 16; 
    912         
    10         public function Recorder(logger:Logger
     13        public function Recorder(bytes:ByteArray, commands:CommandCollection = null
    1114        { 
    12             m_logger = logger; 
     15            bytes.endian = Endian.BIG_ENDIAN; 
     16            bytes.position = 0; 
     17            m_bytes = bytes; 
     18            m_command = commands ? commands : new CommandCollection(); 
    1319            super(); 
    1420        } 
     
    2329        public function prepare(width:int, height:int, undo:int):void 
    2430        { 
    25             m_logger.writeHeader(PAINTER_LOG_VERSION, width, height, undo); 
    26             m_logger.loadCommands(); 
     31            m_command.loadCommands(); 
     32            writeHeader(PAINTER_LOG_VERSION, width, height, undo); 
    2733            createPainter(width, height, undo); 
    2834            setUndo(new UndoStack(painter, undo)); 
     35        } 
     36         
     37        /** 
     38         * ログヘッダーを書き出す 
     39         *  
     40         * @param version ログのバージョン番号 
     41         * @param width 画像の幅 
     42         * @param height 画像の高さ 
     43         * @param undo やり直しできる回数 
     44         */ 
     45        private function writeHeader(version:uint, width:uint, height:uint, undo:uint):void 
     46        { 
     47            var signature:String = "GUNYARA_PAINT:" 
     48                + (version / 100)         + ":" 
     49                + ((version % 100) / 10)  + ":" 
     50                + (version % 10)          + ":" 
     51            m_bytes.writeUTFBytes(signature); 
     52            m_bytes.writeShort(width); 
     53            m_bytes.writeShort(height); 
     54            m_bytes.writeShort(undo); 
    2955        } 
    3056         
     
    3763        public function commitCommand(id:uint, args:Object):void 
    3864        { 
    39             var command:ICommand = m_logger.getCommand(id); 
    40             command.write(m_logger.bytes, args); 
     65            var command:ICommand = m_command.getCommand(id); 
     66            command.write(m_bytes, args); 
    4167            command.execute(this); 
    4268            if (hasEventListener(CommandEvent.COMMITTED)) 
     
    4470        } 
    4571         
    46         private var m_logger:Logger; 
     72        private var m_command:CommandCollection; 
     73        private var m_bytes:ByteArray; 
    4774    } 
    4875}