2012-03-27 7 views
0

저는 블랙 베리 개발에 신착입니다. 나는 Blackberry 프로젝트로 일하고있다. 이 프로젝트에서 이미지 효과와 컨트롤을 변경하고 싶습니다. 이미지 효과는 세피아, 스케치, 회색 음영, 네거티브, 플립 등입니다. 및 컨트롤은 밝기, 대비, 색조 등입니다.블랙 베리 이미지 프로세싱

플립 이미지 효과를 시도했습니다. 다음은 근래에 시도한 코드입니다. 출력이 있지만 원본 이미지와 겹칩니다.

[화상 효과 플립 출력]

이 문제를 해결할 수있는 누구?

플립 비트 맵 (비트 맵 비트 맵) {

int[] argb = new int[bitmap.getWidth() * bitmap.getHeight()]; 
    bitmap.getARGB(argb, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); 
    for (int i = 0; i < bitmap.getHeight(); i++) { 
     for (int j = 0; j < bitmap.getWidth(); j++) { 
      int swap = argb[i * bitmap.getWidth() + j]; 
      argb[(bitmap.getHeight() - 1 - i) * bitmap.getWidth() + j] = swap; 
     } 
    } 


    //bitmap.setARGB(data, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); 
    Graphics gr=new Graphics(bitmap); 
    gr.clear(0, 0, bitmap.getWidth(), bitmap.getHeight()); 

    bitmap.setARGB(argb, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); 


    return bitmap; 
} 

사람이 문제를 해결할 수 ??

답변

1

당신은 같이 새로운 ARGB (라고 argb_flip)에 플립해야합니다

public Bitmap flip(Bitmap bitmap) { 

     int[] argb = new int[bitmap.getWidth() * bitmap.getHeight()]; 

     int[] argb_flip = new int[bitmap.getWidth() * bitmap.getHeight()]; 

     bitmap.getARGB(argb, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); 
     for (int i = 0; i < bitmap.getHeight(); i++) { 
      for (int j = 0; j < bitmap.getWidth(); j++) { 
       int swap = argb[i * bitmap.getWidth() + j]; 

       argb_flip[(bitmap.getHeight() - 1 - i) * bitmap.getWidth() + j] = swap; 
      } 
     } 

     bitmap.setARGB(argb_flip, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); 

     return bitmap; 
    } 
+0

덕분에 많은 ... 그것은 작동 ... –

+0

는 k.If는 내가 무엇을해야 이미지를 (미러) 플롭 할 나는한다? –