2012-01-19 112 views
0

我試圖爲Android創建一個簡單的拼貼設計器。每幅圖像都可以移動,旋轉,縮放。使用此代碼:移動應用程序中圖像的轉換

var os:Sprite = new Sprite(); 
os.cacheAsBitmap = true; 
       os.cacheAsBitmapMatrix = new Matrix(); 
       Multitouch.inputMode = MultitouchInputMode.GESTURE; 
       if (Multitouch.supportsGestureEvents){ 
        os.addEventListener(TransformGestureEvent.GESTURE_ROTATE , onRotate); 
        os.addEventListener(TransformGestureEvent.GESTURE_ZOOM , onZoom); 
        os.addEventListener(TransformGestureEvent.GESTURE_PAN , onPan); 
       } 
       os.addEventListener(MouseEvent.MOUSE_DOWN, onDown); 
       os.addEventListener(MouseEvent.MOUSE_UP, onUp); 

protected function onRotate(event:TransformGestureEvent):void 
      { 
       event.target.rotation += event.rotation; 
      } 

      protected function onZoom(event:TransformGestureEvent):void 
      { 
       event.target.scaleX *= event.scaleX; 
       event.target.scaleY *= event.scaleY; 
      } 

      protected function onPan(event:TransformGestureEvent):void 
      { 
       event.target.x = event.offsetX; 
       event.target.y = event.offsetY; 
      } 
      protected function onDown(e:MouseEvent):void 
      { 
       os.startDrag(); 
       e.stopPropagation(); 
      } 

      protected function onUp(e:MouseEvent):void 
      { 
       os.stopDrag(); 
      } 

然而,縮放圖像不流暢,圖像突然改變大小,運動拉。雖然我有相當強大的測試設備。我無法使用使用標記的標準方式,因爲圖像很小,而且將手指插入標記將會很困難。

請提示代碼示例如何實現。

回答

1

你用「gpu」renderMode來測試嗎? 並嘗試使用位圖代替

相關問題