2

I need to use android.graphics.Bitmap in my Java project without Android platform. The problem is that I want to process the picture which comes to the server from Android device as a Bitmap. So, I need some methods that use native code. How can I get these native methods? I tried to find them at http://androidxref.com but if I have, for example,

static int Bitmap_width(JNIEnv* env, jobject, SkBitmap* bitmap) {return bitmap->width();}

clicking width() refers to the new search where there are lots of classes contating different width().

sandkeks
  • 179
  • 1
  • 11
  • Do you mind me asking *why* you need to use `android.graphics.Bitmap`? There are plenty of available Java-native bitmap libraries. You don't need to use the Android one just because it came from Android. A bitmap is a bitmap, as long as it's sent in some recognizable format(jpg, png, simple byte array, etc). – Geobits Dec 11 '13 at 14:49
  • I tried `java.awt.BufferedImage` but haven't succeeded in making it work. I'm not so familiar with it. Probably, you have some suggestions concerning the proper libraries. – sandkeks Dec 11 '13 at 15:49

2 Answers2

0

You shouldn't do that. The android libraries are not meant to be used for non android applications. Especially the native code.

As long as you send a bitmap image, any non-android library will be able to read it.

You can event send the image raw pixels. It's like sending a list of bytes. Any language will be able to read incomming bytes.

Basile Perrenoud
  • 4,039
  • 3
  • 29
  • 52
0

I managed to do this. Now the server gets only width, height of the image and array of pixels derived by bitmap.getPixels(...) on the device and builds the picture as described here

Community
  • 1
  • 1
sandkeks
  • 179
  • 1
  • 11