Search in sources :

Example 6 with Picture

use of android.graphics.Picture in project AndEngine by nicolasgramlich.

the class PictureBitmapTextureAtlasSource method onLoadBitmap.

// ===========================================================
// Getter & Setter
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public Bitmap onLoadBitmap(final Config pBitmapConfig) {
    final Picture picture = this.mPicture;
    if (picture == null) {
        Debug.e("Failed loading Bitmap in " + this.getClass().getSimpleName() + ".");
        return null;
    }
    final Bitmap bitmap = Bitmap.createBitmap(this.mTextureWidth, this.mTextureHeight, pBitmapConfig);
    final Canvas canvas = new Canvas(bitmap);
    final float scaleX = (float) this.mTextureWidth / this.mPicture.getWidth();
    final float scaleY = (float) this.mTextureHeight / this.mPicture.getHeight();
    canvas.scale(scaleX, scaleY, 0, 0);
    picture.draw(canvas);
    return bitmap;
}
Also used : Bitmap(android.graphics.Bitmap) Picture(android.graphics.Picture) Canvas(android.graphics.Canvas)

Example 7 with Picture

use of android.graphics.Picture in project robolectric by robolectric.

the class ShadowPictureTest method copyConstructor.

@Test
public void copyConstructor() {
    Picture originalPicture = new Picture();
    originalPicture.beginRecording(100, 100);
    Picture copiedPicture = new Picture(originalPicture);
    assertThat(copiedPicture.getHeight()).isEqualTo(100);
    assertThat(copiedPicture.getWidth()).isEqualTo(100);
}
Also used : Picture(android.graphics.Picture) Test(org.junit.Test)

Example 8 with Picture

use of android.graphics.Picture in project robolectric by robolectric.

the class ShadowPictureTest method beginRecordingSetsHeightAndWidth.

@Test
public void beginRecordingSetsHeightAndWidth() {
    Picture picture = new Picture();
    picture.beginRecording(100, 100);
    assertThat(picture.getHeight()).isEqualTo(100);
    assertThat(picture.getWidth()).isEqualTo(100);
}
Also used : Picture(android.graphics.Picture) Test(org.junit.Test)

Example 9 with Picture

use of android.graphics.Picture in project androidquery by androidquery.

the class WebImage method delaySetup.

private void delaySetup() {
    wv.setPictureListener(new PictureListener() {

        @Override
        public void onNewPicture(WebView view, Picture picture) {
            wv.setPictureListener(null);
            setup();
        }
    });
    //wv.setInitialScale(100);
    wv.loadData("<html></html>", "text/html", "utf-8");
    wv.setBackgroundColor(color);
}
Also used : PictureListener(android.webkit.WebView.PictureListener) Picture(android.graphics.Picture) WebView(android.webkit.WebView)

Example 10 with Picture

use of android.graphics.Picture in project cordova-android-chromeview by thedracle.

the class Purity method checkRenderView.

public boolean checkRenderView(WebView view) {
    if (state == null) {
        setBitmap(view);
        return false;
    } else {
        Picture p = view.capturePicture();
        Bitmap newState = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
        boolean result = newState.equals(state);
        newState.recycle();
        return result;
    }
}
Also used : Bitmap(android.graphics.Bitmap) Picture(android.graphics.Picture)

Aggregations

Picture (android.graphics.Picture)22 IOException (java.io.IOException)7 Canvas (android.graphics.Canvas)4 FileNotFoundException (java.io.FileNotFoundException)4 Bitmap (android.graphics.Bitmap)3 SAXParser (javax.xml.parsers.SAXParser)3 SAXParserFactory (javax.xml.parsers.SAXParserFactory)3 SAXException (org.xml.sax.SAXException)3 XMLReader (org.xml.sax.XMLReader)3 Bundle (android.os.Bundle)2 WebView (android.webkit.WebView)2 PictureListener (android.webkit.WebView.PictureListener)2 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 FileOutputStream (java.io.FileOutputStream)2 Test (org.junit.Test)2 InputSource (org.xml.sax.InputSource)2 Paint (android.graphics.Paint)1 Point (android.graphics.Point)1 Rect (android.graphics.Rect)1