From 6f87e2fabf8520b56429b73f0376b378d8446827 Mon Sep 17 00:00:00 2001 From: Sandy Noble Date: Sun, 28 Apr 2013 10:47:01 +0100 Subject: [PATCH] Added new rove features, swirling, render. --- DisplayMachine.pde | 4 ++-- controlsActions.pde | 14 ++++++++++++++ controlsSetup.pde | 20 +++++++++++++++----- drawing.pde | 14 +++++++++----- polargraphcontroller.pde | 3 +++ 5 files changed, 43 insertions(+), 12 deletions(-) diff --git a/DisplayMachine.pde b/DisplayMachine.pde index 0bf60a2..2e97b2f 100644 --- a/DisplayMachine.pde +++ b/DisplayMachine.pde @@ -382,8 +382,8 @@ class DisplayMachine extends Machine float aspectRatio = (rotateWebcamImage) ? 480.0/640.0 : 640.0/480.0; // rotated, remember float h = height - getPanel(PANEL_NAME_GENERAL).getOutline().getTop() -10; float w = h * (480.0/640.0); - println("height: " + h + ", width: " + w); - println("origin x: " + ox + ", y: " + oy); +// println("height: " + h + ", width: " + w); +// println("origin x: " + ox + ", y: " + oy); if (rotateWebcamImage) { diff --git a/controlsActions.pde b/controlsActions.pde index 200c6a6..ace3a09 100644 --- a/controlsActions.pde +++ b/controlsActions.pde @@ -650,6 +650,20 @@ void button_mode_sendRoveArea() } } +void button_mode_selectRoveImageSource() +{ + addToCommandQueue(CMD_SELECT_ROVE_SOURCE_IMAGE+",w1.pbm,END"); +} +void button_mode_startMarking() +{ + // C47,,,END + addToCommandQueue(CMD_RENDER_ROVE+",1,1,END"); +} +void button_mode_stopMarking() +{ + addToCommandQueue(CMD_RENDER_ROVE+",0,0,END"); +} + void toggle_mode_sendStartText(boolean flag) { if (flag) diff --git a/controlsSetup.pde b/controlsSetup.pde index 06cf76a..164363b 100644 --- a/controlsSetup.pde +++ b/controlsSetup.pde @@ -710,13 +710,17 @@ List getControlNamesForRovingPanel() controlNames.add(MODE_SEND_START_TEXT); controlNames.add(MODE_CHANGE_GRID_SIZE); controlNames.add(MODE_SHOW_WRITING_DIALOG); -// controlNames.add(MODE_START_SWIRLING); -// controlNames.add(MODE_STOP_SWIRLING); -// controlNames.add(MODE_START_SPRITE); -// controlNames.add(MODE_START_RANDOM_SPRITES); -// controlNames.add(MODE_STOP_RANDOM_SPRITES); + controlNames.add(MODE_START_SWIRLING); + controlNames.add(MODE_STOP_SWIRLING); + controlNames.add(MODE_START_MARKING); + controlNames.add(MODE_STOP_MARKING); + controlNames.add(MODE_SELECT_ROVE_IMAGE_SOURCE); + controlNames.add(MODE_START_SPRITE); + controlNames.add(MODE_START_RANDOM_SPRITES); + controlNames.add(MODE_STOP_RANDOM_SPRITES); controlNames.add(MODE_DRAW_NORWEGIAN_DIALOG); + return controlNames; } @@ -924,11 +928,14 @@ Map buildControlLabels() result.put(MODE_SEND_PEN_LIFT_RANGE_PERSIST, "Upload lift range"); result.put(MODE_SEND_ROVE_AREA, "Send Roving Area"); + result.put(MODE_SELECT_ROVE_IMAGE_SOURCE, "Choose source image"); result.put(MODE_SEND_START_TEXT, "Start text at point"); result.put(MODE_SHOW_WRITING_DIALOG, "Render writing..."); result.put(MODE_START_SWIRLING, "Swirl"); result.put(MODE_STOP_SWIRLING, "Stop swirl"); + result.put(MODE_START_MARKING, "Mark"); + result.put(MODE_STOP_MARKING, "Stop marking"); result.put(MODE_START_SPRITE, "Choose sprite..."); result.put(MODE_START_RANDOM_SPRITES, "Random sprites"); result.put(MODE_STOP_RANDOM_SPRITES, "Stop sprites"); @@ -1063,10 +1070,13 @@ Set buildControlNames() result.add(MODE_SEND_PEN_LIFT_RANGE_PERSIST); result.add(MODE_SEND_ROVE_AREA); + result.add(MODE_SELECT_ROVE_IMAGE_SOURCE); result.add(MODE_SEND_START_TEXT); result.add(MODE_SHOW_WRITING_DIALOG); result.add(MODE_START_SWIRLING); result.add(MODE_STOP_SWIRLING); + result.add(MODE_START_MARKING); + result.add(MODE_STOP_MARKING); result.add(MODE_START_SPRITE); result.add(MODE_START_RANDOM_SPRITES); result.add(MODE_STOP_RANDOM_SPRITES); diff --git a/drawing.pde b/drawing.pde index 378d639..13ec7b1 100644 --- a/drawing.pde +++ b/drawing.pde @@ -70,6 +70,8 @@ static final String CMD_DRAW_RANDOM_SPRITE = "C42,"; static final String CMD_DRAW_NORWEGIAN = "C43,"; static final String CMD_DRAW_NORWEGIAN_OUTLINE = "C44,"; static final String CMD_SETPENLIFTRANGE = "C45,"; +static final String CMD_SELECT_ROVE_SOURCE_IMAGE = "C46"; +static final String CMD_RENDER_ROVE = "C47"; static final int PATH_SORT_NONE = 0; static final int PATH_SORT_MOST_POINTS_FIRST = 1; @@ -632,20 +634,22 @@ void sendOutlineOfBox() tr = getDisplayMachine().asNativeCoords(tr); bl = getDisplayMachine().asNativeCoords(bl); br = getDisplayMachine().asNativeCoords(br); + + String cmd = (true) ? CMD_CHANGELENGTHDIRECT : CMD_CHANGELENGTH; - String command = CMD_CHANGELENGTHDIRECT+(int)tl.x+","+(int)tl.y+","+getMaxSegmentLength()+",END"; + String command = cmd+(int)tl.x+","+(int)tl.y+","+getMaxSegmentLength()+",END"; addToCommandQueue(command); - command = CMD_CHANGELENGTHDIRECT+(int)tr.x+","+(int)tr.y+","+getMaxSegmentLength()+",END"; + command = cmd+(int)tr.x+","+(int)tr.y+","+getMaxSegmentLength()+",END"; addToCommandQueue(command); - command = CMD_CHANGELENGTHDIRECT+(int)br.x+","+(int)br.y+","+getMaxSegmentLength()+",END"; + command = cmd+(int)br.x+","+(int)br.y+","+getMaxSegmentLength()+",END"; addToCommandQueue(command); - command = CMD_CHANGELENGTHDIRECT+(int)bl.x+","+(int)bl.y+","+getMaxSegmentLength()+",END"; + command = cmd+(int)bl.x+","+(int)bl.y+","+getMaxSegmentLength()+",END"; addToCommandQueue(command); - command = CMD_CHANGELENGTHDIRECT+(int)tl.x+","+(int)tl.y+","+getMaxSegmentLength()+",END"; + command = cmd+(int)tl.x+","+(int)tl.y+","+getMaxSegmentLength()+",END"; addToCommandQueue(command); } diff --git a/polargraphcontroller.pde b/polargraphcontroller.pde index e9a2f23..023006b 100644 --- a/polargraphcontroller.pde +++ b/polargraphcontroller.pde @@ -294,6 +294,7 @@ static final String MODE_SEND_PEN_LIFT_RANGE = "button_mode_sendPenliftRange"; static final String MODE_SEND_PEN_LIFT_RANGE_PERSIST = "button_mode_sendPenliftRangePersist"; static final String MODE_SEND_ROVE_AREA = "button_mode_sendRoveArea"; +static final String MODE_SELECT_ROVE_IMAGE_SOURCE = "button_mode_selectRoveImageSource"; static final String MODE_SEND_START_TEXT = "toggle_mode_sendStartText"; // controls to do with text start static final String MODE_CHANGE_TEXT_ROW_SIZE = "numberbox_mode_changeTextRowSize"; @@ -302,6 +303,8 @@ static final String MODE_CHANGE_TEXT_ROW_SPACING = "numberbox_mode_changeTextRow static final String MODE_SHOW_WRITING_DIALOG = "button_mode_drawWritingDialog"; static final String MODE_START_SWIRLING = "button_mode_startSwirling"; static final String MODE_STOP_SWIRLING = "button_mode_stopSwirling"; +static final String MODE_START_MARKING = "button_mode_startMarking"; +static final String MODE_STOP_MARKING = "button_mode_stopMarking"; static final String MODE_START_SPRITE = "button_mode_drawSpriteDialog"; static final String MODE_START_RANDOM_SPRITES = "button_mode_startRandomSprite"; static final String MODE_STOP_RANDOM_SPRITES = "button_mode_stopRandomSprites";