2019-05-23 5:20 AM - last edited on 2025-07-15 2:12 AM by LouisB
void Screen1View::setupScreen()
{
   FILE* f = fopen("C:\\Temp\\image.jpg", "rb");
   uint16_t width, height;
   JPEGFileLoader::getJPEGDimensions(f, width, height);
   BitmapId bmpId;
   //create dynamic bitmap matching file dimensions and in format matching LCD
   if (HAL::lcd().bitDepth() == 16)
   {
      bmpId = Bitmap::dynamicBitmapCreate(width, height, Bitmap::RGB565);
   }
   else
   {
      bmpId = Bitmap::dynamicBitmapCreate(width, height, Bitmap::RGB888);
   }
   if (bmpId != BITMAP_INVALID)
   {
      //Succesfully created, load JPEG file to bitmap
      JPEGFileLoader::readJPEGFile(Bitmap(bmpId), f, lineBuffer);
   }
   //Image shall show the loaded bitmap
   image.setBitmap(Bitmap(bmpId));
   //Position image and add to View
   image.setXY(20, 20);
   add(image);
   Screen1ViewBase::setupScreen();
}
Solved! Go to Solution.
2019-05-23 5:31 AM
Solved: I missed to define: uint8_t bmpCache[300 * 1024];
2019-05-23 5:31 AM
Solved: I missed to define: uint8_t bmpCache[300 * 1024];
