0

嗨,我和 jjil 库一起工作。我没有使用jiil jar文件我添加了源代码。程序没有错误。但是当我添加推送代码eclipse添加尝试catch blog.然后程序运行但我在模拟器上看不到图像。我的代码在这里

 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 代码

4

1 回答 1

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);
于 2013-01-21T04:17:09.097 回答