2013-05-29 4 views
0

나는 그늘에 하나의 색상에서 점차 다른 비트 맵을 원하는 다른 색 음영 (그래서 점차 붉어지고 할 수 있습니다.비트 맵을

을 내가 픽셀 당이 일을 해요하지만 누군가가 나에게 더 효율적인 방법을 보여줄 수있는 앱이 뛰어 일으키는

private void adjustCountryBitmapColor() 
{ 
    //TODO Possible memory leak in this method. 
    mAllPixels = new int [ mCountryBitmap.getHeight()* mCountryBitmap.getWidth()]; 
    mCountryBitmap.getPixels(mAllPixels, 0, mCountryBitmap.getWidth(), 0, 0, mCountryBitmap.getWidth(),mCountryBitmap.getHeight()); 


    /* 
    int alpha=argb>>24; 
    int red=(argb & 0x00FF0000)>>16; 
    int green=(argb & 0x0000FF00)>>8; 
    int blue=(argb & 0x000000FF); 
    */ 

    for(int i =0; i< mCountryBitmap.getHeight()*mCountryBitmap.getWidth(); i++) 
    { 
     if(mAllPixels[i]>>24 == -1) 
     { 
      /*AllPixels[i] == Color.BLACK) 
      { 
       mAllPixels[i] = Color.RED; 
      } 
      */ 


      mAllPixels[i] = Color.RED; 


     } 
    } 

    System.out.println(mDeltaOffSet); 

    //int alpha = mAllPixels[0]>>24; 

    //System.out.println(alpha); 

    mCountryBitmap.setPixels(mAllPixels, 0, mCountryBitmap.getWidth(), 0, 0, mCountryBitmap.getWidth(), mCountryBitmap.getHeight()); 
} 
+0

음영 비트 맵에 대해 아무 것도 없습니다. 나는이 당신을 도움이되기를 바랍니다 –

+0

.. http://stackoverflow.com/questions/4354939/understanding-the-use-of-colormatrix-and-colormatrixcolorfilter-to-modify-a-draw – Mahesh

+0

@OllyDixon, 내 편집 된 답변을 참조하십시오. –

답변

0

중간 비트 맵을 작성하지 마십시오, 그것은 너무 오래 걸릴 것;?. 정확히 그 이유 Canvas#drawBitmap(int[],....)있다 또한,인지 찾아 보게 ColorMatrixFilterColorMatrix을 사용하는 Paint#setColorFilter()은 색 변환을 처리 할 수 ​​있습니다.

+0

ColorMatrixFilter는 비트 맵을 그늘지게하지 않지만 색상 만 바꿉니다. –

0

GPU를 사용하는 좋은 이미지 처리 라이브러리를 발견했습니다. 그것은 너무 빠르므로 실시간 카메라뿐만 아니라 즉각적인 이미지 처리도 할 수 있습니다.

라이브러리는 javierpuntonet/android-gpuimage으로 제공됩니다. 그냥 살펴보고 확신 할 수 있습니다. 사용하는 이점을 얻을 수 있습니다.

+0

30 초마다 24 번 실행되기 때문에 매번 비트 맵을 다시 만들 수 없습니다. P –