XtGem Forum catalog
↓↓xuống cuối trang↓↓
Chào mừng bạn đến với wap DinhLoi.XtGem.Com | Chúc bạn có 1 năm mới vui vẻ tốt lành hạnh phúc! Hãy giới thiệu website này cho bạn bè nhé!img
DinhLoi.XtGem.Com =>> CaFe9x.Gq
Bạn đến từ quốc gia: United StatesUnited States



Hôm nay ngày
25.04.24/22:39
img- Hi. Xin chào! Mozilla/5.0
logo
.
HOMECHÁTTruyệnFORUM
Trang chủ>Thủ thuật>Xử lí Java>
[Function] tạo nền gradient cho canvas
15.07.2014/13:24
Ae muốn dùng lại nhiều lần thì cho cái trong paint vào hàm nha! Biến trong hàm làx,y,w,h,color1,color2
import javax.microedition.lcdui.*; import com.jappit.wiki.gradientrect.graphics.Gradient; publicclassCanextendsCanvas {int orientation; int prop; int left=0; int top=0; int height=160; int width=128; int VERTICAL=0; int color1=0xff0000; int color2=0x0000ff; int color; public Can() { setFullScreenMode(true); } publicvoid paint(Graphics g) { setFullScreenMode(true); int max = orientation == VERTICAL ? height : width; for(int i = 0; i < max; i++){ prop=max * (max - 1 - i) / (max - 1); color = ((((color1 >> 16) & 0xff) * prop +((color2 >> 16) & 0xff) * (max - prop)) / max)<< 16 | ((((color1 >> 8 ) & 0xff) * prop +((color2 >> 8 ) & 0xff) * (max - prop)) / max)<< 8 | ((((color1 >> 0) & 0xff) * prop +((color2 >> 0) & 0xff) * (max - prop)) / max); g.setColor(color); if(orientation == VERTICAL){ g.drawRect(left+i, top+i,width-i,height-i); g.setColor(0,0,0); g.drawString("hj"+max+prop+color,0,50,20); }else{ g.drawLine(left + i, top, left + i, top + height - 1); } } } }
Tag:
Bạn đến từ:
Share: img img img img img

Thanks To:XtGem
Liên kết:U-ON