…using 4x the real size so as to allow the GUI to be scaled up without any visible pixelation.
I’m curious as to how much memory it is using, but I can’t seem to find an easy way to display the amount of memory being used. If I just do a sizeof() on the Image object, it’s 16, which is tiny. I tried a sizeof() on Image::getPixelData() but I must not be doing this correctly either because the number still is tiny and makes no sense. I realize I could probably manually compute this based on height and width, but as I use this in several places, it would be nice to have an easy way to display it.
I think it would just be 20.8mb, they go up by a factor of 1000. I believe it’s bits that uses 1024.
Either way, yes it’s quite a lot but most modern systems will have plenty of memory to spare. Even 4gb is considered a small amount of memory these days so if it’s literally just the one image it won’t make much difference.
@ImJimmi is correct that on a desktop system 20mb is not a big problem. But I would indeed advise against drawing in a oversampled image.
The data has to go each time through the graphics bus. It only makes sense for images that rarely change, but then setBufferedToImage() might already do what you hope for.
And last but not least the conversion between logical and physical pixels and other OS quirks might not play too well with your idea. Chances are you are effectively painting twice each time for no gain.
Thanks - I’ve basically already given up on this idea. I have maybe 25 images to do like this, so it’s not a good idea. But let me explain more in case you have more to add:
The issue is that I have an editor with let’s say 25 different editing tabs. I’ve been creating a background for each one automatically by generating a complex path based on the positions of the child components, then filling and stroking the path. The background doesn’t change from when it is first shown. The complex path takes some time to compute.
When I wrote this I was thinking about how to optimize it by making an image out of the results, but I’ve since realized that was the wrong approach and what I am doing now is storing the Path in each editor page, so it only gets created the first time it is shown and after that I can just fill/stroke it.
Would applying setBufferedToImage() actually improve anything in this scenario?