This commit is contained in:
2023-09-28 16:04:55 +01:00
parent cd95e2c7fd
commit f965cf9172
3 changed files with 25 additions and 2 deletions
+1 -1
View File
@@ -325,7 +325,7 @@
<dependency>
<groupId>com.unicenta</groupId>
<artifactId>unicenta-plugins</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.gluonhq</groupId>
@@ -129,7 +129,7 @@ public class StartPOS {
metrics.setUniCentaVersion(AppLocal.APP_VERSION);
Application application = new Application();
application.postMetrics(metrics);
application.startEventListener(host);
//application.startEventListener(host, jRootApp);
} catch (Exception e) {
log.error("Problem with starting the uniCenta plugin application:${}", e.getMessage());
}
@@ -96,13 +96,36 @@ public abstract class BasicTicket implements PrintItem {
@Override
public void draw(Graphics2D g2d, int x, int y, int width) {
BufferedImage image = new BufferedImage(width + 10, 10, 1);
g2d = image.createGraphics();
int currenty = y;
for (PrintItem pi : m_aCommands) {
pi.draw(g2d, x, currenty, width);
currenty += pi.getHeight();
}
try {
ImageIO.write(this.negative(image), "png", new File(System.getProperty("user.home") + "/test.png"));
} catch (Exception var10) {
System.out.println("Error serialising receipt image !!! : " + var10);
}
}
public BufferedImage negative(BufferedImage img) {
for(int x = 0; x < img.getWidth(); ++x) {
for(int y = 0; y < img.getHeight(); ++y) {
int RGBA = img.getRGB(x, y);
Color col = new Color(RGBA, true);
col = new Color(Math.abs(col.getRed() - 255), Math.abs(col.getGreen() - 255), Math.abs(col.getBlue() - 255));
img.setRGB(x, y, col.getRGB());
}
}
return img;
}
/**
*
* @return