Is it possible to create a bitmap from two bitmaps in android?
HI friends.
Consider am having two bitmaps a rectangle bitmap and a text bitmap. Now i want to create another 开发者_Python百科bitmap using those two bitmap ( Rectangle and Text ). Is it possible to create a new bitmap using some other bitmaps. If so please advise me or give other some valuable ideas regarding this.
Thanks in advance.
You can create a BitmapDrawable from your rectangular bitmap using this constructor, and then override the draw method so that you can draw the text bitmap over the other one. Just use one of the drawBitmap methods of the Canvas class.
You can create a new Bitmap and then loop through both of your source Bitmaps. At every point, if the text image's pixel is white (or a known background colour), use the rectangle's pixel color. If the text image's pixel is black (or a known text colour), use the text's color.
精彩评论