- コミット日時:
- 2008/09/09 00:03:48 (5 年前)
- ファイル:
-
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPCanvas.as (更新) (2 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayer.as (更新) (6 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayerArray.as (更新) (4 diffs)
- as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLogger.as (更新) (3 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/controls/GPCanvas.as
r1179 r1296 12 12 import flash.utils.ByteArray; 13 13 14 import mx.core.UIComponent; 15 import mx.managers.CursorManager; 16 14 17 import org.libspark.gunyarapaint.entities.GPLayerArray; 15 18 import org.libspark.gunyarapaint.entities.GPLogger; 16 19 import org.libspark.gunyarapaint.entities.GPPen; 17 20 import org.libspark.gunyarapaint.entities.GPUndoBuffer; 18 19 import mx.core.UIComponent;20 import mx.managers.CursorManager;21 21 22 22 public class GPCanvas extends UIComponent … … 444 444 _layers.targetIndex = i; 445 445 } 446 public function layerChangeVisible( v:Boolean):void {447 // FIXME:446 public function layerChangeVisible(target:uint, v:Boolean):void { 447 _layers.changeVisible(target, v); 448 448 } 449 449 as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayer.as
r1179 r1296 7 7 import flash.geom.Matrix; 8 8 import flash.geom.Rectangle; 9 10 import org.libspark.gunyarapaint.controls.GPCanvas; 9 11 10 12 // BitmapDataの継承はしない … … 25 27 26 28 private var _colorTransform:ColorTransform; // for layer alpha 29 30 private var _canvas:GPCanvas; 27 31 28 public function GPLayer(source:BitmapData, width:uint, height:uint, index:uint, 29 show:Boolean = true, lock:Boolean = false, mask:Boolean = false, 30 blendMode:String = 'normal' /* flash.display.BlendMode.NORMAL*/, 31 alpha:Number = 1.0, 32 name:String = null) { 32 public function GPLayer(canvas:GPCanvas, 33 source:BitmapData, width:uint, height:uint, index:uint, 34 show:Boolean = true, lock:Boolean = false, mask:Boolean = false, 35 blendMode:String = 'normal' /* flash.display.BlendMode.NORMAL*/, 36 alpha:Number = 1.0, 37 name:String = null) { 33 38 if (source) { 34 39 _bitmapData = source.clone(); … … 36 41 _bitmapData = new BitmapData(width, height, true, 0x00000000); 37 42 } 43 _canvas = canvas; 38 44 _width = width; 39 45 _height = height; … … 54 60 55 61 public function clone():GPLayer { 56 return new GPLayer(_ bitmapData, _width, _height, _index, _show, _lock, _mask, _blendMode, _alpha, _name);62 return new GPLayer(_canvas, _bitmapData, _width, _height, _index, _show, _lock, _mask, _blendMode, _alpha, _name); 57 63 } 58 64 … … 81 87 public function get show():Boolean { 82 88 return _show; 89 } 90 public function set show(b:Boolean):void { 91 _show = b; 92 _bitmap.visible = _show; 93 _canvas.logWrite(['layerChangeVisible', _index, _show]); 83 94 } 84 95 public function set name(s:String):void { … … 120 131 } 121 132 public function set showCheck(s:String):void { 122 _show = (s == 'on'); 123 _bitmap.visible = _show; 133 show = (s == 'on'); 124 134 } 125 135 public function get bitmapData():BitmapData { as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayerArray.as
r1179 r1296 10 10 import flash.geom.Rectangle; 11 11 12 import mx.controls.Alert; 13 12 14 import org.libspark.gunyarapaint.controls.GPCanvas; 13 14 import mx.controls.Alert;15 15 16 16 // Arrayの継承はしない, IListを実装すればdataProviderに直指定できるけど、めんどい。 … … 65 65 return; 66 66 } 67 var l:GPLayer = new GPLayer( b, _width, _height, _a.length);67 var l:GPLayer = new GPLayer(_canvas, b, _width, _height, _a.length); 68 68 this.targetIndex = _a.push(l) - 1; 69 69 _view.addChild(l.bitmap); … … 75 75 } 76 76 _canvas.logWrite(['layerNew']); 77 var l:GPLayer = new GPLayer( null, _width, _height, _a.length);77 var l:GPLayer = new GPLayer(_canvas, null, _width, _height, _a.length); 78 78 _a.splice(_targetIndex + 1, 0, l); 79 79 this.targetIndex = _targetIndex + 1; 80 80 _view.addChildAt(l.bitmap, _targetIndex); 81 81 reindex(); 82 } 83 84 public function changeVisible(target:uint, b:Boolean):void { 85 _a[target].show = b; 82 86 } 83 87 … … 199 203 200 204 public function set targetIndex(i:uint):void { 201 _targetIndex = i; 202 _canvas.logWrite(['layerChangeTarget', i]); 205 if (_targetIndex != i) { 206 _targetIndex = i; 207 _canvas.logWrite(['layerChangeTarget', i]); 208 } 203 209 } 204 210 as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLogger.as
r1179 r1296 229 229 case 'layerChangeVisible': 230 230 writeByte(ACTION_LAYER_CHANGE_VISIBLE); 231 writeBoolean(info[1]); 231 writeByte(info[1]); 232 writeBoolean(info[2]); 232 233 break; 233 234 default: … … 428 429 break; 429 430 case ACTION_LAYER_CHANGE_VISIBLE: 430 trace('LAYER_CHANGE_VISIBLE value:' + a[1]);431 _playCanvas.layerChangeVisible(a[1] );431 trace('LAYER_CHANGE_VISIBLE target:' + a[1] + ' value:' + a[2]); 432 _playCanvas.layerChangeVisible(a[1], a[2]); 432 433 break; 433 434 default: … … 531 532 return [ACTION_LAYER_CHANGE_TARGET, obj]; 532 533 case ACTION_LAYER_CHANGE_VISIBLE: 533 obj = readBoolean(); 534 return [ACTION_LAYER_CHANGE_VISIBLE, obj]; 534 obj = readByte(); 535 obj2 = readBoolean(); 536 return [ACTION_LAYER_CHANGE_VISIBLE, obj, obj2]; 535 537 default: 536 538 if (byte & 0x80) {

