Forum

    • Register
    • Login
    • Search
    • Categories

    Check if image is loaded before drawing it

    Feature Requests
    2
    4
    51
    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.
    • ustk
      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?

      I cannot help pressing F5 in the forum...
      Studio427 Audio - Audio Instruments & FX Plugins for music production. Website - Facebook

      1 Reply Last reply Reply Quote 0
      • d.healey
        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

        ustk 1 Reply Last reply Reply Quote 1
        • ustk
          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...

          I cannot help pressing F5 in the forum...
          Studio427 Audio - Audio Instruments & FX Plugins for music production. Website - Facebook

          1 Reply Last reply Reply Quote 0
          • d.healey
            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

            25
            Online

            982
            Users

            6.6k
            Topics

            60.7k
            Posts