Android.graphics.Picture is not drawn in API 14+

When I change the targetAPI in the manifest from 13 to 14 (or higher), the image no longer works. No matter what and how.

Example

    Paint bluepaint = new Paint();
    bluepaint.setColor(Color.BLUE);

    Picture pic = new Picture();
        Canvas testcanvas = pic.beginRecording(300, 300);
        testcanvas.drawColor(Color.BLUE);
    pic.endRecording();

    canvas.drawColor(Color.RED);
    canvas.drawLine(0, 0, 480, 480, bluepaint);

    canvas.drawPicture(pic);

This should draw a blue screen from the picture, it does this in API 13 and below. It does NOT draw blue, but only red from a clean canvas.draw call.

I do not see any changes in the API from 13 to 14 that will explain this.

However, I use cyanogenmod on the Galaxy S2 (so that I can run 4.3), I’m not sure if they change the material to cyanogen by switching to it a couple of weeks ago.

Any idea where to look for answers or what might cause this?

change

works

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="13" />

Does not work

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="14" />
+4
source share
1

targetSdkVersion 14 (Ice Cream Sandwich) , . , Canvas.drawPicture() , .

:

  • android:hardwareAccelerated="false" application AndroidManifest.xml. .

  • Bitmap Canvas.drawBitmap(), .

: http://developer.android.com/guide/topics/graphics/hardware-accel.html

0

Source: https://habr.com/ru/post/1545407/


All Articles