mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Added the option to specify a gap from the border
Former-commit-id: 52280948a231cc89065daed7cc620262680ea512
This commit is contained in:
parent
4a9690bcb3
commit
5c12a3c716
@ -1 +1 @@
|
||||
e1a5c21a08898d43ee3adcbc8956c79ae6619980
|
||||
444584e630a6e3303b8d2828e128a7cad191f5e3
|
@ -183,51 +183,88 @@ public class LedFrameFactory {
|
||||
led.mLocation = new Point2D.Double(x_frac, y_frac);
|
||||
led.mSide = pBorderSide;
|
||||
|
||||
double widthFrac = (1.0/pFrameSpec.topLedCnt * (1.0 + overlap_frac))/2.0;
|
||||
double heightFrac = (1.0/pFrameSpec.leftLedCnt * (1.0 + overlap_frac))/2.0;
|
||||
double xFrac = pProcessSpec.getVerticalGap() + (1.0-2*pProcessSpec.getVerticalGap()) * x_frac;
|
||||
double yFrac = pProcessSpec.getHorizontalGap() + (1.0-2*pProcessSpec.getHorizontalGap()) * y_frac;
|
||||
double widthFrac = ((1.0-2*pProcessSpec.getVerticalGap())/pFrameSpec.topLedCnt * (1.0 + overlap_frac))/2.0;
|
||||
double heightFrac = ((1.0-2*pProcessSpec.getHorizontalGap())/pFrameSpec.leftLedCnt * (1.0 + overlap_frac))/2.0;
|
||||
|
||||
double horizontalDepth = Math.min(1.0 - pProcessSpec.getHorizontalGap(), pProcessSpec.getHorizontalDepth());
|
||||
double verticalDepth = Math.min(1.0 - pProcessSpec.getVerticalGap(), pProcessSpec.getVerticalDepth());
|
||||
|
||||
switch (pBorderSide) {
|
||||
case top_left: {
|
||||
led.mImageRectangle = new Rectangle2D.Double(0.0, 0.0, pProcessSpec.getVerticalDepth(), pProcessSpec.getHorizontalDepth());
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
pProcessSpec.getVerticalGap(),
|
||||
pProcessSpec.getHorizontalGap(),
|
||||
verticalDepth,
|
||||
horizontalDepth);
|
||||
break;
|
||||
}
|
||||
case top_right: {
|
||||
led.mImageRectangle = new Rectangle2D.Double(1.0-pProcessSpec.getVerticalDepth(), 0.0, pProcessSpec.getVerticalDepth(), pProcessSpec.getHorizontalDepth());
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
1.0-pProcessSpec.getVerticalGap()-verticalDepth,
|
||||
pProcessSpec.getHorizontalGap(),
|
||||
verticalDepth,
|
||||
horizontalDepth);
|
||||
break;
|
||||
}
|
||||
case bottom_left: {
|
||||
led.mImageRectangle = new Rectangle2D.Double(0.0, 1.0-pProcessSpec.getHorizontalDepth(), pProcessSpec.getVerticalDepth(), pProcessSpec.getHorizontalDepth());
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
pProcessSpec.getVerticalGap(),
|
||||
1.0-pProcessSpec.getHorizontalGap()-horizontalDepth,
|
||||
verticalDepth,
|
||||
horizontalDepth);
|
||||
break;
|
||||
}
|
||||
case bottom_right: {
|
||||
led.mImageRectangle = new Rectangle2D.Double(1.0-pProcessSpec.getVerticalDepth(), 1.0-pProcessSpec.getHorizontalDepth(), pProcessSpec.getVerticalDepth(), pProcessSpec.getHorizontalDepth());
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
1.0-pProcessSpec.getVerticalGap()-verticalDepth,
|
||||
1.0-pProcessSpec.getHorizontalGap()-horizontalDepth,
|
||||
verticalDepth,
|
||||
horizontalDepth);
|
||||
break;
|
||||
}
|
||||
case top:{
|
||||
double intXmin_frac = Math.max(0.0, x_frac-widthFrac);
|
||||
double intXmax_frac = Math.min(x_frac+widthFrac, 1.0);
|
||||
led.mImageRectangle = new Rectangle2D.Double(intXmin_frac, 0.0, intXmax_frac-intXmin_frac, pProcessSpec.getHorizontalDepth());
|
||||
double intXmin_frac = Math.max(0.0, xFrac-widthFrac);
|
||||
double intXmax_frac = Math.min(xFrac+widthFrac, 1.0);
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
intXmin_frac,
|
||||
pProcessSpec.getHorizontalGap(),
|
||||
intXmax_frac-intXmin_frac,
|
||||
horizontalDepth);
|
||||
|
||||
break;
|
||||
}
|
||||
case bottom:
|
||||
{
|
||||
double intXmin_frac = Math.max(0.0, x_frac-widthFrac);
|
||||
double intXmax_frac = Math.min(x_frac+widthFrac, 1.0);
|
||||
double intXmin_frac = Math.max(0.0, xFrac-widthFrac);
|
||||
double intXmax_frac = Math.min(xFrac+widthFrac, 1.0);
|
||||
|
||||
led.mImageRectangle = new Rectangle2D.Double(intXmin_frac, 1.0-pProcessSpec.getHorizontalDepth(), intXmax_frac-intXmin_frac, pProcessSpec.getHorizontalDepth());
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
intXmin_frac,
|
||||
1.0-pProcessSpec.getHorizontalGap()-horizontalDepth,
|
||||
intXmax_frac-intXmin_frac,
|
||||
horizontalDepth);
|
||||
break;
|
||||
}
|
||||
case left: {
|
||||
double intYmin_frac = Math.max(0.0, y_frac-heightFrac);
|
||||
double intYmax_frac = Math.min(y_frac+heightFrac, 1.0);
|
||||
led.mImageRectangle = new Rectangle2D.Double(0.0, intYmin_frac, pProcessSpec.getVerticalDepth(), intYmax_frac-intYmin_frac);
|
||||
double intYmin_frac = Math.max(0.0, yFrac-heightFrac);
|
||||
double intYmax_frac = Math.min(yFrac+heightFrac, 1.0);
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
pProcessSpec.getVerticalGap(),
|
||||
intYmin_frac,
|
||||
verticalDepth,
|
||||
intYmax_frac-intYmin_frac);
|
||||
break;
|
||||
}
|
||||
case right:
|
||||
double intYmin_frac = Math.max(0.0, y_frac-heightFrac);
|
||||
double intYmax_frac = Math.min(y_frac+heightFrac, 1.0);
|
||||
led.mImageRectangle = new Rectangle2D.Double(1.0-pProcessSpec.getVerticalDepth(), intYmin_frac, pProcessSpec.getVerticalDepth(), intYmax_frac-intYmin_frac);
|
||||
double intYmin_frac = Math.max(0.0, yFrac-heightFrac);
|
||||
double intYmax_frac = Math.min(yFrac+heightFrac, 1.0);
|
||||
led.mImageRectangle = new Rectangle2D.Double(
|
||||
1.0-pProcessSpec.getVerticalGap()-verticalDepth,
|
||||
intYmin_frac,
|
||||
verticalDepth,
|
||||
intYmax_frac-intYmin_frac);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class Main {
|
||||
// Create a frame for the configuration panel
|
||||
JFrame frame = new JFrame();
|
||||
frame.setTitle("Hyperion configuration Tool");
|
||||
frame.setSize(1300, 600);
|
||||
frame.setSize(1300, 620);
|
||||
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
frame.setIconImage(new ImageIcon(Main.class.getResource("HyperConIcon_64.png")).getImage());
|
||||
|
||||
|
@ -25,7 +25,12 @@ public class ImageProcessPanel extends JPanel implements Observer {
|
||||
private JSpinner mHorizontalDepthSpinner;
|
||||
private JLabel mVerticalDepthLabel;
|
||||
private JSpinner mVerticalDepthSpinner;
|
||||
|
||||
|
||||
private JLabel mHorizontalGapLabel;
|
||||
private JSpinner mHorizontalGapSpinner;
|
||||
private JLabel mVerticalGapLabel;
|
||||
private JSpinner mVerticalGapSpinner;
|
||||
|
||||
private JLabel mOverlapLabel;
|
||||
private JSpinner mOverlapSpinner;
|
||||
|
||||
@ -65,6 +70,28 @@ public class ImageProcessPanel extends JPanel implements Observer {
|
||||
mVerticalDepthSpinner.addChangeListener(mChangeListener);
|
||||
add(mVerticalDepthSpinner);
|
||||
|
||||
mHorizontalGapLabel = new JLabel("Horizontal gap [%]:");
|
||||
mHorizontalGapLabel.setPreferredSize(new Dimension(100, 30));
|
||||
mHorizontalGapLabel.setMaximumSize(new Dimension(150, 30));
|
||||
add(mHorizontalGapLabel);
|
||||
|
||||
mHorizontalGapSpinner = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 50.0, 1.0));
|
||||
mHorizontalGapSpinner.setPreferredSize(new Dimension(150, 30));
|
||||
mHorizontalGapSpinner.setMaximumSize(new Dimension(250, 30));
|
||||
mHorizontalGapSpinner.addChangeListener(mChangeListener);
|
||||
add(mHorizontalGapSpinner);
|
||||
|
||||
mVerticalGapLabel = new JLabel("Vertical gap [%]:");
|
||||
mVerticalGapLabel.setPreferredSize(new Dimension(100, 30));
|
||||
mVerticalGapLabel.setMaximumSize(new Dimension(150, 30));
|
||||
add(mVerticalGapLabel);
|
||||
|
||||
mVerticalGapSpinner = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 50.0, 1.0));
|
||||
mVerticalGapSpinner.setPreferredSize(new Dimension(150, 30));
|
||||
mVerticalGapSpinner.setMaximumSize(new Dimension(250, 30));
|
||||
mVerticalGapSpinner.addChangeListener(mChangeListener);
|
||||
add(mVerticalGapSpinner);
|
||||
|
||||
mOverlapLabel = new JLabel("Overlap [%]:");
|
||||
mOverlapLabel.setPreferredSize(new Dimension(100, 30));
|
||||
mOverlapLabel.setMaximumSize(new Dimension(150, 30));
|
||||
@ -93,12 +120,16 @@ public class ImageProcessPanel extends JPanel implements Observer {
|
||||
.addGroup(layout.createParallelGroup()
|
||||
.addComponent(mHorizontalDepthLabel)
|
||||
.addComponent(mVerticalDepthLabel)
|
||||
.addComponent(mHorizontalGapLabel)
|
||||
.addComponent(mVerticalGapLabel)
|
||||
.addComponent(mOverlapLabel)
|
||||
.addComponent(mBlackborderDetectorLabel)
|
||||
)
|
||||
.addGroup(layout.createParallelGroup()
|
||||
.addComponent(mHorizontalDepthSpinner)
|
||||
.addComponent(mVerticalDepthSpinner)
|
||||
.addComponent(mHorizontalGapSpinner)
|
||||
.addComponent(mVerticalGapSpinner)
|
||||
.addComponent(mOverlapSpinner)
|
||||
.addComponent(mBlackborderDetectorCombo)
|
||||
)
|
||||
@ -112,6 +143,14 @@ public class ImageProcessPanel extends JPanel implements Observer {
|
||||
.addComponent(mVerticalDepthLabel)
|
||||
.addComponent(mVerticalDepthSpinner)
|
||||
)
|
||||
.addGroup(layout.createParallelGroup()
|
||||
.addComponent(mHorizontalGapLabel)
|
||||
.addComponent(mHorizontalGapSpinner)
|
||||
)
|
||||
.addGroup(layout.createParallelGroup()
|
||||
.addComponent(mVerticalGapLabel)
|
||||
.addComponent(mVerticalGapSpinner)
|
||||
)
|
||||
.addGroup(layout.createParallelGroup()
|
||||
.addComponent(mOverlapLabel)
|
||||
.addComponent(mOverlapSpinner)
|
||||
@ -147,6 +186,8 @@ public class ImageProcessPanel extends JPanel implements Observer {
|
||||
// Update the processing configuration
|
||||
mProcessConfig.setHorizontalDepth(((Double)mHorizontalDepthSpinner.getValue())/100.0);
|
||||
mProcessConfig.setVerticalDepth(((Double)mVerticalDepthSpinner.getValue())/100.0);
|
||||
mProcessConfig.setHorizontalGap(((Double)mHorizontalGapSpinner.getValue())/100.0);
|
||||
mProcessConfig.setVerticalGap(((Double)mVerticalGapSpinner.getValue())/100.0);
|
||||
mProcessConfig.setOverlapFraction(((Double)mOverlapSpinner.getValue())/100.0);
|
||||
|
||||
// Notify observers
|
||||
|
@ -15,6 +15,11 @@ public class ImageProcessConfig extends Observable {
|
||||
private double mHorizontalDepth = 0.08;
|
||||
/** The 'integration depth' of the leds along the vertical axis of the tv */
|
||||
private double mVerticalDepth = 0.05;
|
||||
|
||||
/** The gap between the border integration area for the horizontal leds */
|
||||
private double mHorizontalGap = 0.0;
|
||||
/** The gap between the border integration area for the vertical leds */
|
||||
private double mVerticalGap = 0.0;
|
||||
|
||||
/** The fraction of overlap from one to another led */
|
||||
private double mOverlapFraction = 0.0;
|
||||
@ -45,6 +50,29 @@ public class ImageProcessConfig extends Observable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the horizontal gap (top and bottom) of the image integration area from the side of the
|
||||
* screen [0.0; 1.0]
|
||||
*
|
||||
* @return The horizontal gap [0.0; 1.0]
|
||||
*/
|
||||
public double getHorizontalGap() {
|
||||
return mHorizontalGap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the horizontal gap (top and bottom) of the image integration area from the side as a fraction of the
|
||||
* screen [0.0; 1.0]
|
||||
*
|
||||
* @param pHorizontalGap The horizontal integration area gap from the side [0.0; 1.0]
|
||||
*/
|
||||
public void setHorizontalGap(double pHorizontalGap) {
|
||||
if (mHorizontalGap != pHorizontalGap) {
|
||||
mHorizontalGap = pHorizontalGap;
|
||||
setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the vertical depth (left and right) of the image integration as a fraction of the
|
||||
* image [0.0; 1.0]
|
||||
@ -68,6 +96,30 @@ public class ImageProcessConfig extends Observable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the vertical gap (left and right) of the image integration area from the side of the
|
||||
* screen [0.0; 1.0]
|
||||
*
|
||||
* @return The vertical gap [0.0; 1.0]
|
||||
*/
|
||||
public double getVerticalGap() {
|
||||
return mVerticalGap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the horizontal gap (top and bottom) of the image integration area from the side as a fraction of the
|
||||
* screen [0.0; 1.0]
|
||||
*
|
||||
* @param pHorizontalGap The horizontal integration area gap from the side [0.0; 1.0]
|
||||
*/
|
||||
public void setVerticalGap(double pVerticalGap) {
|
||||
if (mVerticalGap != pVerticalGap) {
|
||||
mVerticalGap = pVerticalGap;
|
||||
setChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the fractional overlap of one integration tile with its neighbors
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user