(libgdx学习)pixmap(1)

一、初始化及常见API

pixmap = new Pixmap(800, 480, Format.RGBA8888); pixmap.setColor(Color.BLUE);//设置pixmap的颜色
pixmap.drawLine(0, 0, 100, 100);//画线
pixmap.drawLine(200, 0, 300, 100);//起点(x1,y1)、终点(x2,y2)
pixmap.fillCircle(150, 150, 32);//画实心圆.(x,y)和半径
pixmap.drawCircle(250, 100, 50);//画空心圆.(x,y)和半径
pixmap.drawRectangle(0, 0, 150, 150);//画空心矩形.起点(x,y),(width,height)
pixmap.fillRectangle(0, 160, 100, 100);//画实心矩形.起点(x,y),(width,height)
/**
* * pixmap.getHeight(): 获取pixmap的高度
* * pixmap.getWidth(): 获取pixmap的宽度
* * pixmap.getFormat(): 获取pixmap的格式
* */
System.out.println("pixmap.getHeight(): " + pixmap.getHeight() + ",pixmap.getWidth( " + pixmap.getWidth() + ", pixmap.getFormat()" + pixmap.getFormat());

 

http://www.netfoucs.com/article/caihongshijie6/72897.html

 

posted @ 2014-12-05 15:02  tonny.lee  阅读(221)  评论(0编辑  收藏  举报