Hey all,
I have a magnitude spectrogram that I’ve computed and is stored in an Image object. I’m trying to draw that image into a Component object within my component, but the Image is larger than the Component. For instance, the Component is 1180x270px and the Image is 1382x1025px (the width of the Image is variable depending on the length of the input file). My problem is trying to scale the Image to fit inside the Component, as currently it’s only displaying a portion of it. Can JUCE do this automatically? Or do I have to write my own function for this?
Here’s the drawing code for my component:
void ImageLayer::paint(Graphics &g)
{
// some scaling code here???
g.drawImage(*image, 0, 0, getWidth(), getHeight(),
0, 0, image->getWidth(), image->getHeight());
}
Thanks ahead of time!
