java - Bitmap is not on canvas after drawing -
i drawing bitmap canvas.drawbitmap(bmp, 0, 0, null);
canvas , bitmap not show. ideas?
thank you!
bitmap bmp = bitmapfactory.decodefile(myfile.getpath()); //bitmap bmp = bitmapfactory.decodestream(bis); log.i(tag, "builded bitmap"); log.i(tag, "scaling bitmap..."); //int scale; //matrix matrix = new matrix(); //matrix.setscale(0.1f, 0.1f); //if (bmp.getwidth() < bmp.getheight()){ // scale = canvas.getwidth()/bmp.getwidth(); //}else{ // scale = canvas.getheight()/bmp.getheight(); //} //matrix.postscale(scale, scale, bmp.getwidth(), bmp.getheight()); //matrix.postscale(0.5f, canvas.getwidth()/bmp.getwidth()); //bitmap bmp2 = bitmap.createscaledbitmap(bmp, canvas.getwidth(), canvas.getheight(), true); //paint p = new paint(); //p.setfilterbitmap(true); //try{ bmp = bitmap.createscaledbitmap(bmp, canvas.getwidth(), canvas.getheight(), true); log.i(tag, "scaled"); log.i(tag, "showing bitmap..."); canvas.drawbitmap(bmp, 0, 0, null); log.i(tag, "showed bitmap");
can draw line? either call invalidate() or postinvalidate().
read drawing here: http://developer.android.com/reference/android/view/view.html
and copy examples like: http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/graphics/touchpaint.html
Comments
Post a Comment