首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Bit地图 and DrawPoint

2012-08-29 
Bitmap and DrawPointBitmap and DrawPointAndroid UI 中有时需要画Bitmap,那么如何画Bitmap?利用已有资源

Bitmap and DrawPoint
Bitmap and DrawPoint
  Android UI 中有时需要画Bitmap,那么如何画Bitmap?
利用已有资源初始化Bitmap。

    //画点    private void drawPoint(Canvas canvas){    canvas.drawBitmap(pointArray[0],point.x*pointSize+xOffset,point.y*pointSize+yOffset,paint);    }//根据触摸点坐标找到对应点private Point newPoint(Float x, Float y){Point p = new Point(0, 0);for (int i = 0; i < maxX; i++) {if ((i * pointSize + xOffset) <= x&& x < ((i + 1) * pointSize + xOffset)) {p.setX(i);}}for (int i = 0; i < maxY; i++) {if ((i * pointSize + yOffset) <= y&& y < ((i + 1) * pointSize + yOffset)) {p.setY(i);}}return p;}

热点排行