基本信息
源码名称:蓝牙接收并画图
源码大小:1.72M
文件格式:.rar
开发语言:Java
更新时间:2016-04-25
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 3 元×
微信扫码支付:3 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
private int oldX = 0;// 上次绘制的X坐标
private int oldY = 0;// 上次绘制的Y坐标
private SurfaceView sfv;// 画板
private int X_index = 0;// 当前画图所在屏幕X轴的坐标
private Paint mPaint;// 画笔
private int wait = 50;// 线程等待时间
public DrawThread(SurfaceView sfv, Paint mPaint, int wait) {
this.sfv = sfv;
this.mPaint = mPaint;
this.wait = wait;
}
public void run() {
while (isRecording) {
try {
byte[] temp = new byte[1024];
int len = is.read(temp);
Log.e("available", String.valueOf(len));
if (len > 0) {
byte[] btBuf = new byte[len];
System.arraycopy(temp, 0, btBuf, 0, btBuf.length);
SimpleDraw(X_index, btBuf, rateX, rateY, baseLine);// 把缓冲区数据画出来
X_index = X_index (btBuf.length/rateX) - 1;// 这里-1可以减少空隙
if (X_index > sfv.getHeight()) {
X_index = 0;
}
}
Thread.sleep(wait);// 延时一定时间缓冲数据
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
class DrawThread extends Thread {
private int oldX = 0;// 上次绘制的X坐标
private int oldY = 0;// 上次绘制的Y坐标
private SurfaceView sfv;// 画板
private int X_index = 0;// 当前画图所在屏幕X轴的坐标
private Paint mPaint;// 画笔
private int wait = 50;// 线程等待时间
public DrawThread(SurfaceView sfv, Paint mPaint, int wait) {
this.sfv = sfv;
this.mPaint = mPaint;
this.wait = wait;
}
public void run() {
while (isRecording) {
try {
byte[] temp = new byte[1024];
int len = is.read(temp);
Log.e("available", String.valueOf(len));
if (len > 0) {
byte[] btBuf = new byte[len];
System.arraycopy(temp, 0, btBuf, 0, btBuf.length);
SimpleDraw(X_index, btBuf, rateX, rateY, baseLine);// 把缓冲区数据画出来
X_index = X_index (btBuf.length/rateX) - 1;// 这里-1可以减少空隙
if (X_index > sfv.getHeight()) {
X_index = 0;
}
}
Thread.sleep(wait);// 延时一定时间缓冲数据
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}