2012-08-09 104 views
0

嗨我watto與jjil庫工作。我沒有使用jiil jar文件我添加了源代碼。程序沒有錯誤。但是當我添加推送代碼時,Eclipse添加嘗試抓住blog.and然後程序運行,但我不能看到圖像在模擬器。 我的代碼是在這裏無法使用我的jjil代碼

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

檢查這是否存在於您的可繪製的R.drawable.test中。如果它在那裏然後清理你的項目。 – 2012-08-09 08:43:05

+0

是ı檢查,它是here.and乾淨,但不工作:( – user1586822 2012-08-09 09:43:04

+0

茹使用任何其他庫? – 2012-08-09 09:54:38

回答

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);