I need some advice on the best way to make Vertical Meters

I’m currently writing a control panel that will display 36 big vertical metes on screen at once. So i need to make my meter routines as CPU efficient as possible. I’m trying to think of a good technique, i was going to draw the meter in a component then re size it but the problem with that is since Y = 0 is at the top of the image where I can only crop the image from the bottom up by adjusting height its not working out. i was also thinking of using a Image brush then do an alpha fill in a rectangle I’ll re-size with the meter data but I’m afraid that will take to much CPU and will be hard to sync with the repaint calls.

does anyone have a suggestion on how to go about making a very efficient vertical meter in juce??


for ppmulator I used two images, one of the background, and one of the background with the bar overlaid. Then blitted the appropriate bits of those, which avoided any alpha-compositing (which is slow), and just repainted the minimum area that had changed. I think that’s about as good as you’ll get…

define blitted?

is that like covering the bar overlayed image with the normal background image?

I think Jules is referring to the term BLIT, or Block Image Transfer. I.E just copying large chunks from each of the two buffered images.

OK I’ve never used this technique before can you point me to a resource can help me with that?

web link of some sort?

is that something juce can do or will i need to build a special class?


I’ve been doing some Google searches on Blitting.

Most of the examples I’ve found is with in direct X.
does anyone of an example of this working in juce or does this technique need to be done on a lower level??


Sorry - I didn’t mean use any other code!

Blitting just means copying blocks of image data around - so just use the juce drawing code! The important point is just to avoid drawing any pixels of your component more than once, so avoiding things like filling it with a background colour before drawing, or overlaying graphics with alpha-mapped compositing.

Got it thanks for pulling me back from that tangled mess

is there a draw method in juce that’s lets me copy an area of a bit map to another?

did you just an image for the entire meter or just copied the segments around?

You can create a Graphics object for an Image, and draw using that.

I think I just used two two images of the entire meter, and used the relevent bits of each one.

sorry to keep bothering you like this but do you think the blendImage methods in the Image class will do what i need?

No, don’t use the Image class directly, go via the Graphics class, because that makes sure that everything’s clipped properly.

I got it now

Thanks a million for your help man

sorry for the bother

thanks again