BlackBerry - how two merge two images

自闭症网瘾萝莉.ら 提交于 2019-12-23 21:39:06

问题


I want to merge two images in blackberry. one image is a big image and other image is a small one. position of small image will be define by developer. what are the possible ways?


回答1:


You can use the Graphics class to draw multiple Bitmaps onto it in different offsets. Look into the Graphic.drawBitmap function. We use something like:

graphics.drawBitmap(x1, y1, icon.getWidth(), icon.getHeight(), icon, 0, 0);

Where the graphics object is the one passed by the paint method we override and icon is the large image. Than determine the x y position for the smaller image and use the same method on the graphics object:

graphics.drawBitmap(x2, y2, mark.getWidth(), mark.getHeight(), mark, 0, 0);

Where mark is the smaller image.

Hope this helps :)



来源:https://stackoverflow.com/questions/2501269/blackberry-how-two-merge-two-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!