在ActionScript 3调整大小的BitmapData [英] Resizing BitmapData in ActionScript 3

查看:254
本文介绍了在ActionScript 3调整大小的BitmapData的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的ActionScript 3.0 来捕捉图像,从用户的摄像头,它工作正常,但问题是,图像的大小是太大了,我喜欢。我可以把它小,我试过的位图数据的不断变化的坐标。 任何人都可以给我建议的解决方案。 谢谢

I am using ActionScript 3.0 to capture image from users webcam ,It is working fine , however the problem is that the size of image is too big for my liking . Can I make it small , I tried changing coordinates of Bitmap Data. Can anybody suggest me the solution. Thanks

推荐答案

当你捕捉你必须提供一个矩阵的网络摄像头。这个矩阵可以处理重缩放。

When you capture the webcam you have to provide a matrix. This matrix can handle a rescaling.

var output:BitmapData = new BitmapData(camera.width * scaleFactor, camera.height * scaleFactor, false);
var matrix:Matrix = new Matrix();
matrix.scale(scaleFactor, scaleFactor);
output.draw(camera, matrix, null, null, null, true);

有时这种方法的平滑化是不是真的令人满意。一个解决方案是使用一个中间:

Sometimes the smoothing of this method is not really satisfying. A solution would be to use an intermediate:

var capture:BitmapData = new BitmapData(camera.width, camera.height, false);
capture.draw(camera);
//or with a newer compiler
//camera.drawToBitmapData(capture);
var intermediate:Bitmap = new Bitmap(capture);
intermediate.scaleX = intermediate.scaleY = scaleFactor;
output.draw(intermediate);
capture.dispose();

preFER如果你是没事的平滑第一种方法。

Prefer the first method if you are okay with the smoothing.

这篇关于在ActionScript 3调整大小的BitmapData的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆