We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Originally posted by krislyy January 26, 2022
private void pagToGif() { // pag player PAGComposition composition = makeComposition(); int height = composition.height(); int width = composition.width(); PAGSurface surface = PAGSurface.MakeOffScreen(width, height); if (surface == null) return; PAGPlayer player = new PAGPlayer(); player.setComposition(composition); player.setSurface(surface); player.setProgress(0); // byte buffer ByteBuffer buffer = ByteBuffer.allocateDirect(width * height * 4) .order(ByteOrder.nativeOrder()); buffer.clear(); // 开始导出 int totalFrames = (int) (composition.duration() * composition.frameRate() / 1000000); for (int i = 0; i < totalFrames; i++) { generateSurfaceFrame(player, composition, i); surface.readPixels(buffer); Bitmap bitmap = BitmapFactory.decodeByteArray(buffer.array(), 0, buffer.capacity()); buffer.clear(); } }
PAGSurface的readPixels函数返回的buffer一直空的,想问下Android需要特殊设置什么才能拿到当前渲染的到surface上图片呢?
The text was updated successfully, but these errors were encountered:
已在 #77 中回复。
Sorry, something went wrong.
No branches or pull requests
Discussed in #77
Originally posted by krislyy January 26, 2022
PAGSurface的readPixels函数返回的buffer一直空的,想问下Android需要特殊设置什么才能拿到当前渲染的到surface上图片呢?
The text was updated successfully, but these errors were encountered: