您好我和jjil图书馆合作。 ı没有使用jiil jar文件我添加源代码。程序没有错误。但是当我添加推送代码eclipse添加尝试捕获blog.and然后程序运行但不能在模拟器上看到图像。 我的代码在这里
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.test);
int with=bmp.getWidth();
int height=bmp.getHeight();
RgbImage rgb=new RgbImage(with,height);
bmp.getPixels(rgb.getData(), 0, with, 0, 0, with, height);
Sequence seq=new Sequence();
seq.add(new Rgb3x3Average());
try {
seq.push((RgbImage) rgb.clone());
} catch (Throwable e) {
throw new IllegalStateException(e);
}
try {
rgb=(RgbImage) seq.getFront();
} catch (Throwable e) {
throw new IllegalStateException(e);
}
}
}
我的logcat错误:
Log cat hatası : 08-09 07:57:14.061: W/ResourceType(63): Resources don't contain package for resource number 0x7f020030
但R.java不包含0x7f020030
代码
答案 0 :(得分:0)
您应该使用:
RgbImageAndroid.toRgbImage(bm)
这是完整的代码
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.star);
int width = bm.getWidth();
int height = bm.getHeight();
RgbImage jjImage = RgbImageAndroid.toRgbImage(bm);
Sequence seq = new Sequence();
seq.add(new Rgb3x3Average());
RgbImage jjImageResult = null;
try {
seq.push(jjImage.clone());
jjImageResult = (RgbImage) seq.getFront();
} catch (Error e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int[] jjpixel = jjImageResult.getData();
Bitmap bm2 = bm.copy(bm.getConfig(), true);
bm2.setPixels(jjpixel, 0, width, 0, 0, width, height);