I’d like to write code like this:
void MyComponent::paint (Graphics& g)
{
LowLevelGraphicsSoftwareRenderer* ren = dynamic_cast <LowLevelGraphicsSoftwareRenderer*>
(&g.getInternalContext ());
jassert (ren != nullptr);
}
For this to work, it needs to be possible to customize from within the ComponentPeer. It looks like ComponentPeer::handlePaint() has something like this but it seems only active for windows:
juce_win32_Windowing.cpp
ScopedPointer<LowLevelGraphicsContext> context (component.getLookAndFeel()
.createGraphicsContext (offscreenImage, Point<int> (-x, -y), contextClip));
I’d like to be able to control the creation of the low level graphics context on all platforms, for my ComponentPeer. This way I can guarantee that it always uses the LowLevelGraphicsSoftwareRenderer.
Next, I’d like to be able to get the Image from a LowLevelGraphicsSoftwareRenderer. We need this function:
juce_LowLevelGraphicsSoftwareRenderer.h
Image getImage () { return savedState->image; }
If you don’t want LowLevelGraphicsSoftwareRenderer exposing the image, then let us subclass LowLevelGraphicsSoftwareRenderer so we can provide a function that does.