Announcement

Collapse
No announcement yet.

Displaying a splash screen while loading

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sean Murphy
    replied
    Ok, I'll keep the GCI image format in mind then.

    As far as the "long loading" statement, if you go back to my other thread about create a cool gauge that runs from 0-5000 (thread located here), as soon as I changed that gauge to have 5001 images, the .gci file ballooned to 391 MB. And once I transferred that file onto the uSD card and started using it in my code, the time from initial power-on to displaying my first images from that .gci file increased to maybe 3-4 seconds? I haven't actually timed it with anything scientifically, but that's roughly what it feels like. If I have time tomorrow, I can try to see if I can come up with a minimal example that illustrates what I'm seeing.

    I'll look into changing the hack portion to use file_Open("SPLASH~1.gci, 'r') and see what that does.

    Thanks!
    Sean

    Leave a comment:


  • ESPsupport
    replied
    Correct file_Image() only works on GCI formats.

    I'm not sure what you are meaning by 'long loading' the size of a GCI has only a little bearing on its load time, it is the number of elements in the .dat file which most significantly affects load time.

    You hack could also do a file_Image() of the GCI file, since you only want the first image, and don't need the touch detection and other goodies that file_LoadImagecontrol adds

    Leave a comment:


  • Sean Murphy
    replied
    Sorry, I'm not being clear on what my first attempt was. On my first attempt, I only had one Visi project going called "Test". That project generated the 391 MB file Test.gci which was giving me the long loading times problem. Under that scenario, I also copied the file "Image.png" directly on the uSD with the intent that I'd display Image.png as the splashscreen while Test.gci was loading. So at this point the contents of the uSD contain 3 files:
    Image.png
    Test.dat
    Test.gci

    Then I tried to open and load the Image.png file before calling file_LoadImageControl() like so
    Code:
        splashHandle := file_Open("Image.png",'r');
    
        if(splashHandle != 0)
            file_Image(60, 20, splashHandle); // show splashscreen image
            file_Close(splashHandle);
        endif
        hndl := file_LoadImageControl("Test.dat", "Test.gci", 1);
    But that just gave me a blank screen until the fileLoadImageControl() returned and I was able to start using the images found inside the .gci file.

    Only after I couldn't get that to work did I create the second project "Splashscreen" and the associated SPLASH~1.GCI and SPLASH~1.DAT files.

    Does that make more sense? Or are you saying that file_Image() only works on GCI format as well?

    Leave a comment:


  • pauleilio
    replied
    Hello,

    Sorry I totally bypassed that, The reason it doesn't work is because it is a png format and the display needs it to be in GCI format. You could try changing the file open to,

    splashHandle := file_Open("SPLASH~1.GCI",'r');

    Best regards

    Paul

    Leave a comment:


  • Sean Murphy
    replied
    Nope, it's a high resolution version of our corporate logo which has all sorts of color gradients and specular highlights, I definitely don't want to attempt to draw that with primitives!

    Is there a reason my first attempt using
    Code:
       var splashHandle;
       gfx_BGcolour(WHITE);
       gfx_Cls();
       splashHandle := file_Open("Image.png",'r');
      if(splashHandle != 0)
          file_Image(60, 20, splashHandle); // show splashscreen image
          file_Close(splashHandle);
      endif
    didn't work? It seemed like reading the documentation on those functions, it should have done exactly what I wanted, from within a single project?
    Last edited by Sean Murphy; 15th August 2017, 04:57 AM.

    Leave a comment:


  • pauleilio
    replied
    Hi Sean,

    If your 'hack' works well for you then it is fine to do it that way, Eventhough it is a second project to create it, seems like a good idea.

    The other way that it could be done immediately after power up, and if the splashscreen is a simple design, is to draw it with primitive shapes. A good example would be the 4D logo as a splash screen, as it could de drawn with filled rectangles, triangles and circles.

    I hope this helps

    Paul

    Leave a comment:


  • Sean Murphy
    started a topic Displaying a splash screen while loading

    Displaying a splash screen while loading

    This question is somewhat related to, or at least caused by, my previous question. To create that gauge the way I want it, ViSi is generating 5001 images (plus the other images in my project) creating a 391MB .gci file, which I load onto the uSD card. Near the beginning of my main() I call:
    Code:
      hndl := file_LoadImageControl("Test.dat", "Test.gci", 1);
    This call takes a significant amount of time to return while it's going through that huge .gci file. I'd like to see if I can display a splashscreen prior to that call so that it at least looks like the LCD is on and working. I looked into the file_Image(x, y, handle) function and tried the following in main():
    Code:
        if (!(file_Mount()))
            while(!(file_Mount()))
                putstr("Drive not mounted...");
                pause(200);
                gfx_Cls();
                pause(200);
            wend
        endif
        gfx_TransparentColour(0x0020);    // uncomment if transparency required
        gfx_Transparency(ON);             // uncomment if transparency required
        gfx_Set(SCREEN_MODE,LANDSCAPE);
        var splashHandle;
        gfx_BGcolour(WHITE);
        gfx_Cls();
    
        splashHandle := file_Open("Image.png",'r');
        if(splashHandle != 0)
            file_Image(60, 20, splashHandle); // show splashscreen image
            file_Close(splashHandle);
        endif
    
        hndl := file_LoadImageControl("Test.dat", "Test.gci", 1);
    This doesn't seem to work. All I get is a blank white screen prior to parsing the Test.gci files. I verified that splashHandle is non-zero (it's 4704), but I don't see the image on screen.

    As a complete hack, I did the following, which works, but I'd like to know the right way to do what I'm doing above. The hack:
    I created a separate Workshop ViSi project called “Splashscreen” that consists of a single white screen with the "Image.png" centered. Then I compiled that project to have Workshop 4 generate the “SPLASH~1.dat” and “SPLASH~1.gci” (only 79kb) files and copied those over to the uSD card. Then in back my "Test" project code I make the following calls:
    Code:
       gfx_Set(SCREEN_MODE,LANDSCAPE); 
       var splashHandle; 
       gfx_BGcolour(WHITE); 
       gfx_Cls();
       splashHandle := file_LoadImageControl("SPLASH~1.dat", "SPLASH~1.gci", 1); // load the images from the “Splashscreen” project
       img_Show(splashHandle, 0);       // show the "Image.png" image
       hndl := file_LoadImageControl("Test.dat", "Test.gci", 1); // now make the time-consuming call
    This does what I want it to, but seems like the wrong way to go about it, since I'm creating a second project just to generate the .dat & .gci files I need for my splashscreen
Working...
X