チェンジセット 3479: as3/gunyarapaint
- コミット日時:
- 2010/03/03 01:35:37 (3 年前)
- ファイル:
-
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/Recorder.as (更新) (3 diffs)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/CircleModule.as (更新) (1 diff)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/DrawModule.as (更新) (13 diffs)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/DropperModule.as (更新) (1 diff)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/FloodFillModule.as (更新) (1 diff)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/FreeHandModule.as (更新) (6 diffs)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/LineModule.as (更新) (1 diff)
- as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/PixelModule.as (更新) (1 diff)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/Recorder.as
r3434 r3479 2 2 { 3 3 import flash.utils.ByteArray; 4 5 import org.libspark.gunyarapaint.framework.commands.ICommand; 4 6 5 7 public final class Recorder extends CanvasContext … … 14 16 } 15 17 18 /** 19 * 画像の大きさを設定し、ヘッダーに書き込む 20 * 21 * @param width 画像の幅 22 * @param height 画像の高さ 23 * @param undo やり直しできる回数 24 */ 16 25 public function prepare(width:int, height:int, undo:int):void 17 26 { … … 24 33 } 25 34 26 public function get logger():Logger 35 /** 36 * コマンドの書き出し及び実行を同時に行う 37 * 38 * @param command コマンドオブジェクト 39 * @param args コマンドに対する引数 40 */ 41 public function commitCommand(id:uint, args:Object):void 27 42 { 28 return m_logger; 43 var command:ICommand = m_logger.getCommand(id); 44 command.write(m_logger.bytes, args); 45 command.execute(this); 29 46 } 30 47 as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/CircleModule.as
r3471 r3479 42 42 if (!equalsCoordinate(x, y)) { 43 43 storeCircleCoordinate(x, y); 44 commitCommand(45 m_logger.getCommand(MoveToCommand.ID),44 m_recorder.commitCommand( 45 MoveToCommand.ID, 46 46 getArgumentsFromCoordinate(s_rectangle.x, s_rectangle.y) 47 47 ); 48 commitCommand(49 m_logger.getCommand(DrawCircleCommand.ID),48 m_recorder.commitCommand( 49 DrawCircleCommand.ID, 50 50 { "radius": s_rectangle.width } 51 51 ); 52 commitCommand(53 m_logger.getCommand(CompositeCommand.ID),52 m_recorder.commitCommand( 53 CompositeCommand.ID, 54 54 {} 55 55 ); as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/DrawModule.as
r3438 r3479 4 4 5 5 import org.libspark.gunyarapaint.framework.LayerBitmap; 6 import org.libspark.gunyarapaint.framework.Logger;7 6 import org.libspark.gunyarapaint.framework.Painter; 8 7 import org.libspark.gunyarapaint.framework.Recorder; 9 8 import org.libspark.gunyarapaint.framework.commands.HorizontalMirrorCommand; 10 import org.libspark.gunyarapaint.framework.commands.ICommand;11 9 import org.libspark.gunyarapaint.framework.commands.PenCommand; 12 10 import org.libspark.gunyarapaint.framework.commands.RedoCommand; … … 27 25 { 28 26 m_recorder = recorder; 29 m_logger = recorder.logger;30 27 } 31 28 32 29 public function undo():void 33 30 { 34 commitCommand(m_logger.getCommand(UndoCommand.ID), {});31 m_recorder.commitCommand(UndoCommand.ID, {}); 35 32 } 36 33 37 34 public function redo():void 38 35 { 39 commitCommand(m_logger.getCommand(RedoCommand.ID), {});36 m_recorder.commitCommand(RedoCommand.ID, {}); 40 37 } 41 38 42 39 public function horizontalMirror(index:uint):void 43 40 { 44 commitCommand(45 m_logger.getCommand(HorizontalMirrorCommand.ID),41 m_recorder.commitCommand( 42 HorizontalMirrorCommand.ID, 46 43 { 47 44 "index": index … … 52 49 public function verticalMirror(index:uint):void 53 50 { 54 commitCommand(55 m_logger.getCommand(VerticalMirrorCommand.ID),51 m_recorder.commitCommand( 52 VerticalMirrorCommand.ID, 56 53 { 57 54 "index": index … … 62 59 public function copyLayer():void 63 60 { 64 commitCommand(m_logger.getCommand(CopyLayerCommand.ID), {}); 61 m_recorder.commitCommand( 62 CopyLayerCommand.ID, 63 {} 64 ); 65 65 } 66 66 67 67 public function createLayer():void 68 68 { 69 commitCommand(m_logger.getCommand(CreateLayerCommand.ID), {}); 69 m_recorder.commitCommand( 70 CreateLayerCommand.ID, 71 {} 72 ); 70 73 } 71 74 72 75 public function mergeLayers():void 73 76 { 74 commitCommand(m_logger.getCommand(MergeLayerCommand.ID), {}); 77 m_recorder.commitCommand( 78 MergeLayerCommand.ID, 79 {} 80 ); 75 81 } 76 82 77 83 public function removeLayer():void 78 84 { 79 commitCommand(m_logger.getCommand(RemoveLayerCommand.ID), {}); 85 m_recorder.commitCommand( 86 RemoveLayerCommand.ID, 87 {} 88 ); 80 89 } 81 90 82 91 public function swapLayers(from:uint, to:uint):void 83 92 { 84 commitCommand(85 m_logger.getCommand(SwapLayerCommand.ID),93 m_recorder.commitCommand( 94 SwapLayerCommand.ID, 86 95 { 87 96 "from": from, … … 145 154 146 155 /** 147 * コマンドの書き出し及び実行を同時に行う148 *149 * @param command コマンドオブジェクト150 * @param args コマンドに対する引数151 */152 protected function commitCommand(command:ICommand, args:Object):void153 {154 command.write(m_recorder.logger.bytes, args);155 command.execute(m_recorder);156 }157 158 /**159 156 * 指定された座標が現在の座標と一致するかを確認する 160 157 * … … 248 245 public function set alpha(value:Number):void 249 246 { 250 commitCommand(251 m_logger.getCommand(PenCommand.ID),247 m_recorder.commitCommand( 248 PenCommand.ID, 252 249 { 253 250 "type": PenCommand.ALPHA, … … 260 257 { 261 258 262 commitCommand(263 m_logger.getCommand(PenCommand.ID),259 m_recorder.commitCommand( 260 PenCommand.ID, 264 261 { 265 262 "type": PenCommand.BLEND_MODE, … … 271 268 public function set color(value:uint):void 272 269 { 273 commitCommand(274 m_logger.getCommand(PenCommand.ID),270 m_recorder.commitCommand( 271 PenCommand.ID, 275 272 { 276 273 "type": PenCommand.COLOR, … … 282 279 public function set thickness(value:uint):void 283 280 { 284 commitCommand(285 m_logger.getCommand(PenCommand.ID),281 m_recorder.commitCommand( 282 PenCommand.ID, 286 283 { 287 284 "type": PenCommand.THICKNESS, … … 293 290 public function set layerAlpha(value:Number):void 294 291 { 295 commitCommand(296 m_logger.getCommand(SetLayerAlphaCommand.ID),292 m_recorder.commitCommand( 293 SetLayerAlphaCommand.ID, 297 294 { 298 295 "alpha": value … … 303 300 public function set layerBlendMode(value:String):void 304 301 { 305 commitCommand(306 m_logger.getCommand(SetLayerBlendModeCommand.ID),302 m_recorder.commitCommand( 303 SetLayerBlendModeCommand.ID, 307 304 { 308 305 "blendMode": value … … 313 310 public function set layerIndex(value:uint):void 314 311 { 315 commitCommand(316 m_logger.getCommand(SetLayerIndexCommand.ID),312 m_recorder.commitCommand( 313 SetLayerIndexCommand.ID, 317 314 { 318 315 "index": value … … 352 349 private static var s_shouldStartAfterDrawing:Boolean = false; 353 350 protected var m_recorder:Recorder; 354 protected var m_logger:Logger;355 351 protected var m_drawing:Boolean; 356 352 protected var m_drawingLine:Boolean; as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/DropperModule.as
r3471 r3479 37 37 private function drop(x:Number, y:Number):void 38 38 { 39 // TODO: implement this 40 commitCommand( 41 m_logger.getCommand(PenCommand.ID), 39 m_recorder.commitCommand( 40 PenCommand.ID, 42 41 { 43 42 "type": PenCommand.COLOR, as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/FloodFillModule.as
r3471 r3479 15 15 { 16 16 validateLayerState(); 17 commitCommand(18 m_logger.getCommand(MoveToCommand.ID),17 m_recorder.commitCommand( 18 MoveToCommand.ID, 19 19 getArgumentsFromCoordinate(x, y) 20 20 ); 21 commitCommand(22 m_logger.getCommand(FloodFillCommand.ID),21 m_recorder.commitCommand( 22 FloodFillCommand.ID, 23 23 {} 24 24 ); as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/FreeHandModule.as
r3471 r3479 23 23 setCoordinate(x, y); 24 24 m_drawing = true; 25 commitCommand(26 m_logger.getCommand(MoveToCommand.ID),25 m_recorder.commitCommand( 26 MoveToCommand.ID, 27 27 getArgumentsFromCoordinate(x, y) 28 28 ); … … 32 32 { 33 33 if (m_drawing) { 34 commitCommand(35 m_logger.getCommand(LineToCommand.ID),34 m_recorder.commitCommand( 35 LineToCommand.ID, 36 36 getArgumentsFromCoordinate(x, y) 37 37 ); … … 45 45 var pen:Pen = m_recorder.painter.pen; 46 46 var tempAlpha:Number = pen.alpha; 47 commitCommand(48 m_logger.getCommand(PenCommand.ID),47 m_recorder.commitCommand( 48 PenCommand.ID, 49 49 { 50 50 "type": PenCommand.ALPHA, … … 52 52 } 53 53 ); 54 commitCommand(55 m_logger.getCommand(BeginFillCommand.ID),54 m_recorder.commitCommand( 55 BeginFillCommand.ID, 56 56 { 57 57 "color": pen.color, … … 59 59 } 60 60 ); 61 commitCommand(62 m_logger.getCommand(DrawCircleCommand.ID),61 m_recorder.commitCommand( 62 DrawCircleCommand.ID, 63 63 { "radius": pen.thickness / 2 } 64 64 ); 65 commitCommand(m_logger.getCommand(EndFillCommand.ID), {});66 commitCommand(67 m_logger.getCommand(PenCommand.ID),65 m_recorder.commitCommand(EndFillCommand.ID, {}); 66 m_recorder.commitCommand( 67 PenCommand.ID, 68 68 { 69 69 "type": PenCommand.ALPHA, … … 72 72 ); 73 73 } 74 commitCommand(75 m_logger.getCommand(CompositeCommand.ID),74 m_recorder.commitCommand( 75 CompositeCommand.ID, 76 76 {} 77 77 ); as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/LineModule.as
r3471 r3479 44 44 var from:Object = getArgumentsFromCurrentCoordinate(); 45 45 var to:Object = getArgumentsFromCoordinate(x, y); 46 commitCommand(m_logger.getCommand(MoveToCommand.ID), from);47 commitCommand(m_logger.getCommand(LineToCommand.ID), to);48 commitCommand(m_logger.getCommand(CompositeCommand.ID), {});46 m_recorder.commitCommand(MoveToCommand.ID, from); 47 m_recorder.commitCommand(LineToCommand.ID, to); 48 m_recorder.commitCommand(CompositeCommand.ID, {}); 49 49 } 50 50 m_drawing = false; as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/PixelModule.as
r3471 r3479 38 38 private function setPixel(x:Number, y:Number):void 39 39 { 40 commitCommand(41 m_logger.getCommand(PixelCommand.ID),40 m_recorder.commitCommand( 41 PixelCommand.ID, 42 42 getArgumentsFromCoordinate(x, y) 43 43 );

