关于java.awt.peer.RobotPeer中的getRGBPixels (Rectangle scree)方法的疑问?
想要知道getRGBPixels(Rectangle scree)方法返回的int数值的意义:
程序代码如下:
import java.awt.peer.*;
import java.awt.*;
import sun.awt.ComponentFactory;
/**
*
* @author xiong
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
RobotPeer peer=null;
int[] pixels;
Rectangle size = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
try
{
try
{
Toolkit toolkit = Toolkit.getDefaultToolkit();
if(toolkit instanceof ComponentFactory)
peer = ((ComponentFactory)toolkit).createRobot(new Robot(),
GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
}
catch(Exception exception) { }
pixels=peer.getRGBPixels(size);
System.out.println(pixels.length);
for(int i=0;i <5;i++){
System.out.print(pixels[i]+ " ");
}