title: How can I efficiently create a display bitmap of palletized colors in Android graphics?
body: <p>My Android Tide app displays a nautical chart from a .KAP file. This file format
  uses a four bit palettized display system, only 10 colors are used. My app decodes
  the file format into an array of four bit colors. It displays a portion of this
  array onto the display as follows:</p>
  <pre><code>for (displayLineNum  = 1; displayLineNum &lt; displayHeight; displayLineNum++)
  {   for (displayDotNum = 1; displayDotNum &lt; displayWidth; displayDotNum++)
     {  color = colors [lineIndex-1][dotIndex-1];  
        switch (color)
        {   case 1:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color1); break;
            case 2:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color2); break;
            case 3:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color3); break;
            case 4:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color4); break;
            case 5:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color5); break;
            case 6:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color6); break;
            case 7:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color7); break;
            case 8:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color8); break;
            case 9:  displayCanvas.drawPoint(displayDotNum, displayLineNum, color9); break;
            case 10: displayCanvas.drawPoint(displayDotNum, displayLineNum, color10); break;
            default: displayCanvas.drawPoint(displayDotNum, displayLineNum, color1); break;                    
        }
     }
  }
  display_area.setImageBitmap(displayBitmap);
  </code></pre>
  <p>There are 10 paint colors pre set with the RGB codes necessary for display. But each pixel
  has to be drawn individually with the displayCanvas.drawPoint function. This works but
  it is DOG SLOW.
  I would rather pre set the palette codes on the other side of the display call, and pass in
  the palette values instead. This would run a lot faster but I can't find a way to do this
  with the display calls available.
  There are Android functions to evaluate an image to get a palette for it, etc but I cant see
  how to efficiently display a palettized image. Each pixel is getting blown up for a four bit
  pixel code to a sixteen bit RGB565 code in order to pass in a normal bitmap. How else
  could I do this, thank you.</p>