关于网友提出的“ 100分求nokia开发包中透明图像显示问题”问题疑问,本网通过在网上对“ 100分求nokia开发包中透明图像显示问题”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 100分求nokia开发包中透明图像显示问题
描述: //这个函数用来创建一副花纹图,它中间有个透明的矩形
private Image makeCheckerboard(int width,int height,short fg,short bg)
{
short[] pixels = new short[width * height];
for(int x = 0; x < width;++ x){
for(int y = 0;y < height;++ y ){
pixels[x + width * y] = (((x & 4) == 0)^((y & 4) == 0)) ? fg : bg;
}
}
for(int x = width / 4;x < 3 * width / 4; ++ x){
for(int y= height / 4; y < 3 * height / 4; ++ y){
pixels[x + width * y] &= 0x0fff;
}
}
Image img = Image.createImage(width,height);
Graphics g = img.getGraphics();
DirectGraphics dg = DirectUtils.getDirectGraphics(g);
dg.drawPixels(pixels,true,0,width,
0,0,width,height,
0,DirectGraphics.TYPE_USHORT_4444_ARGB);
return img;
}
//画图是这样的
protected void paint(Graphics g) {
DirectGraphics dg = DirectUtils.getDirectGraphics(g);
g.setColor(255,255,255);
g.fillRect(0,0,screenw,screenh);
g.translate(orgx,orgy);
g.fillRect(0,0,paintw,painth);
g.setColor(0,0,0);
g.drawString("Good Luck!",30,75,Graphics.LEFT | Graphics.TOP);
dg.drawImage(image,30,75,20,0);
dg.drawImage(makeCheckerboard(150,170,(short)0xf123,(short)0xf999) ,0,0,20,0);
/** @todo Add paint codes */
}
原意是先画一个图像image,因为后画的makeCheckerboard(150,170,(short)0xf123,(short)0xf999)中间是透明的,那么应该可以透过它看见image,可在我的S60模拟器上透明部分是一块空白,看不见
image,请教有经验的高手
以上介绍了“ 100分求nokia开发包中透明图像显示问题”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/2034892.html