bitmap from canvas to OpenGL | Why does this code work in 2.1, but not 2.2 and later androids?
I got a code (by Google) like this :
InputStream is = mContext.getResources().openRawResource(R.drawable.icon);
bitmap = BitmapFactory.decodeStream(is);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();
I need to pick an image of SpecialViewGroup (I decided to use Canvas), i've tried a code like this
//-- MY CODE
Bitmap bitmap = Bitmap.createBitmap(400, 840, Bitmap.Config.ARGB_8888);
bitmap = SpecialViewGroup.GetViewGroupBitmap;
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();
// SpecialViewGroup.GetViewGroupBitmap(), class extends ViewGroup Code:
public static Bitmap getDesktopBitmap (){
Canvas canvas;
Bitmap bitmap = Bitmap.createBitmap(400, 840, Bitmap.Config.ARGB_8888);
canvas = new Canvas(bitmap);
this.draw(canvas);
开发者_C百科 return bitmap;
}
//-- END OF MY CODE
But I get errors in android 2.2 or higher, while in 2.1 it works correctly. Any Ideas?
精彩评论