Flashに関して言えば、私はほとんど新人です。
アクションスクリプト(3)は次のとおりです。
// Here's the dumb-dumb:
/*****************************************************************/
/*****************************************************************/
function captureImage(e:MouseEvent):void {
// The video still-image is captured and drawn...but at 320x240? Oh, and the real kicker is that it gets squeezed (resized), not cropped.
bitmapData.draw(video);
}
/*****************************************************************/
/*****************************************************************/
// Here's the other relevant code...
/*****************************************************************/
var bandwidth:int = 0;
var quality:int = 100;
var myWidth:int = 320; // the width for camera, video, and bitmaps.
var myHeight:int = 320; // the height for camera, video, and bitmaps.
var cam:Camera = Camera.getCamera();
cam.setQuality(bandwidth, quality);
cam.setMode(myWidth,myHeight,30,false); // (width, height, FPS, favorSize)
var video:Video = new Video();
video.attachCamera(cam);
video.x = 20;
video.y = 20;
// setting the video.width and video.height here makes the video appear in the desired aspect-ratio (1:1). If this is not set it defaults to 320x240.
video.width = myWidth;
video.height = myHeight;
addChild(video);
// 0xff0000 sets a red background just so I can see that the BitmapData "element" is 320x320 like it should be.
var bitmapData:BitmapData = new BitmapData(myWidth, myHeight, false, 0xff0000);
var bitmap:Bitmap = new Bitmap(bitmapData);
bitmap.x = 360;
bitmap.y = 20;
bitmap.width=myWidth;
bitmap.height=myHeight;
addChild(bitmap);
// capture_mc is my take-a-picture button. :-)
capture_mc.buttonMode = true;
capture_mc.addEventListener(MouseEvent.CLICK,captureImage);
だから、私はここで何が欠けていますか。Flashのメーカーは、すべての画像を4:3のアスペクト比で表示する必要があると主張していないことを知っていますよね?:o)
とにかく、「n00b」を手伝ってくれてありがとう。
psFlashがCtrl+Shift +Z(Photoshopのように)の代わりにCtrl + Yを使用して「やり直し」するという事実は、私にflash.events.destroy(flash)
何かをしたくなります。
更新:
ビデオを240から320に拡大する方法を見つけました。しかし、それを行うと品質が大幅に低下します。太字で更新された部分を含むコードは次のとおりです。
var bitmapData:BitmapData = new BitmapData(myWidth,
240
, false, 0xff0000);
var bitmap:Bitmap = new Bitmap(bitmapData);
bitmap.x = 360;
bitmap.y = 20;
bitmap.width=myWidth;
bitmap.height=240;
bitmap.scaleY=1.333; // ADDED scaleY
addChild(bitmap);
だから私はまだ品質を最大化するソリューションを見つけたいと思います。