2013-12-21 82 views
0

我正在嘗試繪製圓形菜單,其中顯示爲具有60度角的項目以及圖像/圖標。問題是當我旋轉菜單,我有超過3個項目和菜單是一半的圓(180度),當我旋轉我旋轉項目/弧內的圖像。在這裏可以做類似於OpenGL的東西,保存狀態,psuh矩陣,翻譯,旋轉對面,再次彈出?我標出了哪裏是問題。有誰知道如何O此,(圖標總是垂直)在gdi中如何推動,翻譯,旋轉和彈出狀態?

  float mSweep = 60; 
      for (Integer key : mConversionPositionToID.keySet()) { 

       String tempKey = mConversionPositionToID.get(key); 
       SemiCircularRadialMenuItem item = mMenuItems.get(tempKey); 
       mRadialMenuPaint.setColor(item.getBackgroundColor()); 
       item.setMenuPath(mMenuCenterButtonRect, mMenuRect, mStart, 
         mSweep, mRadius, mViewAnchorPoints); 
       canvas.drawPath(item.getMenuPath(), mRadialMenuPaint); 
       if (isShowMenuText) { 
        mRadialMenuPaint.setShadowLayer(mShadowRadius, 0.0f, 
          0.0f, Color.TRANSPARENT); 
        mRadialMenuPaint.setColor(item.getTextColor()); 
        canvas.drawTextOnPath(item.getText(), 
          item.getMenuPath(), 5, textSize, 
          mRadialMenuPaint); 
        mRadialMenuPaint.setShadowLayer(mShadowRadius, 0.0f, 
          0.0f, mShadowColor); 
       } 

// HERE I have position of icon/image center 
       item.getIcon().draw(canvas); 
       mStart += mSweep; 
      } 

回答

0

如何創建一個矩陣對象與具有菜單的屬性?從旋轉方法

示例代碼:

Status Rotate(
    [in] REAL angle, // You can put your menu angle here 
    [in] MatrixOrder order 
);