快速或异步 AS3 JPEG 编码 [英] Fast or asynchronous AS3 JPEG encoding
本文介绍了快速或异步 AS3 JPEG 编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前正在使用 AS3 核心库中的 JPGEncoder
将位图编码为 JPEG
I'm currently using the JPGEncoder
from the AS3 core lib to encode a bitmap to JPEG
var enc:JPGEncoder = new JPGEncoder(90);
var jpg:ByteArray = enc.encode(bitmap);
由于位图相当大 (3000 x 2000),编码需要很长时间(大约 20 秒),导致应用程序在编码时似乎冻结.为了解决这个问题,我需要:
Because the bitmap is rather large (3000 x 2000) the encoding takes a long while (about 20 seconds), causing the application to seemingly freeze while encoding. To solve this, I need either:
- 一个异步编码器,所以我可以在编码时不断更新屏幕(带有进度条或其他东西)
- 一种速度更快的替代编码器
有没有可能,我该怎么做?
Is either possible, and how can I do it?
推荐答案
将编码器设置为异步可能是您最好的选择.
Setting up the encoder to be asynchronous would likely be your best bet.
Here are two examples from Adobe
这个例子是使用 actionscript/flex,但它的想法是一样的.
This example is with actionscript/flex, but its the same idea.
这篇关于快速或异步 AS3 JPEG 编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文