Jump to content

drawing and saving on image?


Swizzbeat

Recommended Posts

v2?

Sth like

    @Override
    public void onExit() throws InterruptedException {
        System.out.println("Exit");
        try {
            takeScreenshoot();
        } catch (IOException e) {
            e.printStackTrace();
        }
        super.onExit();
    }

    private void takeScreenshoot() throws IOException {
        BufferedImage screenshoot = new BufferedImage(this.bot.getCanvas().getWidth(), this.getBot().getCanvas().getHeight(), BufferedImage.TYPE_INT_ARGB);
        Graphics2D graphics2D = screenshoot.createGraphics();
        final BufferedImage gameBuffer = this.bot.getCanvas().gameBuffer;
        graphics2D.drawImage(gameBuffer, 0, 0, null);
        this.onPaint(graphics2D);
        ImageIO.write(screenshoot, "png", new File("screenshot" + new Date(System.currentTimeMillis()).toString().replace(':', '-') + ".png"));
    }

9nBvWVi.png

  • Like 1
Link to comment
Share on other sites

v2?

Sth like

public class ProgressReport {

	private Image image;

	private ProgressReport(Image image) {
		this.image = image;
	}

	public static ProgressReport getReport(Script sI) throws AWTException {
		Canvas c = sI.bot.getCanvas();
		return new ProgressReport(new Robot().createScreenCapture(new Rectangle(c.getX(), c.getY(), c.getWidth(), c.getHeight())));
	}

	public boolean save(String filename) throws IOException {
		Graphics imageGraphics = image.getGraphics();
		imageGraphics.setColor(Color.BLACK);
		imageGraphics.fillRect(7, 458, 71, 15);
		return ImageIO.write((BufferedImage) image, "png", new File(filename + ".png"));
	}

}

That's what I have however my issue is that I can't seem to grab the canvas with the script paint on it before the script exits sad.png

 

From what you can see above I tried using Toolkit as well but even that doesn't get the paint.

 

Also, what is the original gameBuffer representing?

Edited by Swizzbeat
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...