change multiple small things
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2024-08-06 00:35:46 +02:00
parent 8ef9ea9288
commit c97a3038f2
3 changed files with 52 additions and 2 deletions

19
pom.xml

@ -61,4 +61,23 @@
</plugins> </plugins>
</build> </build>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</pluginRepository>
</pluginRepositories>
</project> </project>

@ -45,10 +45,15 @@ public class MainWindow
imageLabel.setBounds(new Rectangle(bordersPx, bordersPx, rescaleWidth, rescaleHeight)); imageLabel.setBounds(new Rectangle(bordersPx, bordersPx, rescaleWidth, rescaleHeight));
frame.add(imageLabel); frame.add(imageLabel);
JLabel timestampLabel = new JLabel(new ImageIcon(getPreciseScreenshot())); Image preciseScreenshot = getPreciseScreenshot();
JLabel timestampLabel = new JLabel(new ImageIcon(preciseScreenshot));
timestampLabel.setBounds(new Rectangle(bordersPx, bordersPx + rescaleHeight + bordersPx, 100, 30)); timestampLabel.setBounds(new Rectangle(bordersPx, bordersPx + rescaleHeight + bordersPx, 100, 30));
frame.add(timestampLabel); frame.add(timestampLabel);
String ocr = doOCR(preciseScreenshot);
LOGGER.info("OCR FOUND : {}", ocr);
frame.setLayout(null); frame.setLayout(null);
frame.setVisible(true); frame.setVisible(true);
} }
@ -80,6 +85,30 @@ public class MainWindow
return null; return null;
} }
public String doOCR(Image image) {
// todo BufferedImage bImage = getBufferedImage(image);
return null;
}
public BufferedImage getBufferedImage(Image img) {
if (img instanceof BufferedImage image)
{
return image;
}
// Create a buffered image with transparency
BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
// Draw the image on to the buffered image
Graphics2D bGr = bimage.createGraphics();
bGr.drawImage(img, 0, 0, null);
bGr.dispose();
// Return the buffered image
return bimage;
}
public void toggleRunning() { public void toggleRunning() {
String label; String label;

@ -9,7 +9,9 @@ public class SystemUtil
String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); String osName = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
if (osName.contains("win")) { if (osName.contains("win")) {
return OperatingSystem.WINDOWS; return OperatingSystem.WINDOWS;
} else if (osName.contains("nix") || osName.contains("nux")) { } else if (osName.contains("nix") ||
osName.contains("nux") ||
osName.contains("aix")) {
return OperatingSystem.LINUX; return OperatingSystem.LINUX;
} else if (osName.contains("mac")) { } else if (osName.contains("mac")) {
return OperatingSystem.MAC_OS; return OperatingSystem.MAC_OS;