Sunday, March 2, 2014

Which God is great reading framebuffer code encoded into png images, engage in N days


DisplayMetrics metrics = new DisplayMetrics ();
WindowManager WM = getWindowManager ();
Display display = WM.getDefaultDisplay ();
display.getMetrics (metrics);
int height = metrics.heightPixels; / / screen high
int with = metrics.widthPixels; / / Wide
screen
/ / Get the display mode
int pixelformat = display.getPixelFormat ();
PixelFormat localPixelFormat1 = new PixelFormat ();
PixelFormat.getPixelFormatInfo (pixelformat, localPixelFormat1);
int deepth = localPixelFormat1.bytesPerPixel ;/ / bit depth
byte [] piex = new byte [height * with * deepth];

/ / File file = new File ("/ dev/graphics/fb0");

/ / Add root privileges
try {
Runtime.getRuntime () exec ("chmod 777 / dev/graphics/fb0");.
} Catch (IOException e1) {
/ / TODO Auto-generated catch block
e1.printStackTrace ();
return;
}

Runtime runtime = Runtime.getRuntime ();
String s1 = "cat / dev/graphics/fb0";
java.lang.Process process;
try {
process = runtime.exec (s1);
} Catch (IOException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
return;
}

stream = process.getInputStream ();
/ /} Catch (FileNotFoundException e) {
/ / TODO Auto-generated catch block
/ / E.printStackTrace ();
/ /}

DataInputStream dStream = new DataInputStream (stream);
try {
dStream.readFully (piex);
} Catch (IOException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}

/ / Bitmap bitmap = Bitmap.createBitmap (piex, with, height,
/ / Config.ARGB_8888);

try {
FileOutputStream out = new FileOutputStream (
"/ Mnt / sdcard / screen.jpg");
} Catch (FileNotFoundException e) {
/ / TODO Auto-generated catch block
e.printStackTrace ();
}
/ / Bitmap.compress (Bitmap.CompressFormat.JPEG, 100, out);<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
This is all my scores, which under the guidance of Almighty God
Reply:
My own roof, under quick to help me this rookie

Reply:
Screenshot ah, in fact, depends on the model, previously engaged, very troublesome compatibility
Reply:
Yes, ah, do a lot of days, not the video is black
Reply:
Brothers, java is not directly engaged in the screenshot, screenshot by jni to'd been engaged, was a reference https://code.google.com/p/android-screenshot-library/wiki/Usage inside the code, you can see Look

No comments:

Post a Comment