当前位置: 首页>>代码示例>>Java>>正文


Java Canvas.drawPoints方法代码示例

本文整理汇总了Java中android.graphics.Canvas.drawPoints方法的典型用法代码示例。如果您正苦于以下问题:Java Canvas.drawPoints方法的具体用法?Java Canvas.drawPoints怎么用?Java Canvas.drawPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Canvas的用法示例。


在下文中一共展示了Canvas.drawPoints方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawPoints

import android.graphics.Canvas; //导入方法依赖的package包/类
private void drawPoints(Varargs varargs) {
    final Canvas canvas = getCanvas();
    if (canvas != null) {
        final LuaTable table = LuaUtil.getTable(varargs, 2);
        final LuaValue config = LuaUtil.isTable(varargs.arg(3)) ? LuaUtil.getTable(varargs, 3) : null;
        if (table != null) {
            final LuaValue[] keys = table.keys();
            if (keys.length > 0) {
                final float pts[] = new float[keys.length * 2];
                LuaValue value = null;
                for (int i = 0; i < keys.length; i++) {
                    value = table.get(keys[i]);
                    if (value instanceof LuaTable && value.length() >= 2) {
                        for (int j = 0; j < 2; j++) {
                            pts[i * 2 + j] = DimenUtil.dpiToPx(value.get(j + 1));
                        }
                    }
                }
                canvas.drawPoints(pts, getDefaultPaint(config));
            }
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:24,代码来源:UDCanvas.java

示例2: onDraw

import android.graphics.Canvas; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    canvas.drawColor(BACKGROUND_COLOR);

    if (points == null) {
        points = new float[POINTS * 2];
        for(int i = 0; i < POINTS; i++) {
            points[i * 2    ] = (float) Math.random() * getWidth();
            points[i * 2 + 1] = (float) Math.random() * getHeight();
        }
    }

    paint.setColor(0xffa0a0a0);
    paint.setStrokeWidth(4.f);
    paint.setStrokeCap(Paint.Cap.BUTT);
    canvas.drawLines(points, paint);

    paint.setColor(0xffffffff);
    paint.setStrokeWidth(10.f);
    paint.setStrokeCap(Paint.Cap.ROUND);
    canvas.drawPoints(points, paint);
}
 
开发者ID:PacktPublishing,项目名称:Building-Android-UIs-with-Custom-Views,代码行数:23,代码来源:PrimitiveDrawer.java

示例3: drawPoints

import android.graphics.Canvas; //导入方法依赖的package包/类
/**
 * 画多个 点儿  再进行点儿的连接
 *
 * @param canvas
 */
private void drawPoints(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(Color.parseColor("#FF7F24"));
    paint.setStrokeWidth(20);
    paint.setStrokeCap(Paint.Cap.ROUND);
    float[] points = {0, 0, 50, 50, 50, 100, 100, 50, 100, 100, 150, 50, 150, 100};   // 绘制四个点:(50, 50) (50, 100) (100, 50) (100, 100)

    canvas.drawPoints(points, 2 /* 跳过两个数,即前两个 0 */,
            8 /* 一共绘制 8 个数(4 个点)*/, paint);
}
 
开发者ID:songjiabin,项目名称:MySelfDemo,代码行数:16,代码来源:MyView2.java

示例4: draw

import android.graphics.Canvas; //导入方法依赖的package包/类
@Override
public int draw(Canvas canvas) {
    if (count == 2) {
        canvas.drawPoint(pts[0], pts[1], paint);
    } else {
        canvas.drawPoints(pts, offset, count, paint);
    }
    return NO_SAVE;
}
 
开发者ID:52inc,项目名称:CanvasScript,代码行数:10,代码来源:PointParams.java


注:本文中的android.graphics.Canvas.drawPoints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。