Ants marching effect for segmentation

-using slanted background for marching ants
    -added console object for debugging flascc swc's
This commit is contained in:
Benjamin Berg 2015-12-01 14:25:53 -05:00
parent 7cd8c7c934
commit abcac9d0b6
4 changed files with 74 additions and 7 deletions

Binary file not shown.

View file

@ -946,7 +946,7 @@ package svgeditor {
public function applySegmentationMask(ib:IconButton):void{ public function applySegmentationMask(ib:IconButton):void{
if(segmentationTool){ if(segmentationTool){
segmentationTool.commitMask(); segmentationTool.commitMask();
drawPropsUI.sendChangeEvent() refreshSegmentationMode();
} }
} }

View file

@ -0,0 +1,51 @@
/**
* Created by Mallory on 11/30/15.
*/
package svgeditor.objs {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;
import grabcut.CModule;
import grabcut.vfs.ISpecialFile;
public class FlasccConsole extends Sprite implements ISpecialFile {
private var tf:TextField;
public function SampleApplication():void {
addEventListener(Event.ADDED_TO_STAGE, initCode);
}
private function initCode(e:Event):void {
tf = new TextField();
addChild(tf);
tf.appendText("SWC Output:\n");
// call a C++ function that calls printf
var func:int = CModule.getPublicSymbol("test")
var result:int = CModule.callI(func, new Vector.<int>());
}
/**
* The PlayerKernel implementation will use this function to handle
* C IO write requests to the file "/dev/tty" (e.g. output from
* printf will pass through this function). See the ISpecialFile
* documentation for more information about the arguments and return value.
*/
public function write(fd:int, bufPtr:int, nbyte:int, errnoPtr:int):int
{
var str:String = CModule.readString(bufPtr, nbyte);
tf.appendText(str);
trace(str);
return nbyte;
}
/** See ISpecialFile */
public function read(fd:int, bufPtr:int, nbyte:int, errnoPtr:int):int { return 0; }
public function fcntl(fd:int, com:int, data:int, errnoPtr:int):int { return 0; }
public function ioctl(fd:int, com:int, data:int, errnoPtr:int):int { return 0; }
}
}

View file

@ -22,23 +22,32 @@ import flash.ui.Mouse;
import flash.utils.ByteArray; import flash.utils.ByteArray;
import flash.utils.Timer; import flash.utils.Timer;
import grabcut.vfs.ISpecialFile
import grabcut.CModule; import grabcut.CModule;
import grabcut_2F_var_2F_folders_2F_6q_2F_k8f6r3f11mz7vklyw3c3_thc0000gn_2F_T_2F__2F_ccWVlzPy_2E_o_3A_2533C483_2D_20F9_2D_49F2_2D_96B7_2D_F80F19E622DF.__GLOBAL__D_objectColors;
import scratch.ScratchCostume; import scratch.ScratchCostume;
import svgeditor.ImageCanvas; import svgeditor.ImageCanvas;
import svgeditor.ImageEdit; import svgeditor.ImageEdit;
import svgeditor.objs.FlasccConsole;
import svgeditor.objs.SegmentationState; import svgeditor.objs.SegmentationState;
import uiwidgets.EditableLabel; import uiwidgets.EditableLabel;
import util.Base64Encoder; import util.Base64Encoder;
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.Event;
public class BitmapBackgroundTool extends BitmapPencilTool{ public class BitmapBackgroundTool extends BitmapPencilTool{
static public const GOTMASK:String='got_mask'; static public const GOTMASK:String='got_mask';
static private const SCALE_FACTOR:Number = .5; static private const SCALE_FACTOR:Number = .5;
@ -124,7 +133,11 @@ public class BitmapBackgroundTool extends BitmapPencilTool{
public function BitmapBackgroundTool(editor:ImageEdit){ public function BitmapBackgroundTool(editor:ImageEdit){
if(!startedAsync){ if(!startedAsync){
// var console:FlasccConsole = new FlasccConsole();
// CModule.vfs.console = console;
// console.SampleApplication();
CModule.startAsync(); CModule.startAsync();
// editor.addChild(console);
startedAsync=true; startedAsync=true;
} }
previewFrameBackgrounds.push( previewFrameBackgrounds.push(
@ -437,6 +450,7 @@ public class BitmapBackgroundTool extends BitmapPencilTool{
} }
public function restoreUnmarked():void{ public function restoreUnmarked():void{
timer.stop();
workingScribble.fillRect(workingScribble.rect, 0); workingScribble.fillRect(workingScribble.rect, 0);
editor.getWorkArea().getBitmap().visible = true; editor.getWorkArea().getBitmap().visible = true;
} }
@ -446,10 +460,12 @@ public class BitmapBackgroundTool extends BitmapPencilTool{
timer.stop(); timer.stop();
editor.getWorkArea().getBitmap().visible = true; editor.getWorkArea().getBitmap().visible = true;
applyMask(lastMask, workingBitmap); applyMask(lastMask, workingBitmap);
workingScribble.fillRect(scribbleBitmap.rect, 0x00000000); editor.targetCostume.segmentationState.reset();
scribbleBitmap.fillRect(scribbleBitmap.rect, 0x00000000); loadState();
lastMask = null; /// workingScribble.fillRect(scribbleBitmap.rect, 0x00000000);
isGreyscale = false; /// scribbleBitmap.fillRect(scribbleBitmap.rect, 0x00000000);
/// lastMask = null;
/// isGreyscale = false;
editor.saveContent(); editor.saveContent();
} }
} }