WAP之家:为您提供最全最新的WAP技术,CP.SP.3G等行业资讯。 WAP之家交流论坛全新开放 点击进入>>
WAP资讯 | 3G动态 | SP动态 | 运营商动态 | 内容商动态 | 制造商动态 | 论坛讨论>> 每次自动访问
WAP技术 | WAP源码 | 手机编程 | 手机源码 | 无线技术 | J2ME技术 | 手机软件 添加到收藏夹
IVR技术 | SP资料 | SMS MMS技术 | 商业方案 | IVR下载 | 书籍教程 | 工具软件 语言:繁體中文

WAP之家技术文章J2ME技术程序开发裁减多边形

裁减多边形
作者:不详  来源:本站整理  发布时间:2005-11-24 17:30:12
System.out.println(" "+heaps[j]);
}
}
int bx = 0;
if(heaps == null)
continue;

int j = 0;
while(heaps != null){
if((j%2)==0){
int ex = pop();

bx = ex;
}else{
int ex = pop();

gb.drawLine(bx,i,ex,i);
bx = ex;
}
j++;

}
}
}

private void drawPolygon(int nodes[][])
{
gb.setColor(0x0000ff00);
for(int i = 0; i < nodes.length-1; i++){
gb.drawLine(nodes[0],nodes[1],nodes[i+1][0],nodes[i+1][1]);
// gb.fillArc(nodes[0] - 10,nodes[1] - 10,20,20,0,360);
}
gb.drawLine(nodes[0][0],nodes[0][1], nodes[nodes.length-1][0], nodes[nodes.length-1][1]);
// gb.fillArc(nodes[nodes.length-1][0] - 10,nodes[nodes.length-1][1] - 10,20,20,0,360);
}

//裁减,裁减后的图放在theCutImg里面
Image theCutImg;
private void cutGraphics(int x,int y,int w, int h)
{
Graphics tg;
try{
theCutImg = Image.createImage(w,h);
}catch(Exception e){System.out.println(e+" createImage");}
tg = theCutImg.getGraphics();
tg.drawImage(bufImg, -x, -y, 0);
}

public void run()
{
gb.setColor(0x00ffffff);
gb.fillRect(0,0,nWidth,nHeight);
fillPolygon(nodes);
System.out.println("done1");
drawPolygon(nodes);
System.out.println("done2");
repaint();
}

private void pause(long t)
{
try{Thread.sleep(t);}catch(Exception e){}
}


public void keyPressed(int keyCode)
{

}

}

上一页  [1] [2] 

[] [返回上一页] [打 印]
文章评论

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码