canvas绘画的基础步骤 moqo view使用方法?

[更新]
·
·
分类:互联网
3750 阅读

moqo

moqo view使用方法?

view使用方法?

1.写一个类继承View类,一般要重写ondraw方法。一般而言我们去自己绘制一个view,在另一个activity中setContentView(view)去引用它。
public class GameView extends View {
static int count 0 ;
static int y 0;
public GameView(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
if (count100) {
count ;
}
else {
count 0 ;
}
Paint paint new Paint();
switch (count%4) {
case 0:
();
break;
case 1:
();
break;
case 2:
();
break;
case 3:
();
break;
}
canvas.drawRect((320-80)/2, y, (320-80)/2 80, y 40, paint);
super.onDraw(canvas);
}
}
2
写一个activity。
public class ViewTestActivity extends Activity {
/** Called when the activity is first created. */
public static GameView gameView;
public static Handler handler new Handler(){
@Override
public void handleMessage(Message msg) {
if (msg.what 11) {
}
super.handleMessage(msg);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gameView new GameView(this);
setContentView(gameView);
new Thread(new GameThread()).start();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
switch (keyCode) {
case _DPAD_DOWN:
GameView.y 3;
break;
case _DPAD_UP:
GameView.y-3;
break;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
// TODO Auto-generated method stub
return true;
}
}
class GameThread implements Runnable{
@Override
public void run() {
while (!().isInterrupted()) {
try {
(100);
} catch (InterruptedException e) {
();
().interrupt();
}
();//使用postnvalidate可以直接在线程中更新界面
}
}
}

oc是什么绘画圈?

绘画oc软件是一个小型画图软件,由日本开发,全称是Open Canvas。对于电脑的配置要求低,不占什么内存,对于画CG漫画的人来说是非常方便的。
oc软件还包含了许多Adobe绘图软件的功能,最重要的是它的记忆功能非常强大,能把自己绘画的过程记录下来,对于绘画教学来讲是必备的软件之一。