Hi
I’m having a problem trying to scale a drawing. For example, I’m drawing a raw plot of 4096x128 points that I would like to scale on the UI into a 128x128 sized component. If I draw the plot at actual size, doing the following in the paint method, it works fine:
for (int i = 1; i < scopeSize; ++i) {
float x1 = i - 1;
float x2 = i;
g.drawLine(x1, height - scopeData[i - 1], x2, height - scopeData[i], 2.0);
}
However, if I try to scale the drawing on the x-axis by the width of the component, e.g.
float scale = width / (float)scopeSize;
for (int i = 1; i < scopeSize; ++i) {
float x1 = (i - 1) * scale;
float x2 = i * scale;
g.drawLine(x1, height - scopeData[i - 1], x2, height - scopeData[i], 2.0);
}
The plot is strangely mirrored at the mid-point.
I’ve also tried drawing into a Image and then using
g.drawImageAt(image.rescaled(width, height), 0, 0);
but also get the strange mirroring at the mid-point. I’m using JUCE 5.4.7 on a Mac. I can’t figure out what’s going wrong, any help greatly appreciated.
