HISE Logo Forum
    • Categories
    • Register
    • Login

    Check if image is loaded before drawing it

    Scheduled Pinned Locked Moved Feature Requests
    4 Posts 2 Posters 229 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk
      last edited by

      @Christoph-Hart It would be useful to get a check if the image is loaded or not in a panel before drawing it.

      When creating a panel you often have to create the paint routine before the images are downloaded. This creates an "Image xxx not found" error before you have the chance to repaint with the loaded image... Or is there already a trick like loading a dummy one?

      Can't help pressing F5 in the forum...

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by

        I load the image inside the paint routine

        if (f.isFile())
        {
            this.loadImage(f.toString(File.FullPath), item.id);
            g.drawImage(item.id, a, 0, 0);
        }
        

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        ustkU 1 Reply Last reply Reply Quote 1
        • ustkU
          ustk @d.healey
          last edited by

          @d-healey Oh that's a nice trick.
          For the moment I just used a dummy image that I replace once the download is done...

          Can't help pressing F5 in the forum...

          1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey
            last edited by

            I should mention that I only call this paint routine once when the images are downloaded (or resynced) so there is no issue of files being repeatedly loaded. However if you do want to repaint more than once you could use an array to keep track of which files you've loaded or use a variable as a flag to indicate if all the image have aready been loaded.

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            1 Reply Last reply Reply Quote 1
            • First post
              Last post

            46

            Online

            1.7k

            Users

            11.7k

            Topics

            102.1k

            Posts