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


#1

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??

thanks


#2

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…


#3

define blitted?

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


#4

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.


#5

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?

Thanks


#6

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??

Thanks


#7

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.


#8

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?


#9

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.


#10

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


#11

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


#12

I got it now

Thanks a million for your help man

sorry for the bother

thanks again


#13