我想在位图上绘制位图。我不知道我做错了什么,因为我希望这能起作用。有人可以指出我的错误吗?所以我想在bitmapImage上绘制bitmapImage2。我相信我的错在于 Graphics.create(bitmap)
package mypackage;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BitmapField;
import net.rim.device.api.ui.container.MainScreen;
public class BitmapFieldDemo extends UiApplication
{
public static void main(String[] args)
{
BitmapFieldDemo theApp = new BitmapFieldDemo();
theApp.enterEventDispatcher();
}
public BitmapFieldDemo()
{
pushScreen(new BitmapFieldDemoScreen());
}
}
class BitmapFieldDemoScreen extends MainScreen
{
Graphics g;
Bitmap bitmapImage = Bitmap.getBitmapResource("red.png");
Bitmap bitmapImage2 = Bitmap.getBitmapResource("background.png");
public BitmapFieldDemoScreen ()
{
setTitle("Bitmap Field Demo");
// image i want to draw on
Graphics.create( bitmapImage );
// bitmapfield
BitmapField fieldDemo = new BitmapField(bitmapImage);
add(fieldDemo);
}
public void paint(){
super.paint(g);
// image that needs to be drawn on the bitmapImage
g.drawBitmap(50, 50, bitmapImage2.getWidth(), bitmapImage2.getHeight(), bitmapImage2, 0, 0);
}
}