Questions tagged [drawbitmap]

68 questions
0
votes
1 answer

How do I draw a flipped subset of a bitmap on Android?

I'm using drawBitmap(Bitmap image, Rect src, Rect dst, Paint paint); to draw a portion of an image. Is there a way to do this and also flip the image?
kailoon
  • 2,131
  • 1
  • 18
  • 33
0
votes
1 answer

to Draw() or DrawBitmap()?

My application draws to the canvas in a continuous loop and on each loop re-evaluates the positions of the drawables and cycles them to animate. My question is which of the following 2 methods is superior and why? I'm a beginner so I have no idea…
cody
  • 735
  • 3
  • 11
  • 19
0
votes
0 answers

canvas.drawBitmap on bitmap base on specific location in jetpack compose

I have an image and i want to add a signature image on it in the position that the user place it on the screen and press "save". I have tried in this way: fun generateComposedImage(originalImage: Bitmap, signatureImage:Bitmap,location:…
0
votes
0 answers

Using drawBitmap to scale with pivot Java Android

I am a react native developer and I am trying to modify a native library in order to be able to scale a Bitmap with a pivot. The library is making the scale effect by just modifying the bounds of the Bitmap using a BitmapDrawable and setBounds. I…
felire
  • 11
  • 1
0
votes
1 answer

When trying to make a gradient from the background, the background is filled with one color

I'm creating an Android application and I needed to create a Drawable with a gradient background and text inside, but for some reason I don't have a gradient, and the entire background is filled with solid color Class code: class…
Drics
  • 41
  • 1
  • 10
0
votes
1 answer

Android: Drawing a bitmap on a hardware-accelerated canvas yields corrupted display, odd behavior

I've been stuck for several days on drawing to a hardware-accelerated canvas from a live wallpaper. When the wallpaper launches, it's in portrait mode and everything initially looks OK: HW canvas: upright When I rotate the phone, the left half of…
0
votes
1 answer

NullPointerException Cant find bitmap from drawable on oppo device

im trying to get imageview from drawable and resize it my current code is working on all devices except on oppo devices it crash inside crop() method the crash im getting is on the first line in crop() method you can find below Caused by:…
Hossam Hassan
  • 795
  • 2
  • 13
  • 39
0
votes
0 answers

Android Studio: drawing bitmap on canvas problem

I only searched for infos in this community and first time to actually ask something. Please know that I'm new to android programming and also am not good at English. I'm using canvas to draw a bitmap. I first select color and shape type with…
KSS
  • 9
  • 1
0
votes
1 answer

canvas.drawBitmap() doesn't scale images

I'm a newbe when it comes to Android coding. As a first project I decided to port ZX Spectrum game. I have prepared bitmap frames of the car and buttons that are about to be scaled depending on screen size. I've put the images both in "drawable" and…
0
votes
1 answer

About performance and drawing Bitmaps

At the beginning I have to say that I'm learning java on my own and may make a stupidest mistake ever... I'm facing a problem with FPS drop while drawing Bitmaps in my 2d game. My game's map consists of Tiles 100x100px, and every tile has some…
LazyMike
  • 1
  • 2
0
votes
1 answer

Cropped Bitmap not fitting to the center. (Hand free cropping.)

I'm trying to crop image using draw. And Its cropping as expected but i think not scaling the cropped part to center of new bitmap. You can see 2 pictures 1. Picture is what i own now. And 2. Picture is what i expect. ORIGINAL IMAGE. WHAT I HAVE…
user8652379
0
votes
2 answers

How to rotate a bitmap when drawing a subset of it?

I am using pCanvas.drawBitmap(mBitmap, mRectSrc, mRectDst, mPainter); to draw a subset of a bitmap. I wondering how I can rotate that bitmap without affecting the view. In my attempts, when I set the canvas to rotate the whole view (viewport) is…
KITT
  • 230
  • 2
  • 3
  • 15
0
votes
1 answer

Canvas.drawBitmap uses the last content of Bitmap for all calls

I am trying to render multiple PDF pages on a custom View in Xamarin. public override void Draw( AG.Canvas canvas ) { base.Draw( canvas ); if( !(Parent is AW.ScrollView p) || pdfRenderer == null ) return; int…
Anton Duzenko
  • 2,366
  • 1
  • 21
  • 26
0
votes
1 answer

16 bit per pixel grayscale bitmap

From my camera, I get a byte array. Each two bytes (two elements of the array) define one pixel. If I understand correctly, the most of the current devices support only 256 shades of gray. So, for my image I need only MSB. The problem is that this…
0
votes
2 answers

Android: image doesn't keep it's original color with use of canvas.drawBitmap

I'm developing an android app and I'm facing a weird issue. I'm doing some image processing on a SurfaceView. I'm drawing the processed image using a canvas and the following method: canvas.drawBitmap(image, x, y, paint) My SurfaceView has a…
Nicolas P.
  • 581
  • 1
  • 4
  • 15