mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Changed border simulation ratio to fill the border
Former-commit-id: 2d7cfee11127d09c1a71d84dab2d03f3cf003013
This commit is contained in:
parent
095e303443
commit
28f07ec739
@ -33,8 +33,6 @@ import org.hyperion.hypercon.spec.LedFrameConstruction;
|
|||||||
|
|
||||||
public class LedSimulationComponent extends JPanel {
|
public class LedSimulationComponent extends JPanel {
|
||||||
|
|
||||||
private double mBorderFraction = 0.2;
|
|
||||||
|
|
||||||
private BufferedImage mTvImage = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);
|
private BufferedImage mTvImage = new BufferedImage(640, 480, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
private void setImage(Image pImage) {
|
private void setImage(Image pImage) {
|
||||||
@ -173,8 +171,8 @@ public class LedSimulationComponent extends JPanel {
|
|||||||
}
|
}
|
||||||
int width = backgroundImage.getWidth();
|
int width = backgroundImage.getWidth();
|
||||||
int height = backgroundImage.getHeight();
|
int height = backgroundImage.getHeight();
|
||||||
int borderWidth = (int) (backgroundImage.getWidth() * mBorderFraction);
|
int borderWidth = (int) (backgroundImage.getWidth() * 0.1);
|
||||||
int borderHeight = (int) (backgroundImage.getHeight() * mBorderFraction);
|
int borderHeight = (int) (backgroundImage.getHeight() * 0.2);
|
||||||
|
|
||||||
mTopLeftImage.setImage(backgroundImage.getSubimage(0, 0, borderWidth, borderHeight));
|
mTopLeftImage.setImage(backgroundImage.getSubimage(0, 0, borderWidth, borderHeight));
|
||||||
mTopImage.setImage(backgroundImage.getSubimage(borderWidth, 0, width-2*borderWidth, borderHeight));
|
mTopImage.setImage(backgroundImage.getSubimage(borderWidth, 0, width-2*borderWidth, borderHeight));
|
||||||
|
@ -15,8 +15,6 @@ import org.hyperion.hypercon.spec.Led;
|
|||||||
|
|
||||||
public class LedSimulationWorker extends SwingWorker<BufferedImage, Object> {
|
public class LedSimulationWorker extends SwingWorker<BufferedImage, Object> {
|
||||||
|
|
||||||
private final double mBorderFraction = 0.2;
|
|
||||||
|
|
||||||
private final BufferedImage mTvImage;
|
private final BufferedImage mTvImage;
|
||||||
|
|
||||||
private final Vector<Led> mLeds;
|
private final Vector<Led> mLeds;
|
||||||
@ -78,15 +76,16 @@ public class LedSimulationWorker extends SwingWorker<BufferedImage, Object> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Point tv2image(Dimension pImageDim, Point2D point) {
|
Point tv2image(Dimension pImageDim, Point2D point) {
|
||||||
double tvFraction = (1.0 - 2*mBorderFraction);
|
double tvWidthFraction = (1.0 - 2*0.1);
|
||||||
|
double tvHeightFraction = (1.0 - 2*0.2);
|
||||||
|
|
||||||
double tvWidth = tvFraction * pImageDim.width;
|
double tvWidth = tvWidthFraction * pImageDim.width;
|
||||||
double tvXIndex = point.getX()*tvWidth;
|
double tvXIndex = point.getX()*tvWidth;
|
||||||
double imageXIndex = tvXIndex + mBorderFraction*pImageDim.width;
|
double imageXIndex = tvXIndex + 0.1*pImageDim.width;
|
||||||
|
|
||||||
double tvHeight = tvFraction * pImageDim.height;
|
double tvHeight = tvHeightFraction * pImageDim.height;
|
||||||
double tvYIndex = point.getY()*tvHeight;
|
double tvYIndex = point.getY()*tvHeight;
|
||||||
double imageYIndex = tvYIndex + mBorderFraction*pImageDim.height;
|
double imageYIndex = tvYIndex + 0.2*pImageDim.height;
|
||||||
|
|
||||||
return new Point((int)imageXIndex, (int)imageYIndex);
|
return new Point((int)imageXIndex, (int)imageYIndex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user