I'm working on an extension where I pass a canvas to the extension.
In the extension I draw something on the canvas.
Then I try to get the bitmap of the canvas.
In Eclipse I have no compile errors, in Rush I get the following error:
erro src\be\naafets\testbitmap\Testbitmap.java:29: cannot find symbol
│ Bitmap bm = canvas.getBitmap();
│ ^
│ symbol: method getBitmap()
│ location: variable canvas of type Canvas
└ failed*
In the sourcefile of canvas.java, the method getBitmap() seems to be added explicitly for use in extensions...
(and my real target extension is much more complex, above snippet is only to demonstrate the error).
What am I doing wrong?
I think you should update Rush. The newer version of Rush has a "comptime_dependencies:" section in rush.yml which will be more appropriate for this .jar.
I tried all suggested solutions, only the one where I replace runtime.jar with AndroidRuntime.jar in the rush folder C:\Users\<user>\AppData\Roaming\rush\dev-deps\rush did work.
The problem however is that there are a lot of differences between the versions ofcanvas.java in of above jar files, probably explictly made by @shreyash for the use in rush. Although this solution works, it is not recommended according to me.
Finally I implemented the logic of getBitmap in my extension itself and everything is going well.
int width = canvas.getView().getWidth();
int height = canvas.getView().getHeight();
Bitmap bm = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
android.graphics.Canvas c = new android.graphics.Canvas(bm);
canvas.getView().layout(0, 0, width, height);
canvas.getView().draw(c);