チェンジセット 1158

差分発生行の前後
無視リスト:
コミット日時:
2008/08/27 18:20:58 (5 年前)
コミッタ:
tasuku
ログメッセージ:

r109@poppop (orig r108): tasuku | 2008-08-12 19:07:45 +0900
dropper now works well

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint/controls/GPCanvas.as

    r1153 r1158  
    3030    private var additionalSkew:Shape; // 斜め補助線 (5) 
    3131    private var previewShape:Shape; // プレビュー用 (6) 
    32      
     32 
    3333    private var additionalNumber:uint = 4; // 補助線の分割数 
    3434     
     
    359359         
    360360        public function getColor(evt:MouseEvent):uint { 
    361           // FIXME: 複数レイヤーの場合の挙動を考える必要がある。 
    362           // 可視レイヤー合成したものでスポイトする必要があろう。 
    363            
    364           // FIXME! 
    365           //return layerDatas[currentDrawLayer].getPixel(evt.localX, evt.localY);  
    366           return 0; 
     361          var alpha:uint = _layers.combinedBitmapData.getPixel32(evt.localX, evt.localY) >> 24 & 0xFF; 
     362          if (alpha > 0) { 
     363            return _layers.combinedBitmapData.getPixel(evt.localX, evt.localY); 
     364          } else { 
     365            // 全く透明 = 背景をスポイト。 
     366            // FIXME: 背景の色を返す。今は白。 
     367            return 0xffffff; 
     368          } 
    367369        } 
    368370     
  • as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint/entities/GPLayerArray.as

    r1157 r1158  
    2121    private var _undoLastIndex:uint; 
    2222    private var _undoBufferSize:uint; 
     23     
     24    private var _combinedBitmapData:BitmapData; 
    2325 
    2426    public function GPLayerArray(a:Array, w:uint, h:uint, undoBufferSize:uint) { 
     
    3537      _undoRingBuffer = new Array(_undoBufferSize); 
    3638      initUndoRingBuffer(); 
     39      recombine(); 
    3740    } 
    3841 
     
    6972      _a.splice(i, 0, n); 
    7073      reindex(); 
     74      recombine(); 
    7175    } 
    7276     
     
    7478      _a.splice(t, 0, _a.splice(f, 1)); 
    7579      reindex(); 
     80      recombine(); 
    7681    } 
    7782 
     
    8590      _a.splice(i, 1); 
    8691      reindex(); 
     92      recombine(); 
    8793    } 
    8894 
     
    94100      _a.splice(i, 1); 
    95101      reindex(); 
     102      recombine(); 
    96103    } 
    97104 
     
    111118    } 
    112119 
     120    // 主に高速なスポイトのため、全て統合したBitmapDataを変更があるたびに計算しておく。 
     121    private function recombine():void { 
     122      _combinedBitmapData = new BitmapData(_width, _height, true, 0x00000000); 
     123      for (var i:String in _a) { 
     124        _a[i].drawDest(_combinedBitmapData); 
     125      } 
     126    } 
     127 
    113128    // レイヤ統合したbitmapDataを出す。 
    114129    public function get combinedBitmapData():BitmapData { 
    115       var b:BitmapData = new BitmapData(_width, _height, true, 0x00000000); 
    116       for (var i:String in _a) { 
    117         _a[i].drawDest(b); 
    118       } 
    119       return b; 
     130      return _combinedBitmapData; 
    120131    } 
    121132 
     
    124135      _a[_targetIndex].draw(source, matrix, colorTransform, blendMode, clipRect, smoothing); 
    125136      addUndo(); 
     137      recombine(); 
    126138    } 
    127139     
     
    136148          var undoData:GPLayer = _undoRingBuffer[_undoIndex]; 
    137149          _a[undoData.index] = undoData.clone(); 
     150      recombine(); 
    138151    } 
    139152     
     
    145158          var undoData:GPLayer = _undoRingBuffer[_undoIndex]; 
    146159          _a[undoData.index] = undoData.clone(); 
     160      recombine(); 
    147161    } 
    148162