raketa
July 22, 2014, 8:50am
1
Hi,
I have two Drawables (DrawableComposites) that contain the "on" and "off" LED-chains for metering.
Preferably the Drawables are added to the parent component.
How can I cut one or both Drawables so that partly the "off" and partly the "on" LED-chain are shown?
Thanks,
raketa
jules
July 22, 2014, 9:03am
2
If you drew them with Drawable::draw rather than adding them as components, then you could clip them with Graphics::reduceClipRect
raketa
October 24, 2014, 4:52pm
3
thanks, Jules,
Befor applying reduceClipRect I was making sure the "ON" LED-chain can be drawn over "OFF":
I am using a DrawableComposite filled with the OFF state drawables (as background), I override its
void paintOverChildren (juce::Graphics & g) override {
on->draw (g, 1.);
}
to draw my foreground (on = DrawableComposite with the ON state drawable).
I would now assume that ON is painted. - But only the background OFF is seen.
(I have verified that my ON drawable works, if I add it to the "OFF"-parent as Component its displayed correctly)
Another test I did
void paintOverChildren (juce::Graphics & g) override {
on->draw (g, 1.);
g.drawRect (on->getX(), on->getY(), on->getWidth(), on->getHeight());
}
which draws the rectangle, so the coordinates should be OK. I even
on->setVisible (true)
And now I am clueless,
what else could I check...?
Thanks,
raketa.
raketa
October 29, 2014, 9:07am
4
mhhh...,
the Drawables itself are extracted from a sub Component created from an svg.
Could it be that there are different undelaying coordinate systems for the Components - so "ON" is outside the Drawable region of the background "OFF" Component?
How could I verify/correct that?
thanks,
raketa.
jules
October 29, 2014, 9:30am
5
There is a Drawable::drawWithin that should fit it within the space you want. That'll at least show whether it's drawing off-screen.