Image only on webcam page.

This commit is contained in:
Sandy Noble 2013-03-30 11:18:44 +00:00
parent 5c1755f1a0
commit 3b7695fe50
4 changed files with 23 additions and 49 deletions

View File

@ -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();
}

View File

@ -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);

View File

@ -136,8 +136,8 @@ Map<String, Panel> 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<String, PVector> buildControlPositionsForPanel(Panel panel)
}
Map<String, PVector> buildControlSizesForPanel(Panel panel)
{
println("Building control sizes for panel " + panel.getName());
Map<String, PVector> map = new HashMap<String, PVector>();
String panelName = panel.getName();
int col = 0;
@ -594,6 +595,7 @@ Map<String, PVector> 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);
}
}

View File

@ -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()