package net.runelite.inject.callbacks;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import net.runelite.client.RuneLite;
import net.runelite.client.ui.overlay.OverlayRenderer;

public class RSCanvasCallback
{
	private final BufferedImage clientBuffer = new BufferedImage(765, 503, BufferedImage.TYPE_INT_RGB);
	private final BufferedImage gameBuffer = new BufferedImage(765, 503, BufferedImage.TYPE_INT_RGB);
	
	public Graphics getGraphics(Canvas canvas, Graphics superGraphics)
	{
		Graphics clientGraphics = clientBuffer.getGraphics();
		clientGraphics.drawImage(gameBuffer, 0, 0, null);
		clientGraphics.dispose();

		RuneLite runelite = RuneLite.getRunelite();
		if (runelite != null)
		{
			OverlayRenderer renderer = runelite.getRenderer();
			if (renderer != null)
			{
				renderer.render(clientBuffer);
			}
		}

		superGraphics.drawImage(clientBuffer, 0, 0, null);

		return gameBuffer.getGraphics();
	}
}

@@ -246,37 +246,86 @@
 back%0A%7B%0A%09private 
-final
+static final int WIDTH = 765, HEIGHT = 503;%0A%09%0A%09private
  BufferedImage c
@@ -352,32 +352,37 @@
 fferedImage(
-765, 503
+WIDTH, HEIGHT
 , BufferedIm
@@ -409,22 +409,16 @@
 private 
-final 
 Buffered
@@ -458,16 +458,21 @@
 age(
-765, 503
+WIDTH, HEIGHT
 , Bu
@@ -571,16 +571,331 @@
 ics)%0A%09%7B%0A
+%09%09if (canvas.getHeight() != clientBuffer.getHeight() %7C%7C canvas.getWidth() != gameBuffer.getWidth())%0A%09%09%7B%0A%09%09%09clientBuffer = new BufferedImage(canvas.getWidth(), canvas.getHeight(), BufferedImage.TYPE_INT_RGB);%0A%09%09%09gameBuffer = new BufferedImage(canvas.getWidth(), canvas.getHeight(), BufferedImage.TYPE_INT_RGB);%0A%09%09%7D%0A%0A
 %09%09Graphi

Fix resizable