/* Draws a number of pixels of the same color to the display.  */
EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)
/* Draws a number of pixels of the same color to the display.  */
EMSTATUS DMD_writeColor(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)
{
  uint16_t color;
  uint16_t xStart = x;
  uint16_t *pixelPointer = (uint16_t *)
    ((uint32_t) frameBuffer +
     (uint32_t) ((y+dimensions.yClipStart)*dimensions.xSize*sizeof(uint16_t)) +
     (uint32_t) ((x+dimensions.xClipStart)*sizeof(uint16_t)));
  color = colorTransform24ToRGB565(red,green,blue);
  while(numPixels--)
  {
    x++;
    *pixelPointer++ = color;
    if (x>=dimensions.clipWidth)
    {
      x = xStart;
      pixelPointer = (uint16_t *)
        ((uint32_t) frameBuffer +
         (uint32_t) (((++y)+dimensions.yClipStart)*dimensions.xSize*sizeof(uint16_t)) +
         (uint32_t) ((xStart+dimensions.xClipStart)*sizeof(uint16_t)));
    }
  }
  return DMD_OK;
}