Get the specified point color value

This example implements the color value of the specified point on the screen of the master device.

Programming language: JS

Steps

1. Get the master device object

2. Define the X, Y coordinates

3. Get the color value of 550,550 this point with getPixelColorStr

4. Convert hexadecimal color values to decimal

Source code

/*
 * version : 6.2.0.2179
 * resolution : 720*1280
 * description : Get the specified point color value
 */
define("version", "6.2.0.2886");
define("resolution", "720*1280");
define("requireVersion", "1.5.0.2865");

//Get the master device object
var device = Device.getMain();

//Define the X, Y coordinates
var x = 550;
var y = 550;

//Get the color value of 550,550 this point with getPixelColorStr
var Color = device.getPixelColorStr(x, y);
print("The hexadecimal color value of coordinate" + x + "," + y + "is:" + Color);

//Convert hexadecimal color values to decimal
Color = parseInt(Color, 16).toString(10);
print("The decimal color value of coordinate" + x + "," + y + "is:" + Color);