I have few small questions related to canvas and bitmap APIs.
I have a image file (R.drawable.img1 or "/data/img1.jpg"), i am trying to copy the specified areas of the image to different files. For example: the specified point is (x1, y1) then i am trying to have a rectange with left=x1-20, top=y1-20, right=x1+20, bottom=y1+20 and this rectangle to a file ("/data/1.jpg").
Is there any way to do it. Please help me with some links. I tried in the following way:
1. create a canvas and
Canvas c = new Canvas();
2. draw a circle around the specified point and by using picture API (record) and save to a file.
But this seems not giving me proper results.
In short i wanted get a specified rectangle to a file. Please advice me.
Also another question is :
I have a custom Imageview (say class Test), this will be able to display an image on screen and also able draw something on the image. Now i have another class which has a Layout (i am calling setContentView(R.layout.main) form the class.
I want the custom view output (the view it deploy to the screen when i call setContentView(new Test(this))) to the Imageview which i have in my main.xml.
Is the above is possible.
thank you for any help or links.