I’m trying to see if I can draw a waveform with smoothed edges instead of sharp ones, and, looking at the juce_GraphicsContext header file, I see a lot of mention of using a color or a brush. But I don’t see any Brush class(es) anyplace. Are those old, no-longer existing structures?
I am using fillRect() to draw vertical lines from minimum to maximum sample values (because the header file suggests that’s faster than using drawLine for vertical or horizontal drawing). Is there a way to get the top & bottom edges to do anti-aliasing to smooth out those edges by fading the pixels at the top&bottom of the rectangles/lines? (And is there a significant performance hit for doing so?)
Ok, never mind. I can use floats instead of ints, and use drawVerticalLine() instead. (I sill wonder what all that talk about brushes is referring to, though.)
I think this would be what they mean with “brush” -a colour, a gradient or a tiled image. Just in case -drawVerticalLine calls fillRect anyway. I’ve read some old posts where Jules said that drawing fills like that, with vertical lines, might be worse than using paths -I don’t know how current is that.
But drawing using fillRect uses ints, while drawing using drawVerticalLine uses floats, so I can only get anti-aliasing if I use drawVerticalLine, where my values are not rounded or truncated to ints, apparently.
Well, fillRect takes ints or floats, but of course if your values are ints you’d have to cast them first. Anyway I meant that in terms of results or efficiency it would be the same. The kind of smoothing you get from drawing vertical lines is quite inferior to using paths, so it’s only worth it if it’s actually faster.
Ah, I didn’t see there was a float version. Never used paths, and don’t know anything about using them. Something to learn about, I guess. Thanks!