最简单的涂鸦应用。代码在桌面和Android上运行良好。如果我尝试在iOS上做同样的事情(在真实设备上测试 - iPad 2),我会收到此错误:ArgumentError:错误#2015:无效的BitmapData。
原则上,很明显为什么错误--BitmapData的大小是巨大的。
为什么会这样?为什么只在iOS?
private var maskLine:Sprite = new Sprite();
stage.addEventListener(MouseEvent.MOUSE_MOVE,onMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN,onDown);
stage.addEventListener(MouseEvent.MOUSE_UP,onUp);
protected function onDown(ev:MouseEvent):void {
maskLine.graphics.lineStyle(20, 0x33CC00, 1);
maskLine.graphics.moveTo(mouseX, mouseY);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);
}
protected function onUp(ev:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMove);
}
protected function onMove(ev:MouseEvent):void {
maskLine.graphics.lineTo(mouseX, mouseY);
}
保存在位图代码中:
maskLine.filters = [new BlurFilter(4, 4, 1)];
trace (Capabilities.screenResolutionX + ' ' + Capabilities.screenResolutionY + ' ' + maskLine.width + ' ' + maskLine.height);
//768 1024 107374182.35 107374182.35
// Here is get error
var bmpd:BitmapData = new BitmapData(maskLine.width, maskLine.height, true, 0x000000);
bmpd.draw(maskLine);