チェンジセット 3801: as3/gunyarapaint
- コミット日時:
- 2010/04/16 01:48:24 (3 年前)
- ファイル:
-
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/CanvasModuleContext.as (更新) (1 diff)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/TransparentLineModule.as (コピー) (as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/LineModule.as から コピー) (6 diffs)
- as3/gunyarapaint/branches/gunyarapaint/test/src/org/libspark/gunyarapaint/framework/TestSuite.as (更新) (2 diffs)
- as3/gunyarapaint/branches/gunyarapaint/test/src/org/libspark/gunyarapaint/framework/module/TransparentLineTest.as (コピー) (as3/gunyarapaint/branches/gunyarapaint/test/src/org/libspark/gunyarapaint/framework/module/TransparentFloodFillTest.as から コピー) (3 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/CanvasModuleContext.as
r3639 r3801 19 19 registerModule(new RoundRectModule(recorder)); 20 20 registerModule(new TransparentFloodFill(recorder)); 21 registerModule(new TransparentLineModule(recorder)); 21 22 } 22 23 as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/TransparentLineModule.as
r3542 r3801 1 1 package org.libspark.gunyarapaint.framework.modules 2 2 { 3 import flash.display.BlendMode; 4 5 import org.libspark.gunyarapaint.framework.Pen; 3 6 import org.libspark.gunyarapaint.framework.Recorder; 4 7 import org.libspark.gunyarapaint.framework.commands.CompositeCommand; … … 6 9 import org.libspark.gunyarapaint.framework.commands.MoveToCommand; 7 10 8 public final class LineModule extends CanvasModule implements ICanvasModule11 public final class TransparentLineModule extends CanvasModule implements ICanvasModule 9 12 { 10 public static const LINE:String = "line";13 public static const TRANSPARENT_LINE:String = "transparentLine"; 11 14 12 public function LineModule(recorder:Recorder)15 public function TransparentLineModule(recorder:Recorder) 13 16 { 14 17 super(recorder); … … 19 22 validateLayerState(); 20 23 setCoordinate(x, y); 24 m_blendMode = m_recorder.layers.currentLayer.blendMode; 21 25 m_recorder.startDrawingSession(); 22 26 } … … 24 28 public function move(x:Number, y:Number):void 25 29 { 30 var pen:Pen = m_recorder.pen; 31 var blendMode:String = pen.blendMode; 32 pen.blendMode = BlendMode.ERASE; 26 33 m_recorder.clear(); 27 34 m_recorder.resetPen(); 28 35 m_recorder.moveTo(coordinateX, coordinateY); 29 36 m_recorder.lineTo(x, y); 37 pen.blendMode = blendMode; 30 38 } 31 39 … … 36 44 var from:Object = getArgumentsFromCurrentCoordinate(); 37 45 var to:Object = getArgumentsFromCoordinate(x, y); 46 blendMode = BlendMode.ERASE; 38 47 m_recorder.commitCommand(MoveToCommand.ID, from); 39 48 m_recorder.commitCommand(LineToCommand.ID, to); 40 49 m_recorder.commitCommand(CompositeCommand.ID, {}); 50 blendMode = m_blendMode; 41 51 } 52 m_recorder.currentLayerBlendMode = m_blendMode; 42 53 saveCoordinate(x, y); 43 54 } … … 50 61 public function get name():String 51 62 { 52 return LINE;63 return TRANSPARENT_LINE; 53 64 } 65 66 private var m_blendMode:String; 54 67 } 55 68 } as3/gunyarapaint/branches/gunyarapaint/test/src/org/libspark/gunyarapaint/framework/TestSuite.as
r3796 r3801 39 39 import org.libspark.gunyarapaint.framework.module.RoundRectModuleTest; 40 40 import org.libspark.gunyarapaint.framework.module.TransparentFloodFillTest; 41 import org.libspark.gunyarapaint.framework.module.TransparentLineTest; 42 import org.libspark.gunyarapaint.framework.modules.TransparentLineModule; 41 43 42 44 [Suite] … … 120 122 public var transparentFloodFillModule:TransparentFloodFillTest; 121 123 124 public var transparentLineModule:TransparentLineTest; 125 122 126 public var layerBitmapContainer:LayerBitmapContainerTest; 123 127 as3/gunyarapaint/branches/gunyarapaint/test/src/org/libspark/gunyarapaint/framework/module/TransparentLineTest.as
r3605 r3801 7 7 import org.libspark.gunyarapaint.framework.modules.CanvasModuleContext; 8 8 import org.libspark.gunyarapaint.framework.modules.ICanvasModule; 9 import org.libspark.gunyarapaint.framework.modules.Transparent FloodFill;9 import org.libspark.gunyarapaint.framework.modules.TransparentLineModule; 10 10 11 public final class Transparent FloodFillTest11 public final class TransparentLineTest 12 12 { 13 13 [Before] … … 17 17 var recorder:Recorder = ModuleTestUtil.createRecorder(m_bytes); 18 18 var context:CanvasModuleContext = new CanvasModuleContext(recorder); 19 m_module = context.getModule(Transparent FloodFill.TRANSPARENT_FLOOD_FILL);19 m_module = context.getModule(TransparentLineModule.TRANSPARENT_LINE); 20 20 } 21 21 22 22 [Test] 23 public function is FloodFillModule():void23 public function isTransparentLineModule():void 24 24 { 25 Assert.assertTrue(m_module is Transparent FloodFill);26 Assert.assertEquals(m_module.name, Transparent FloodFill.TRANSPARENT_FLOOD_FILL);25 Assert.assertTrue(m_module is TransparentLineModule); 26 Assert.assertEquals(m_module.name, TransparentLineModule.TRANSPARENT_LINE); 27 27 } 28 28 29 29 [Test] 30 public function floodFill():void 30 public function drawWithoutMoving():void 31 { 32 m_module.start(1, 1); 33 m_module.stop(1, 1); 34 ModuleTestUtil.countCommands(0, m_bytes); 35 } 36 37 [Test] 38 public function drawWithMoving():void 31 39 { 32 40 m_module.start(1, 1); 33 41 m_module.move(2, 2); 34 42 m_module.stop(3, 3); 35 ModuleTestUtil.countCommands( 6, m_bytes);43 ModuleTestUtil.countCommands(5, m_bytes); 36 44 } 37 45 … … 39 47 public function getLineSegment():void 40 48 { 41 ModuleTestUtil.getLineSegment(m_module, false);49 ModuleTestUtil.getLineSegment(m_module, true); 42 50 } 43 51

