【发布时间】:2014-07-31 19:42:04
【问题描述】:
我在 AS3 中有这个,用于截取您的网络摄像头并在其上显示时间戳
var width = 196;
var height = 147;
var screenshot:BitmapData = new BitmapData(width,height,false);
var overlay:BitmapData = new BitmapData(90,90,false);
var m:Matrix = new Matrix();
var m2:Matrix = new Matrix();
var scale:Number = 1;
m.scale(width/(myCam.width),height/(myCam.height)); //Scale for thumbnail.
m2.scale(scale,scale); //scale for timeRect
overlay.draw(timeGroup,m2);
screenshot.draw(VD1,m); //a 400x300 image
screenshot.merge(overlay,new Rectangle(0,0,timeRect.width*scale,timeRect.height*scale),new Point(width-(timeRect.width*scale)+1, height-(timeRect.height*scale)+1), 256, 256, 256, 256);
因为我故意将 400x300 的图像缩小为 196x147,它看起来比通常情况下更糟糕,但还过得去。
但是,如果我调整 scale 变量,我正在与屏幕截图合并的 overlay(timestamp) 图像看起来非常糟糕。
overlay 当scale 设置为 1,
overlay 当scale 设置为 0.5 时:
如何在不丢失所有细节的情况下保持“质量”?
【问题讨论】:
-
尝试将这些 BMD 放入位图对象并启用平滑处理。
标签: actionscript-3 flash bitmap flash-builder image-scaling