Fix for GAPPY pixel drawings, rounding down grid size every time, thanks Kong and Nosetinker.

This commit is contained in:
Sandy Noble 2014-03-10 21:29:13 +00:00
parent 51c34e65d2
commit ecf9c46645
3 changed files with 17 additions and 16 deletions

View File

@ -333,11 +333,11 @@ void button_mode_loadVectorFile()
} }
void numberbox_mode_pixelBrightThreshold(float value) void numberbox_mode_pixelBrightThreshold(float value)
{ {
pixelExtractBrightThreshold = int(value+0.5); pixelExtractBrightThreshold = (int) value;
} }
void numberbox_mode_pixelDarkThreshold(float value) void numberbox_mode_pixelDarkThreshold(float value)
{ {
pixelExtractDarkThreshold = int(value+0.5); pixelExtractDarkThreshold = (int) value;
} }
void button_mode_pauseQueue() void button_mode_pauseQueue()
@ -524,13 +524,13 @@ void toggle_mode_moveVector(boolean flag)
void numberbox_mode_changeMachineWidth(float value) void numberbox_mode_changeMachineWidth(float value)
{ {
clearBoxVectors(); clearBoxVectors();
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getSize().x = steps; getDisplayMachine().getSize().x = steps;
} }
void numberbox_mode_changeMachineHeight(float value) void numberbox_mode_changeMachineHeight(float value)
{ {
clearBoxVectors(); clearBoxVectors();
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getSize().y = steps; getDisplayMachine().getSize().y = steps;
} }
void numberbox_mode_changeMMPerRev(float value) void numberbox_mode_changeMMPerRev(float value)
@ -553,22 +553,22 @@ void numberbox_mode_changeMinVectorLineLength(float value)
} }
void numberbox_mode_changePageWidth(float value) void numberbox_mode_changePageWidth(float value)
{ {
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getPage().setWidth(steps); getDisplayMachine().getPage().setWidth(steps);
} }
void numberbox_mode_changePageHeight(float value) void numberbox_mode_changePageHeight(float value)
{ {
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getPage().setHeight(steps); getDisplayMachine().getPage().setHeight(steps);
} }
void numberbox_mode_changePageOffsetX(float value) void numberbox_mode_changePageOffsetX(float value)
{ {
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getPage().getTopLeft().x = steps; getDisplayMachine().getPage().getTopLeft().x = steps;
} }
void numberbox_mode_changePageOffsetY(float value) void numberbox_mode_changePageOffsetY(float value)
{ {
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getDisplayMachine().getPage().getTopLeft().y = steps; getDisplayMachine().getPage().getTopLeft().y = steps;
} }
void button_mode_changePageOffsetXCentre() void button_mode_changePageOffsetXCentre()
@ -576,25 +576,25 @@ void button_mode_changePageOffsetXCentre()
float pageWidth = getDisplayMachine().getPage().getWidth(); float pageWidth = getDisplayMachine().getPage().getWidth();
float machineWidth = getDisplayMachine().getSize().x; float machineWidth = getDisplayMachine().getSize().x;
float diff = (machineWidth - pageWidth) / 2.0; float diff = (machineWidth - pageWidth) / 2.0;
getDisplayMachine().getPage().getTopLeft().x = diff; getDisplayMachine().getPage().getTopLeft().x = (int) diff;
initialiseNumberboxValues(getAllControls()); initialiseNumberboxValues(getAllControls());
} }
void numberbox_mode_changeHomePointX(float value) void numberbox_mode_changeHomePointX(float value)
{ {
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getHomePoint().x = steps; getHomePoint().x = steps;
} }
void numberbox_mode_changeHomePointY(float value) void numberbox_mode_changeHomePointY(float value)
{ {
float steps = getDisplayMachine().inSteps(value); float steps = getDisplayMachine().inSteps((int) value);
getHomePoint().y = steps; getHomePoint().y = steps;
} }
void button_mode_changeHomePointXCentre() void button_mode_changeHomePointXCentre()
{ {
float halfWay = getDisplayMachine().getSize().x / 2.0; float halfWay = getDisplayMachine().getSize().x / 2.0;
getHomePoint().x = halfWay; getHomePoint().x = (int) halfWay;
getHomePoint().y = getDisplayMachine().getPage().getTop(); getHomePoint().y = (int) getDisplayMachine().getPage().getTop();
initialiseNumberboxValues(getAllControls()); initialiseNumberboxValues(getAllControls());
} }

View File

@ -34,7 +34,7 @@
void button_mode_serialPortDialog() void button_mode_serialPortDialog()
{ {
ControlWindow serialPortWindow = cp5.addControlWindow("changeSerialPortWindow",100,100,150,150); ControlWindow serialPortWindow = cp5.addControlWindow("changeSerialPortWindow",100,100,150,350);
serialPortWindow.hideCoordinates(); serialPortWindow.hideCoordinates();
serialPortWindow.setBackground(getBackgroundColour()); serialPortWindow.setBackground(getBackgroundColour());

View File

@ -51,7 +51,7 @@ import java.awt.event.KeyEvent;
import java.awt.event.*; import java.awt.event.*;
int majorVersionNo = 1; int majorVersionNo = 1;
int minorVersionNo = 61; int minorVersionNo = 7;
int buildNo = 0; int buildNo = 0;
String programTitle = "Polargraph Controller v" + majorVersionNo + "." + minorVersionNo + " build " + buildNo; String programTitle = "Polargraph Controller v" + majorVersionNo + "." + minorVersionNo + " build " + buildNo;
@ -1201,7 +1201,8 @@ float getGridSize()
} }
void setGridSize(float s) void setGridSize(float s)
{ {
this.gridSize = s; // round it down
this.gridSize = s;//(int)s;
} }
void setSampleArea(float v) void setSampleArea(float v)