Example #1
0
void DrawableImage::ValueTreeWrapper::setOverlayColour (const Colour& newColour, UndoManager* undoManager)
{
    if (newColour.isTransparent())
        state.removeProperty (overlay, undoManager);
    else
        state.setProperty (overlay, String::toHexString ((int) newColour.getARGB()), undoManager);
}
Example #2
0
void Plotter::paint (Graphics& g)
{

	if (freeMode)
	{
		g.fillAll(Colour(0xFF161616));
	}
	else
	{
		Colour background = findColour(backgroundColour);

		if (!background.isTransparent()) g.fillAll((modQueue.size() == 0 || freeMode) ? background.withAlpha(0.7f) : background);
	}

	Path drawPath;

	const float factor = 1024.0f / (float)getWidth();

	drawPath.startNewSubPath(0.0f, (float)getHeight());
	for(int i = 0; i< 1024; i++)
	{
		int pos = (i + currentRingBufferPosition) % 1024;

		const float thisValue = jlimit<float>(0.0f, 1.0f, internalBuffer[pos]);

		drawPath.lineTo(i/factor, getHeight() - thisValue * getHeight());
	}
    
	drawPath.lineTo((float)getWidth(), (float)getHeight());

	if (freeMode)
	{
		g.setColour(Colours::red.withBrightness(0.6f));
			
		g.fillPath(drawPath);
	}
	else
	{
		//KnobLookAndFeel::fillPathHiStyle(g, drawPath, getWidth(), getHeight(), false);

		g.setGradientFill(ColourGradient(findColour(pathColour),
			0.0f, 0.0f,
			findColour(pathColour2),
			0.0f, (float)getHeight(),
			false));

		g.fillPath(drawPath);

		//DropShadow d(Colours::white.withAlpha(drawBorders ? 0.2f : 0.1f), 5, Point<int>());

		//d.drawForPath(g, p);
	}

	

	
	
}
void Graphics::fillAll (Colour colourToUse) const
{
    if (! colourToUse.isTransparent())
    {
        const Rectangle<int> clip (context.getClipBounds());

        context.saveState();
        context.setFill (colourToUse);
        context.fillRect (clip, false);
        context.restoreState();
    }
}
void MidiKeyboardComponent::drawWhiteNote (int midiNoteNumber, Graphics& g, Rectangle<float> area,
                                           bool isDown, bool isOver, Colour lineColour, Colour textColour)
{
    auto c = Colours::transparentWhite;

    if (isDown)  c = findColour (keyDownOverlayColourId);
    if (isOver)  c = c.overlaidWith (findColour (mouseOverKeyOverlayColourId));

    g.setColour (c);
    g.fillRect (area);

    auto text = getWhiteNoteText (midiNoteNumber);

    if (text.isNotEmpty())
    {
        auto fontHeight = jmin (12.0f, keyWidth * 0.9f);

        g.setColour (textColour);
        g.setFont (Font (fontHeight).withHorizontalScale (0.8f));

        switch (orientation)
        {
            case horizontalKeyboard:            g.drawText (text, area.withTrimmedLeft (1.0f).withTrimmedBottom (2.0f), Justification::centredBottom, false); break;
            case verticalKeyboardFacingLeft:    g.drawText (text, area.reduced (2.0f), Justification::centredLeft,   false); break;
            case verticalKeyboardFacingRight:   g.drawText (text, area.reduced (2.0f), Justification::centredRight,  false); break;
            default: break;
        }
    }

    if (! lineColour.isTransparent())
    {
        g.setColour (lineColour);

        switch (orientation)
        {
            case horizontalKeyboard:            g.fillRect (area.withWidth (1.0f)); break;
            case verticalKeyboardFacingLeft:    g.fillRect (area.withHeight (1.0f)); break;
            case verticalKeyboardFacingRight:   g.fillRect (area.removeFromBottom (1.0f)); break;
            default: break;
        }

        if (midiNoteNumber == rangeEnd)
        {
            switch (orientation)
            {
                case horizontalKeyboard:            g.fillRect (area.expanded (1.0f, 0).removeFromRight (1.0f)); break;
                case verticalKeyboardFacingLeft:    g.fillRect (area.expanded (0, 1.0f).removeFromBottom (1.0f)); break;
                case verticalKeyboardFacingRight:   g.fillRect (area.expanded (0, 1.0f).removeFromTop (1.0f)); break;
                default: break;
            }
        }
    }
}