Jump to content

[Bug] Mirror mode text overlay with Colour Picker


Apaec

Recommended Posts

Hey

Not really sure what to do in this situation, essentially my recently written Rune Sudoku script relies very heavily on colour data and unfortunately the mirror mode text covers the upper left part of the Sudoku grid. This wouldn't be a problem if the colour picker didn't read the text, however it does so it means the script is unusable in mirror!

Running the following script:

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;

import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

@ScriptManifest(author = "Apaec", info = "", name = "Mirror text overlay test", version = 1.00, logo = "")
public class Main extends Script {

	private Rectangle MIRROR_TEXT = new Rectangle(10, 20, 250, 75);

    // Determines the number of pixels in a given rectangle which have a specified colour
	private int countPixelsOfColourInRect(Rectangle rect, Color col) {
		int amount = 0;
		for (int x = (int) Math.round(rect.getX()); x < rect.getX() + rect.getWidth(); x++)
			for (int y = (int) Math.round(rect.getY()); y < rect.getY() + rect.getHeight(); y++)
				if (getColorPicker().colorAt(x, y).equals(col)) amount++;
		return amount;
	}

	@Override
	public int onLoop() throws InterruptedException {
		return 1000;
	}

	@Override
	public void onPaint(Graphics2D g) {
		g.setColor(Color.CYAN);
		g.draw(MIRROR_TEXT);
		g.drawString("" + countPixelsOfColourInRect(MIRROR_TEXT, new Color(0, 255, 0)), 20, 110);
	}

}

Gives this:

wJvsDjX.png

As you can see, within the drawn rectangle, 1974 pixels were discovered with the exact RGB colour of (0,255,0), corresponding to the debug text

Would it be possible to either remove, or adjust the layering of this text such that it is not picked up by the colour picker, just like a normal paint wouldn't be?

Cheers!

Apa

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
  • Recently Browsing   0 members

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