简体   繁体   English

在没有Android的情况下从Java使用android.graphics.Bitmap

[英]Use android.graphics.Bitmap from Java without Android

I need to use android.graphics.Bitmap in my Java project without Android platform. 我需要在没有Android平台的Java项目中使用android.graphics.Bitmap。 The problem is that I want to process the picture which comes to the server from Android device as a Bitmap. 问题是我想将来自Android设备的服务器图片作为位图进行处理。 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, 我试图在http://androidxref.com上找到它们,但是如果有的话,

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() . 单击width()是指新搜索,其中有许多类涉及不同的width()

You shouldn't do that. 你不应该那样做。 The android libraries are not meant to be used for non android applications. android库不是要用于非android应用程序。 Especially the native code. 特别是本机代码。

As long as you send a bitmap image, any non-android library will be able to read it. 只要您发送位图图像,任何非Android库都将能够读取它。

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. 任何语言都将能够读取传入的字节。

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 现在,服务器仅获取由设备上的bitmap.getPixels(...)派生的图像的宽度,图像的高度和像素阵列, bitmap.getPixels(...) 此处所述构建图片

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java中的android.graphics.Bitmap序列化和反序列化 - Serializing and De-Serializing android.graphics.Bitmap in Java 从C ++创建android.graphics.Bitmap - Creating an android.graphics.Bitmap from C++ 方法'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap $ CompressFormat,int,java.io.OutputStream) - method 'boolean android.graphics.Bitmap.compress(android.graphics.Bitmap$CompressFormat, int, java.io.OutputStream) Jackson ObjectMapper冲突的setter定义(Android.Graphics.Bitmap) - Jackson ObjectMapper Conflicting setter definitions (Android.Graphics.Bitmap) Jackson没有为android.graphics.Bitmap找到合适的构造函数 - Jackson no suitable constructor found for android.graphics.Bitmap org.mapsforge.core.graphics.Bitmap和android.graphics.Bitmap之间的任何关系方法 - Any relation method between org.mapsforge.core.graphics.Bitmap and android.graphics.Bitmap kotlin.TypeCastException:null无法强制转换为非null类型android.graphics.Bitmap - kotlin.TypeCastException: null cannot be cast to non-null type android.graphics.Bitmap 尝试在空对象引用上调用虚拟方法'void android.widget.ImageView.setImageBitmap(android.graphics.Bitmap)' - Attempt to invoke virtual method 'void android.widget.ImageView.setImageBitmap(android.graphics.Bitmap)' on a null object reference Android NDK OpenGL ES将图形渲染为Java位图 - Android NDK OpenGL ES rendered graphics to Java bitmap 如何在android java中使用PixelCopy API从ViewEC获取Z86BB33755628454AF7AZ4F88F047 - How to use PixelCopy API in android java to get bitmap from View
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM