當前位置: 首頁>>代碼示例>>Java>>正文


Java Path.rCubicTo方法代碼示例

本文整理匯總了Java中android.graphics.Path.rCubicTo方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.rCubicTo方法的具體用法?Java Path.rCubicTo怎麽用?Java Path.rCubicTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.graphics.Path的用法示例。


在下文中一共展示了Path.rCubicTo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: renderOnCanvas

import android.graphics.Path; //導入方法依賴的package包/類
private void renderOnCanvas(Canvas canvas, float scale) {
    canvas.save();
    canvas.scale(scale, scale);

    mTempPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));

    // Draw the pattern by creating the paths, adjusting the colors and drawing them. The path
    // values are extracted from the SVG of the pattern file.

    if (sPatternPaths == null) {
        sPatternPaths = new Path[NUM_PATHS];
        // Lightness values of the pattern, range 0 - 255
        sPatternLightness = new int[] { 10, 40, 51, 66, 91, 112, 130 };

        Path p = sPatternPaths[0] = new Path();
        p.moveTo(1029.4f, 357.5f);
        p.lineTo(1366f, 759.1f);
        p.lineTo(1366f, 0f);
        p.lineTo(1137.7f, 0f);
        p.close();

        p = sPatternPaths[1] = new Path();
        p.moveTo(1138.1f, 0f);
        p.rLineTo(-144.8f, 768f);
        p.rLineTo(372.7f, 0f);
        p.rLineTo(0f, -524f);
        p.cubicTo(1290.7f, 121.6f, 1219.2f, 41.1f, 1178.7f, 0f);
        p.close();

        p = sPatternPaths[2] = new Path();
        p.moveTo(949.8f, 768f);
        p.rCubicTo(92.6f, -170.6f, 213f, -440.3f, 269.4f, -768f);
        p.lineTo(585f, 0f);
        p.rLineTo(2.1f, 766f);
        p.close();

        p = sPatternPaths[3] = new Path();
        p.moveTo(471.1f, 768f);
        p.rMoveTo(704.5f, 0f);
        p.cubicTo(1123.6f, 563.3f, 1027.4f, 275.2f, 856.2f, 0f);
        p.lineTo(476.4f, 0f);
        p.rLineTo(-5.3f, 768f);
        p.close();

        p = sPatternPaths[4] = new Path();
        p.moveTo(323.1f, 768f);
        p.moveTo(777.5f, 768f);
        p.cubicTo(661.9f, 348.8f, 427.2f, 21.4f, 401.2f, 25.4f);
        p.lineTo(323.1f, 768f);
        p.close();

        p = sPatternPaths[5] = new Path();
        p.moveTo(178.44286f, 766.85714f);
        p.lineTo(308.7f, 768f);
        p.cubicTo(381.7f, 604.6f, 481.6f, 344.3f, 562.2f, 0f);
        p.lineTo(0f, 0f);
        p.close();

        p = sPatternPaths[6] = new Path();
        p.moveTo(146f, 0f);
        p.lineTo(0f, 0f);
        p.lineTo(0f, 768f);
        p.lineTo(394.2f, 768f);
        p.cubicTo(327.7f, 475.3f, 228.5f, 201f, 146f, 0f);
        p.close();
    }

    for (int i = 0; i < NUM_PATHS; i++) {
        // Color is 0xAARRGGBB, so alpha << 24 will create a color with (alpha)% black.
        // Although the color components don't really matter, since the backing bitmap cache is
        // ALPHA_8.
        mTempPaint.setColor(sPatternLightness[i] << 24);
        canvas.drawPath(sPatternPaths[i], mTempPaint);
    }

    canvas.restore();
    mTempPaint.reset();
}
 
開發者ID:Trumeet,項目名稱:SetupWizardLibCompat,代碼行數:79,代碼來源:GlifPatternDrawable.java


注:本文中的android.graphics.Path.rCubicTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。