Hi,
It seems that when calling Image::duplicateIfShared() on an image aquired trough Image::getClippedImage(), the clipped image isn't duplicated.
I have the following code snippet from my component's paint routine:
Image activeImage = image.getClippedImage(area);
activeImage.duplicateIfShared();
// this is a custom function
multiplyImageWithColour( activeImage, avAudioLightColour.withBrightness(1.f).withAlpha(1.f));
g.drawImage(activeImage,
(int)(start * image.getWidth()), 0,
(int)((end - start) * getWidth()),
getHeight(), 0, 0, activeImage.getWidth(), activeImage.getHeight());
The resulting image gets drawn darker and darker, because the image gets recylced and "coloured" over and over.
This doesn't happen if I create activeImage like so:
Image activeImage = image; activeImage.duplicateIfShared(); activeImage = activeImage.getClippedImage(area);
Is this a bug?