title: Process RGB_565 bitmap in NDK
body: <p>I'm facing problem processing RGB_565 bitmaps. My code works fine for ARGB_8888:
  Here are some code snippets I used for ARGB_8888(which works fine):</p>
  
  <pre><code>typedef struct
  {
  
      uint8_t red;
      uint8_t green;
      uint8_t blue;
      uint8_t alpha;
  } argb;
  .....
  .....        
  void* pixelscolor;
      int ret;
      int y;
      int x;
      uint32_t *pixel;
  
  
      if ((ret = AndroidBitmap_getInfo(env, bmp, &amp;infocolor)) &lt; 0) {
          //return null;
      }
  
      if ((ret = AndroidBitmap_lockPixels(env, bmp, &amp;pixelscolor)) &lt; 0) {
      }
      int width = infocolor.width;
      int height = infocolor.height;
  
      for (y = 0; y &lt;  height; y++) {
          argb * line = (argb *) pixelscolor;
          for (int n = 0; n &lt; width; n++) {
              int newValue = line[n].alpha+line[n].red+line[n].green+line[n].blue;
  ......
  ....
  </code></pre>
  
  <p>I get a result like this<a href="http://i.stack.imgur.com/Dz6eX.png" rel="nofollow"> ARGB_8888 results</a>.</p>
  
  <p>But when trying the RGB_565 format:</p>
  
  <pre><code>typedef struct
  {
  
      uint8_t red;
      uint8_t green;
      uint8_t blue;
  
  } rgb;
  .....
  .....        
  void* pixelscolor;
      int ret;
      int y;
      int x;
      uint32_t *pixel;
  
  
      if ((ret = AndroidBitmap_getInfo(env, bmp, &amp;infocolor)) &lt; 0) {
          //return null;
      }
  
      if ((ret = AndroidBitmap_lockPixels(env, bmp, &amp;pixelscolor)) &lt; 0) {
      }
      int width = infocolor.width;
      int height = infocolor.height;
  
      for (y = 0; y &lt;  height; y++) {
          rgb * line = (rgb *) pixelscolor;
          for (int n = 0; n &lt; width; n++) {
              int newValue = line[n].red+line[n].green+line[n].blue;
  ......
  ....
  </code></pre>
  
  <p>I get the following result:<a href="http://i.stack.imgur.com/WMEkO.png" rel="nofollow">RGB_565 result</a></p>