Java 在BB上的位图上绘制位图
我想在位图上绘制位图。。我不知道我做错了什么,因为我以为这会奏效。有人能指出我的错误吗?所以我想在位图图像上绘制位图图像2。我认为我的错误在于图形。创建(位图) 请尝试以下代码-Java 在BB上的位图上绘制位图,java,blackberry,Java,Blackberry,我想在位图上绘制位图。。我不知道我做错了什么,因为我以为这会奏效。有人能指出我的错误吗?所以我想在位图图像上绘制位图图像2。我认为我的错误在于图形。创建(位图) 请尝试以下代码- final Bitmap bitmapImage =Bitmap.getBitmapResource("red.png"); VerticalFieldManager top = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manage
final Bitmap bitmapImage =Bitmap.getBitmapResource("red.png");
VerticalFieldManager top = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){
public void paint(Graphics graphics) {
graphics.drawBitmap(0, 0, bitmapImage.getWidth(),
bitmapImage.getHeight(), bitmapImage, 0, 0);
super.paint(graphics);
}
};
Bitmap bitmapImage2 = Bitmap.getBitmapResource("background.png");
top .add(new BitmapField(bitmapImage2));
add(top);
请尝试以下代码-
final Bitmap bitmapImage =Bitmap.getBitmapResource("red.png");
VerticalFieldManager top = new VerticalFieldManager(Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR | Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH){
public void paint(Graphics graphics) {
graphics.drawBitmap(0, 0, bitmapImage.getWidth(),
bitmapImage.getHeight(), bitmapImage, 0, 0);
super.paint(graphics);
}
};
Bitmap bitmapImage2 = Bitmap.getBitmapResource("background.png");
top .add(new BitmapField(bitmapImage2));
add(top);
您需要从
位图
创建图形
对象,并需要在您创建的图形
实例上绘制第二个位图
。试试下面的代码
类BitmapFieldDemoScreen扩展了主屏幕{
Bitmap bitmapRed=Bitmap.getBitmapResource(“red.png”);
位图bitmapBG=Bitmap.getBitmapResource(“background.png”);
公共BitmapFieldDemoScreen(){
setTitle(“位图字段演示”);
//在位图bg的顶部绘制位图红色
Graphics-grahpicsBg=Graphics.create(位图bg);
grahpicsBg.drawBitmap(50,50,bitmapRed.getWidth(),bitmapRed.getHeight(),bitmapRed,0,0);
//现在bitmapBg已更改
BitMapFieldDemo=新的BitmapField(bitmapBG);
添加(现场演示);
}
}
您需要从位图
创建图形
对象,并需要在您创建的图形
实例上绘制第二个位图
。试试下面的代码
类BitmapFieldDemoScreen扩展了主屏幕{
Bitmap bitmapRed=Bitmap.getBitmapResource(“red.png”);
位图bitmapBG=Bitmap.getBitmapResource(“background.png”);
公共BitmapFieldDemoScreen(){
setTitle(“位图字段演示”);
//在位图bg的顶部绘制位图红色
Graphics-grahpicsBg=Graphics.create(位图bg);
grahpicsBg.drawBitmap(50,50,bitmapRed.getWidth(),bitmapRed.getHeight(),bitmapRed,0,0);
//现在bitmapBg已更改
BitMapFieldDemo=新的BitmapField(bitmapBG);
添加(现场演示);
}
}
您正在VerticalFieldManager的图形对象上绘制位图。您没有操作任何位图对象。您正在VerticalFieldManger的图形对象上绘制位图。你没有操纵任何位图对象。