当前位置: 首页>>代码示例>>C++>>正文


C++ juce::Graphics类代码示例

本文整理汇总了C++中juce::Graphics的典型用法代码示例。如果您正苦于以下问题:C++ Graphics类的具体用法?C++ Graphics怎么用?C++ Graphics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Graphics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawTickBox

void NTLookAndFeel::drawTickBox(juce::Graphics &g, juce::Component &button, float x, float y, float w, float h, bool ticked, bool isEnabled, bool isMouseOverButton, bool isButtonDown){
    
    auto& toggle = dynamic_cast<ToggleButton&>(button);
    
    if (toggle.getRadioGroupId() > 0) {
        auto rect = Rectangle<float>(x,y,w,h);
        rect.reduce(w * .2, h*.2);
        
        g.setColour(Colours::white);
        g.fillEllipse(rect);
        g.setColour(Colours::lightgrey);
        g.drawEllipse(rect,2);
        
        if (ticked) {
            rect.reduce(rect.getWidth() * .2,rect.getHeight() *.2);

            g.fillEllipse(rect);
        }
    }else{
        auto rect = Rectangle<float>(x,y,w,h);
        g.setColour(Colours::white);
        g.fillRect(rect);
        g.setColour(Colours::lightgrey);
        g.drawRect(rect,3);
        if (ticked) {
            rect.reduce(rect.getWidth() * .25,rect.getHeight() *.25);
            g.fillRect(rect);
        }

    }
    
    
}
开发者ID:Besegra-Mjolnir,项目名称:TopologyOptimization-1,代码行数:33,代码来源:NTLookAndFeel.cpp

示例2: paint

void OscOutputManagerHeaderComponent::paint(juce::Graphics &g)
{
	g.setColour( AddictLookAndFeel::getBackgroundColour() );
	g.fillAll();
	g.setColour( AddictLookAndFeel::getOutlineColour() );
	g.drawLine( 0.0f, float(getHeight()), float(getWidth()), float(getHeight()));
}
开发者ID:jorisdejong,项目名称:ColorAddict,代码行数:7,代码来源:OscOutputManagerComponent.cpp

示例3: paint

void CpuRegistersComponent::paint(juce::Graphics& g)
{
	g.fillAll(juce::Colours::white);

	g.setColour(juce::Colours::orange);
	g.drawRect(getLocalBounds(), 1);
}
开发者ID:idearcos,项目名称:super-jucy-boy,代码行数:7,代码来源:CpuRegistersComponent.cpp

示例4: paint

void IRBrowserComponent::paint(juce::Graphics& g)
{
  if (_fileTreeComponent && _infoLabel)
  {
    const int width = getWidth();
    const int height = getHeight();
    
    g.setColour(juce::Colour(0xE5, 0xE5, 0xF0));
    g.fillRect(0.0f, 0.0f, static_cast<float>(width), static_cast<float>(height));
    
    g.setColour(juce::Colours::grey);
    g.drawRect(0.0f, 0.0f, static_cast<float>(width), static_cast<float>(height));
    g.drawVerticalLine(_fileTreeComponent->getX()+_fileTreeComponent->getWidth(), 0.0f, static_cast<float>(height-1));
  }
}
开发者ID:dennyabrain,项目名称:DISTRHO,代码行数:15,代码来源:IRBrowserComponent.cpp

示例5: paintListBoxItem

void StringListBoxModel::paintListBoxItem(const int rowNumber,
        juce::Graphics &g,
        const int width,
        const int height,
        const bool /*rowIsSelected*/)
{
    if (rowNumber < getNumRows())
    {
        g.setColour(juce::Colours::black);
        juce::Font font(height * 0.7f);
        font.setHorizontalScale(0.9f);
        g.setFont(font);
        g.drawText(juce::String(items[rowNumber].c_str()), 4, 0, width - 6, height, juce::Justification::centredLeft);
    }
}
开发者ID:capsocrates,项目名称:SuddenMagic,代码行数:15,代码来源:StringListBoxModel.cpp

示例6: paint

void WaveViewer::paint(juce::Graphics &g) {
  g.drawImage(background_,
              0, 0, getWidth(), getHeight(),
              0, 0, background_.getWidth(), background_.getHeight());

  if (wave_state_) {
    float amplitude = amplitude_slider_ ? amplitude_slider_->getValue() : 1.0f;

    if (phase_ >= 0.0 && phase_ < 1.0) {
      float x = phaseToX(phase_);
      g.setColour(Colour(0x33ffffff));
      g.fillRect(x - 0.5f, 0.0f, 1.0f, (float)getHeight());

      mopo::Wave::Type type = static_cast<mopo::Wave::Type>(static_cast<int>(wave_slider_->getValue()));
      float value = amplitude * mopo::Wave::wave(type, phase_);
      float y = PADDING + (getHeight() - 2 * PADDING) * (1.0f - value) / 2.0f;
      g.setColour(Colour(0xff03a9f4));
      g.fillEllipse(x - MARKER_WIDTH / 2.0f, y - MARKER_WIDTH / 2.0f,
                    MARKER_WIDTH, MARKER_WIDTH);
      g.setColour(Colour(0xffffffff));
      g.fillEllipse(x - MARKER_WIDTH / 4.0f, y - MARKER_WIDTH / 4.0f,
                    MARKER_WIDTH / 2.0f, MARKER_WIDTH / 2.0f);
    }
  }
}
开发者ID:hztirf,项目名称:helm,代码行数:25,代码来源:wave_viewer.cpp

示例7: paintListBoxItem

void InterfaceComponent::paintListBoxItem (const int rowNumber,
                                           juce::Graphics& g,
                                           const int width, const int height,
                                           const bool isRowSelected)
{
    if (isRowSelected)
    {
        g.fillAll (juce::Colours::white.darker());
        g.setColour (juce::Colours::white.darker().contrasting());
    }
    else
    {
        g.setColour (fileListBox.findColour (juce::ListBox::textColourId));
    }

    g.setFont (height * 0.7f);

    g.drawText (files[rowNumber],
                5, 0, width, height,
                juce::Justification::centredLeft, false);

    const float h = (float) height;
    const float w = (float) width;
    const float offset = 5.0f;
    const float thickness = 0.25f;

    g.setColour (juce::Colours::lightgrey);

    g.drawLine (offset, h - thickness,
                w - (offset * 2.0f), h - thickness,
                thickness);
}
开发者ID:jrlanglois,项目名称:FileModularizer,代码行数:32,代码来源:InterfaceComponent.cpp

示例8: drawLabel

void NTLookAndFeel::drawLabel(juce::Graphics &g, juce::Label &label){
    g.fillAll (label.findColour (Label::backgroundColourId));
    
    if (! label.isBeingEdited())
    {
        const float alpha = label.isEnabled() ? 1.0f : 0.5f;
        const Font font (getLabelFont (label));
        
        g.setColour (label.findColour (Label::textColourId).withMultipliedAlpha (alpha));
        g.setFont (font);
        
        Rectangle<int> textArea (label.getBorderSize().subtractedFrom (label.getLocalBounds()));
        
        g.drawFittedText (label.getText(), textArea, label.getJustificationType(),
                          jmax (1, (int) (textArea.getHeight() / font.getHeight())),
                          label.getMinimumHorizontalScale());
        
        g.setColour (label.findColour (Label::outlineColourId).withMultipliedAlpha (alpha));
    }
    else if (label.isEnabled())
    {
        g.setColour (label.findColour (Label::outlineColourId));
    }
    
    g.drawRect (label.getLocalBounds(),2);
}
开发者ID:Besegra-Mjolnir,项目名称:TopologyOptimization-1,代码行数:26,代码来源:NTLookAndFeel.cpp

示例9: colour

void TaskContextListBoxModel::ItemComponent::paint (juce::Graphics& g)
{
	Colour colour (Colours::lightgrey);

	if (getTaskContext() != nullptr)
	{
		if (getTaskContext()->getState() == TaskContext::taskCompleted)
		{
			if (getTaskContext()->getResult().wasOk())
				colour = Colours::lightgreen;
			else colour = Colours::red.brighter();
		}
	}

	g.setColour (colour);
	g.fillRect(getLocalBounds());
	g.setColour (colour.darker(0.05f));
	g.drawHorizontalLine(getHeight()-1,0.0f,(float)getWidth());
}
开发者ID:haydxn,项目名称:xh_jucemodules,代码行数:19,代码来源:PooledTaskListView.cpp

示例10: paint

void MainComponent::paint (juce::Graphics& g)
{
    g.fillAll (juce::Colours::white);
    belle::JUCE::Properties JUCESpecificProperties;
    JUCESpecificProperties.GraphicsContext = &g;
    JUCESpecificProperties.ComponentContext = this;
    JUCESpecificProperties.IndexOfCanvas = 0;
    JUCESpecificProperties.PageDimensions = belle::Inches(8.5f, 11.f);
    JUCESpecificProperties.PageVisibility = belle::BoxInt(0, 0, getWidth(), getHeight());
    JUCESpecificProperties.PageArea = belle::BoxInt(0, 0, getWidth(), getHeight());
    score->Create<belle::JUCE>(JUCESpecificProperties);
}
开发者ID:burnson,项目名称:Belle,代码行数:12,代码来源:MainComponent.cpp

示例11: drawButtonBackground

void NTLookAndFeel::drawButtonBackground(juce::Graphics &g, juce::Button &button, const juce::Colour &backgroundColour,
                                         bool isMouseOverButton, bool isButtonDown){
    
	if (isMouseOverButton && !isButtonDown) {

		g.fillAll(Colour{ uint8(240),uint8(240),uint8(240) });

	}
	else if (isMouseOverButton && isButtonDown) {

		g.fillAll(Colour{ uint8(225),uint8(225),uint8(225) });

	}
	else {
		g.fillAll(Colours::white);
	}
	g.setColour(Colours::lightgrey);
	g.drawRect(0, 0, button.getWidth(), button.getHeight(), 2);

    
}
开发者ID:Besegra-Mjolnir,项目名称:TopologyOptimization-1,代码行数:21,代码来源:NTLookAndFeel.cpp

示例12: drawComboBox

void NTLookAndFeel::drawComboBox(juce::Graphics &g, int width, int height, bool isButtonDown, int buttonX, int buttonY, int buttonW, int buttonH, juce::ComboBox &box){
    g.fillAll (box.findColour (ComboBox::backgroundColourId));
    
    const Colour buttonColour (box.findColour (ComboBox::buttonColourId));
    g.setColour (Colours::lightgrey);
    g.drawRect (0, 0, width, height,2);

    
    Path p;

    
    
    int xEnd = (buttonX+buttonW) - buttonW/3;
    int midPointX = (buttonX + xEnd)/2.f;

    int yStart = buttonY + buttonH/3;
    int yEnd = (buttonY + buttonH ) - buttonH/3;
    p.addTriangle (buttonX, yStart,
                   xEnd ,yStart,
                   midPointX,yEnd);
    
    g.setColour (Colours::lightgrey);
    g.fillPath (p);
}
开发者ID:Besegra-Mjolnir,项目名称:TopologyOptimization-1,代码行数:24,代码来源:NTLookAndFeel.cpp

示例13: paint

void ReactiveWaveformElement::paint(juce::Graphics &g)
{
    g.saveState();
    g.setColour(colour());
    g.strokePath(path, PathStrokeType(lineThickness()));
    
    if (fill)
    {
        g.setColour(fillColour());
        g.fillPath(path);
    }
    
    if (clip)
    {
        g.reduceClipRegion(path);
    }
    
    GraphicsElement::paint(g);
    g.restoreState();
}
开发者ID:snanglesvoid,项目名称:SingingFaces,代码行数:20,代码来源:ReactiveWaveformElement.cpp

示例14: paint

void WaveViewer::paint(juce::Graphics &g) {
  g.drawImageWithin(background_,
                    0, 0, getWidth(), getHeight(), RectanglePlacement());

  if (wave_phase_) {
    if (phase_ >= 0.0 && phase_ < 1.0) {
      float x = phaseToX(phase_);
      g.setColour(Colour(0x33ffffff));
      g.fillRect(x - 0.5f, 0.0f, 1.0f, (float)getHeight());

      float y = PADDING + (getHeight() - 2 * PADDING) * (1.0f - amp_) / 2.0f;

      if (is_control_rate_)
        g.setColour(Colour(0xff00e676));
      else
        g.setColour(Colour(0xff03a9f4));
      g.fillEllipse(x - MARKER_WIDTH / 2.0f, y - MARKER_WIDTH / 2.0f,
                    MARKER_WIDTH, MARKER_WIDTH);
      g.setColour(Colour(0xff000000));
      g.fillEllipse(x - MARKER_WIDTH / 4.0f, y - MARKER_WIDTH / 4.0f,
                    MARKER_WIDTH / 2.0f, MARKER_WIDTH / 2.0f);
    }
  }
}
开发者ID:drstkova,项目名称:helm,代码行数:24,代码来源:wave_viewer.cpp

示例15: paint

void ReactiveRectangleElement::paint(juce::Graphics &g)
{
    g.saveState();
    
    if (clip)
    {
        g.reduceClipRegion(clipPath);
    }
    if(width() > 0 && height() > 0)
    {
        
        if (fill)
        {
            g.setColour(fillColour());
            g.fillRoundedRectangle(fx, fy, fw, fh, radius());
        }
        g.setColour(borderColour());
        g.drawRoundedRectangle(fx, fy, fw, fh, radius(), borderWidth());
        
    }
    GraphicsElement::paint(g);
    
    g.restoreState();
}
开发者ID:snanglesvoid,项目名称:SingingFaces,代码行数:24,代码来源:ReactiveRectangleElement.cpp


注:本文中的juce::Graphics类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。