Merge pull request #1093 from deathbeam/fix-screenshot
Add getCanvasOffset to clientUI, fix screenshots
This commit is contained in:
@@ -54,6 +54,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.WidgetHiddenChanged;
|
import net.runelite.api.events.WidgetHiddenChanged;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
@@ -380,8 +381,9 @@ public class ScreenshotPlugin extends Plugin
|
|||||||
clientUi.paint(graphics);
|
clientUi.paint(graphics);
|
||||||
|
|
||||||
// Evaluate the position of the game inside the frame
|
// Evaluate the position of the game inside the frame
|
||||||
gameOffsetX = 6;
|
final Point canvasOffset = clientUi.getCanvasOffset();
|
||||||
gameOffsetY = 0;
|
gameOffsetX = canvasOffset.getX();
|
||||||
|
gameOffsetY = canvasOffset.getY();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the game onto the screenshot
|
// Draw the game onto the screenshot
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import lombok.Getter;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
import net.runelite.client.RuneLiteProperties;
|
import net.runelite.client.RuneLiteProperties;
|
||||||
@@ -457,6 +458,21 @@ public class ClientUI
|
|||||||
giveClientFocus();
|
giveClientFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get offset of game canvas in game window
|
||||||
|
* @return game canvas offset
|
||||||
|
*/
|
||||||
|
public Point getCanvasOffset()
|
||||||
|
{
|
||||||
|
if (client instanceof Client)
|
||||||
|
{
|
||||||
|
final java.awt.Point point = SwingUtilities.convertPoint(((Client) client).getCanvas(), 0, 0, frame);
|
||||||
|
return new Point(point.x, point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Point(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
private void expand(PluginPanel panel)
|
private void expand(PluginPanel panel)
|
||||||
{
|
{
|
||||||
if (pluginPanel != null)
|
if (pluginPanel != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user