-1

I would like to show a few small sized images and a background on one of the screens in my application. What are the best practices to do it and avoid to see white windows before the images get drawn? Should I load all images in the beginning and keep them in memory, and then draw them when it's necessary? Or perhaps there are other ways to solve this issue?

  • Hi Equilibrium, what programming language do you use and what's your application type? – Rita Han Oct 21 '19 at 01:12
  • Hi Rita. I use C++ for my video game (Win32) project. Would like to know what is the best practice when it comes to loading bitmaps and drawing them on the device context from the aspect of performance. Actually, should I avoid to use bitmaps and focus to GDI if I care only about performance? – Equilibrium Oct 21 '19 at 13:42
  • It is hard to say what cause the white window issue without a [mini, reproducible and complete code sample](https://stackoverflow.com/help/minimal-reproducible-example). Here are some general suggestions: [1](https://learn.microsoft.com/en-us/windows/win32/direct2d/improving-direct2d-performance#create-large-bitmaps) and [2](https://learn.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-using-a-cached-bitmap-to-improve-performance-use). – Rita Han Oct 22 '19 at 02:40

1 Answers1

1

Try this:

$('#loader_img').show();

$('#main_img').on('load', function(){
  $('#loader_img').hide();
});

load event get executed when image finishes loading till then you can show loader image.
And instead of asking a question without try, you better try first and share the problem you are facing

bali
  • 327
  • 1
  • 5
  • 14