From 3b7695fe5000a0ec1528ef782ab993815eed78ab Mon Sep 17 00:00:00 2001 From: Sandy Noble Date: Sat, 30 Mar 2013 11:18:44 +0000 Subject: [PATCH] Image only on webcam page. --- DisplayMachine.pde | 54 +++++++++++---------------------- Panel.pde | 4 +-- controlsSetup.pde | 6 ++-- polargraphcontroller_webcam.pde | 8 +---- 4 files changed, 23 insertions(+), 49 deletions(-) diff --git a/DisplayMachine.pde b/DisplayMachine.pde index c058d09..0dc135c 100644 --- a/DisplayMachine.pde +++ b/DisplayMachine.pde @@ -352,35 +352,6 @@ class DisplayMachine extends Machine noStroke(); // draw machine outline - fill(getMachineColour()); - rect(getOutline().getLeft(), getOutline().getTop(), getOutline().getWidth(), getOutline().getHeight()); - - // draw page - fill(getPageColour()); - rect(getOutline().getLeft()+sc(getPage().getLeft()), - getOutline().getTop()+sc(getPage().getTop()), - sc(getPage().getWidth()), - sc(getPage().getHeight())); - noFill(); - - stroke(getBackgroundColour(),150); - strokeWeight(3); - noFill(); - rect(getOutline().getLeft()-2, getOutline().getTop()-2, getOutline().getWidth()+3, getOutline().getHeight()+3); - - stroke(getMachineColour(),150); - strokeWeight(3); - noFill(); - rect(getOutline().getLeft()+sc(getPage().getLeft())-2, - getOutline().getTop()+sc(getPage().getTop())-2, - sc(getPage().getWidth())+4, - sc(getPage().getHeight())+4); - - if (displayingGuides) - { - drawPictureFrame(); - } - if (drawingLiveVideo) { displayLiveVideo(); @@ -408,19 +379,28 @@ class DisplayMachine extends Machine public void displayLiveVideo() { buildLiveImage(); - // draw actual image + // draw actual image, full size in centre of page + + if (liveImage != null) { - float ox = getOutline().getLeft()+sc(getImageFrame().getLeft()); - float oy = getOutline().getTop()+sc(getImageFrame().getTop()); - float w = sc(getImageFrame().getWidth()); - float h = sc(getImageFrame().getHeight()); + float ox = getPanel(PANEL_NAME_WEBCAM).getOutline().getRight()+7; + float oy = getPanel(PANEL_NAME_GENERAL).getOutline().getTop(); + + // calculate height. 640 pixels stretched to + float aspectRatio = 480.0/640.0; // rotated, remember + float h = height - getPanel(PANEL_NAME_GENERAL).getOutline().getTop() -10; + float w = h * aspectRatio; + + stroke(255); + rect(ox,oy,w,h); + tint(255, getImageTransparency()); - translate(ox, oy); + translate(ox, oy+h); rotate(radians(270)); - image(liveImage, 0, 0, w, h); + image(liveImage, 0, 0, h, w); rotate(radians(-270)); - translate(-ox,-oy); + translate(-ox, -(oy+h)); noTint(); noFill(); } diff --git a/Panel.pde b/Panel.pde index 03d5f8d..cfaca11 100644 --- a/Panel.pde +++ b/Panel.pde @@ -131,14 +131,12 @@ class Panel { for (Controller c : this.getControls()) { - println("Control: " + c.name()); + //println("Control: " + c.name()); PVector pos = getControlPositions().get(c.name()); float x = pos.x+getOutline().getLeft(); float y = pos.y+getOutline().getTop(); c.setPosition(x, y); - println("controlsizes: " + getControlSizes()); - PVector cSize = getControlSizes().get(c.name()); c.setSize((int)cSize.x, (int)cSize.y); diff --git a/controlsSetup.pde b/controlsSetup.pde index c8c256e..670dd88 100644 --- a/controlsSetup.pde +++ b/controlsSetup.pde @@ -136,8 +136,8 @@ Map buildPanels() webcamPanel.setResizable(true); webcamPanel.setControls(getControlsForPanels().get(PANEL_NAME_WEBCAM)); // get control positions - rovingPanel.setControlPositions(buildControlPositionsForPanel(webcamPanel)); - rovingPanel.setControlSizes(buildControlSizesForPanel(webcamPanel)); + webcamPanel.setControlPositions(buildControlPositionsForPanel(webcamPanel)); + webcamPanel.setControlSizes(buildControlSizesForPanel(webcamPanel)); panels.put(PANEL_NAME_WEBCAM, webcamPanel); Panel detailsPanel = new Panel(PANEL_NAME_DETAILS, panelOutline); @@ -579,6 +579,7 @@ Map buildControlPositionsForPanel(Panel panel) } Map buildControlSizesForPanel(Panel panel) { + println("Building control sizes for panel " + panel.getName()); Map map = new HashMap(); String panelName = panel.getName(); int col = 0; @@ -594,6 +595,7 @@ Map buildControlSizesForPanel(Panel panel) { PVector s = new PVector(DEFAULT_CONTROL_SIZE.x, DEFAULT_CONTROL_SIZE.y); map.put(controller.name(), s); + println("Added size of " + controller.name() + " to panel. " + s); } } diff --git a/polargraphcontroller_webcam.pde b/polargraphcontroller_webcam.pde index 117f949..4f9d8c8 100644 --- a/polargraphcontroller_webcam.pde +++ b/polargraphcontroller_webcam.pde @@ -312,7 +312,7 @@ static final String MODE_LIVE_POSTERISE_VALUE = "numberbox_mode_livePosteriseVal static final String MODE_LIVE_CAPTURE_FROM_LIVE = "button_mode_liveCaptureFromLive"; -PVector statusTextPosition = new PVector(240.0, 12.0); +PVector statusTextPosition = new PVector(300.0, 12.0); static String currentMode = MODE_BEGIN; static String lastMode = MODE_BEGIN; @@ -795,19 +795,13 @@ void drawWebcamPage() for (Panel panel : getPanelsForTab(TAB_NAME_WEBCAM)) { - println("Panel:" + panel); panel.draw(); } - text(propertiesFilename, getPanel(PANEL_NAME_GENERAL).getOutline().getLeft(), getPanel(PANEL_NAME_GENERAL).getOutline().getTop()-7); -// showCurrentMachinePosition(); - showGroupBox(); - showCurrentMachinePosition(); if (displayingInfoTextOnInputPage) showText(250,45); drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y); - showCommandQueue((int) getDisplayMachine().getOutline().getRight()+6, 20); } void drawCommandQueuePage()