チェンジセット 1158
- コミット日時:
- 2008/08/27 18:20:58 (5 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint/controls/GPCanvas.as
r1153 r1158 30 30 private var additionalSkew:Shape; // 斜め補助線 (5) 31 31 private var previewShape:Shape; // プレビュー用 (6) 32 32 33 33 private var additionalNumber:uint = 4; // 補助線の分割数 34 34 … … 359 359 360 360 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 } 367 369 } 368 370 as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint/entities/GPLayerArray.as
r1157 r1158 21 21 private var _undoLastIndex:uint; 22 22 private var _undoBufferSize:uint; 23 24 private var _combinedBitmapData:BitmapData; 23 25 24 26 public function GPLayerArray(a:Array, w:uint, h:uint, undoBufferSize:uint) { … … 35 37 _undoRingBuffer = new Array(_undoBufferSize); 36 38 initUndoRingBuffer(); 39 recombine(); 37 40 } 38 41 … … 69 72 _a.splice(i, 0, n); 70 73 reindex(); 74 recombine(); 71 75 } 72 76 … … 74 78 _a.splice(t, 0, _a.splice(f, 1)); 75 79 reindex(); 80 recombine(); 76 81 } 77 82 … … 85 90 _a.splice(i, 1); 86 91 reindex(); 92 recombine(); 87 93 } 88 94 … … 94 100 _a.splice(i, 1); 95 101 reindex(); 102 recombine(); 96 103 } 97 104 … … 111 118 } 112 119 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 113 128 // レイヤ統合したbitmapDataを出す。 114 129 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; 120 131 } 121 132 … … 124 135 _a[_targetIndex].draw(source, matrix, colorTransform, blendMode, clipRect, smoothing); 125 136 addUndo(); 137 recombine(); 126 138 } 127 139 … … 136 148 var undoData:GPLayer = _undoRingBuffer[_undoIndex]; 137 149 _a[undoData.index] = undoData.clone(); 150 recombine(); 138 151 } 139 152 … … 145 158 var undoData:GPLayer = _undoRingBuffer[_undoIndex]; 146 159 _a[undoData.index] = undoData.clone(); 160 recombine(); 147 161 } 148 162

