Background image (binary resources)

Is How to add a background image still the way for background images? I think I can do it that way, but for scalable SVG might be better. I just ask as Projucer for 8.0.13 looks a bit different in its GUI.

Yes, it’s the baked in one I want, as a binary resource. And later I have to get GPT to make a python script to decode a preset file into an array initializer. {{{ …, … }}} style, but basically a multi dimensional array of float. Maybe that should be a binary too (endian?).

For an SVG you’d typically want to use a drawable, add it as a child component of you window/editor, and resize it to cover the full area.

To embed it in your app, either add it as a resource to your Projucer project and use BinaryData::myImage_svg, BinaryData::myImage_svgSize, or you can copy the svg contents directly into your source as a string

static constexpr auto myImage = R"(
  <svg ...>
    ...
  </svg>
)";

Ok, I’ve found out how to do a binary XML resource for my default presets, and so far it works. Now onto a background image.

  • A simple PNG, I think I found out all how to on this.
  • A JPG, convert to PNG and easy.
  • An SVG, not quite sure how to do a render onto a graphics from the markup string.

Maybe Help for Using SVG-To-Path-Generated paths for UI Controls might help scaling an SVG.

I’ll give it a whirl in a bit. I suppose I’ll do another one of the zlib things just for compactness, although SVG files are quite compact.