The screencapture of Andengine

Source: Internet
Author: User

The Andengine engine provides a class of screencapture

Usage of this class: Screencapture cap= new Screencapture (), non-parametric constructor

And then add it to the scene, and if you don't add it to the scene, you can't intercept any data.

She has two main methods.

Capture (final int pcapturewidth, final int pcaptureheight, final String pfilepath, final iscreencapturecallback Pscreenca Pturecallback)

and capture (final int pcapturex, final int pcapturey, final int pcapturewidth, final int pcaptureheight, final String Pfilep Ath, final iscreencapturecallback pscreencapturecallback)

The Pscreencapturecallback callback interface is called after a success or failure.

Use out = new FileOutputStream (Pfilepath);
Pbitmap.compress (Compressformat.png, N, out);

And there's Andengine's ***activity. There's a way runrunonuithread (runnable) can do some UI action in a non-UI thread, such as a non-UI thread that can't use toast,

But the Runrunonuithread method can be used

For example:

CaptureSampleActivity.this.runOnUiThread (New Runnable () {

@Override
public void Run () {
Toast.maketext (Getapplication (), "Success", Toast.length_long). Show ();
}
});

The screencapture of Andengine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.