-
Notifications
You must be signed in to change notification settings - Fork 30.3k
FlutterJNI.getBitmap generate wrong result when the screenshot has alpha channel #73036
Copy link
Copy link
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.19Found to occur in 3.19Found to occur in 3.19found in release: 3.22Found to occur in 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.found in release: 3.19Found to occur in 3.19Found to occur in 3.19found in release: 3.22Found to occur in 3.22Found to occur in 3.22has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyAndroid applications specificallyteam-androidOwned by Android platform teamOwned by Android platform teamtriaged-androidTriaged by Android platform teamTriaged by Android platform team
Steps to Reproduce
Containerwith 50% alpha white(#80FFFFFF) in it.RenderRepaintBoundaryin Flutter to take a screenshot.FlutterImageViewin Android Java side to take a screenshot.FlutterEngine.getRenderer().getBitmap();in Java side to take a screenshot of this flutter app.Expected results:
Step 2/3/4: A rectangular filled with #80FFFFFF centered in transparent background and the screenshot saved to a Bitmap.
Actual results:

In step 2 and 3, I get expected result.
I saved result as PNG and it looks like this in PhotoShop:
In step 4, a rectangular filled with #80808080 centered in transparent background.

I saved it to PNG:
Codes