drawbitmap

drawBitmap takes too long

隐身守侯 提交于 2019-12-24 19:03:44
问题 Hello here is the code: URL uri = new URL(photoUrl); URLConnection connection = uri.openConnection(); Log.i(TAG, "connecting..."); connection.connect(); Log.i(TAG, "connected"); Log.i(TAG, "building Bitmap..."); InputStream is = connection.getInputStream(); //BufferedInputStream bis = new BufferedInputStream(is, 8 * 1024); File myfile = new File(getApplicationContext().getCacheDir(), "wallpaper.tmp"); myfile.createNewFile(); BufferedOutputStream out = new BufferedOutputStream(new

canvas.drawLine() not appearing on bitmap

瘦欲@ 提交于 2019-12-24 05:55:18
问题 I have tried so many methods but still my code refuses to simply draw a line on the canvas. Each of the attempts I have commented out either crash the program or won't display the line. I am really struggling to get my head around how to do this, I keep getting different advice on using threads or onDraw or whatever, but none seem to work. My overall objective is to display a bitmap image on the screen, and draw lines on top of it. I then wish to use canvas.tranlate to make the entire image

android placing bitmap in middle

痴心易碎 提交于 2019-12-12 05:08:19
问题 I am designing a drawing app where user can import image from gallery and then scale up or down to fit the screen width or height. so that user can draw onto the imported picture , using the below code. I am extending View , named DrawView . The DrawView is same as screenwidth, but its height is less than screenheight because there are some buttons above it, placing the DrawView to the bottom of the Screen under the functioning buttons, and so I declared DrawViewHeight . See below for

Android: canvas.drawBitmap performance issue

馋奶兔 提交于 2019-12-11 06:27:26
问题 I had an issue lately Android: Rotation of image around the center which was solved by the help of Unconn. However, it turns out, that the solution - as well as it is working - does have a much worse performance, than the RotateAnimation stuff. What I have so far: 1) FrameLayout with two ImageViews, on on top of each other 2) SensorEventHandler, which moves the lower view around according to the heading measured. This works acceptable if I use RotateAnimation I wanted to speed it up and to

How to Draw Portion of Bitmap via Canvas DrawBitmap

微笑、不失礼 提交于 2019-12-08 15:24:35
问题 I have an : FrameLayout(marked with red) Source ImageView(black) Object(imageview) with OnTouchListener (orange) Via Object with OnTouchListener,i want to show a portion of bitmap,that are filled on imageview( source imageview ). So it's not a problem,i'm doing like this: Bitmap bt = Bitmap.createBitmap(sourceBitmap,event.getX(),event.getY(),250,250); where : SourceBitmap - is an image that are added to source ImageView event.getX() / event.getY() is an coord,where i start to draw portion of

How to prevent Android's drawBitmap from only drawing black images?

老子叫甜甜 提交于 2019-11-30 06:16:07
问题 As per the original question, The end result is a rounded-rect png in an ImageView with a natural looking drop shadow. I have the shadow working, but when it draws, it makes the entire image black. How can I prevent the original image (definitely not black) from being black when adding the shadow? BlurMaskFilter blurFilter = new BlurMaskFilter(2, BlurMaskFilter.Blur.OUTER); Paint shadowPaint = new Paint(); shadowPaint.setMaskFilter(blurFilter); int[] offsetXY = new int[2]; Bitmap

How to prevent Android's drawBitmap from only drawing black images?

╄→гoц情女王★ 提交于 2019-11-28 16:01:21
As per the original question , The end result is a rounded-rect png in an ImageView with a natural looking drop shadow. I have the shadow working, but when it draws, it makes the entire image black. How can I prevent the original image (definitely not black) from being black when adding the shadow? BlurMaskFilter blurFilter = new BlurMaskFilter(2, BlurMaskFilter.Blur.OUTER); Paint shadowPaint = new Paint(); shadowPaint.setMaskFilter(blurFilter); int[] offsetXY = new int[2]; Bitmap originalBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.pier_t); Bitmap shadowImage =