Show JPG image on Wii screen

The following function shows a jpg image.

void drawJpegImage(char *pictureData, int pictureLength, int x, int y )
{
  JPEGIMG         jpeg;
  int             row,
  col,
  pix,
  offset;
  unsigned int   *jpegout;

  memset(&jpeg, 0, sizeof(JPEGIMG));

  jpeg.inbuffer = pictureData;
  jpeg.inbufferlength = pictureLength;

  JPEG_Decompress(&jpeg);

  pix = 0;

  jpegout = (unsigned int *) jpeg.outbuffer;

  offset=(y+yjpegOffset)*320;
  for (row = 0; row < jpeg.height; row++)
  {
      for (col = 0; col < (jpeg.width >> 1); col++)
      {
         frameBuffer[0][offset + col + x] = jpegout[pix++];
      }
      offset+=320;
  }

  free(jpeg.outbuffer);
}

Leave a Reply

Your email address will not be published. Required fields are marked *