I changed the code slightly to be more an exact replication of my experience.
/*******************************************************************************
The block below describes the properties of this PIP. A PIP is a short snippet
of code that can be read by the Projucer and used to generate a JUCE project.
BEGIN_JUCE_PIP_METADATA
name: MyComponentPIP
dependencies: juce_core, juce_data_structures, juce_events, juce_graphics, juce_gui_basics
exporters: xcode_mac
moduleFlags: JUCE_STRICT_REFCOUNTEDPOINTER=1
type: Component
mainClass: MyComponent
END_JUCE_PIP_METADATA
*******************************************************************************/
#pragma once
//==============================================================================
class MyComponent : public Component
{
public:
//==============================================================================
MyComponent()
{
for (int x = 0; x < 250; ++x)
for (int y = 0; y < 250; ++y)
argbImage.setPixelAt (x, y, chooseColour(x, y));
setSize (600, 400);
}
~MyComponent()
{
}
inline Colour chooseColour(const int x, const int y)
{
if ( y < 125 && x > y || y > 126 && x < y ) return transparentBlack;
const auto position = x * 250 + y;
if ( position < 250 * 250 * 0.333 ) return Colours::red;
if ( position < 250 * 250 * 0.666 ) return Colours::green;
return Colours::blue;
}
//==============================================================================
void paint (Graphics& g) override
{
g.fillAll (Colours::black);
g.drawImage (argbImage, 20, 20, 250, 250, 0, 0, 250, 250);
auto singleChannelImage = argbImage.convertedToFormat (Image::SingleChannel);
g.setOpacity (0.1f);
g.drawImage (singleChannelImage, 290, 20, 250, 250, 0, 0, 250, 250);
}
private:
//==============================================================================
// Your private member variables go here...
Image argbImage { Image::ARGB, 250, 250, true };
Colour transparentBlack { uint8(0), uint8(0), uint8(0), uint8(0) };
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MyComponent)
};
my output (expected) :
2018 MBP output :
edit : 2018 MBP is running 10.13.6 if that makes any difference