1

forgive me if its a simple question but I am stuck. I am trying to set the position of my image to the left of the screen by certain distance (-150). It works fine with positive numbers, but not with negative. I am drawing it on canvas since I will be adding more images to the resultant bitmap (result) later. Here is my code

     Bitmap image2=resizedbitmap;

     result = Bitmap.createBitmap(image2.getWidth(), image2.getHeight(),             `   `Bitmap.Config.ARGB_8888);        
     canvas = new Canvas(result);//Create the canvas to an image                
     srcRect = new Rect(-150, 0, result.getWidth(), result.getHeight());//does not work with negative numbers
     destRect = new Rect(srcRect);
     destRect.offset(0, 0);//if negative cuts the image
     canvas.drawBitmap(image2, srcRect, destRect, null);

Am I missing something? Any help appreciated. Many tnx in advance

Alanagh
  • 232
  • 5
  • 14

1 Answers1

-1

rather using this, see here Image in Canvas with touch events

Community
  • 1
  • 1