Background Graphics


#1

Hey community,

I’m currently writing my first audio plugin, but i have a problem with the graphics.
My plugin window is 860px X 508px,
I would like to make my background white, with a grey bottom bar in full width and 350px height.
The colours should be written like RGB values.
Can anyone find a mistake or does anyone know how to do it better?

Here’s a Code strip:

void PluginAudioProcessorEditor::paint(Graphics& g)
{
	// Roh Hintergrund / Raw Backgroud
		
		//Hintergrundfrabe / Background colour
		g.fillAll (Colour (255, 255, 255) );

		//Logoleiste / Bottom Bar
		g.setColour(Colour (15, 15, 15));
		g.drawRect(300, 120, 860, 350);
}

Many thanks


#2

a) you are calling drawRect() instead of fillRect() (?)
b) you have an offset of 300 and 120
so you probably want to do g.fillRect(0, 508 - 350, 860, 350);

you could also write it like that :

void PluginAudioProcessorEditor::paint (Graphics& g)
{
    auto area = getLocalBounds();
    g.setColour (Colour (15, 15, 15));
    g.fillRect (area.removeFromBottom (350));
    g.setColour (Colours::white)
    g.fillRect (area);
}

#3

yes it works :slight_smile:

Thanks


#4

Definitely watch this video! It helped me a lot when I started using JUCE. The part about “rectangle cutting” is probably the most important in there. It’s what lalala recommends in his answer and reduces developing time a lot.


#5

Thanks for this video, it helped my a lot.
:slightly_smiling_face: