本文整理汇总了C++中PathStrokeType函数的典型用法代码示例。如果您正苦于以下问题:C++ PathStrokeType函数的具体用法?C++ PathStrokeType怎么用?C++ PathStrokeType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PathStrokeType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trans
void OldSchoolLookAndFeel::drawTickBox (Graphics& g,
Component& /*component*/,
float x, float y, float w, float h,
const bool ticked,
const bool isEnabled,
const bool /*isMouseOverButton*/,
const bool isButtonDown)
{
Path box;
box.addRoundedRectangle (0.0f, 2.0f, 6.0f, 6.0f, 1.0f);
g.setColour (isEnabled ? Colours::blue.withAlpha (isButtonDown ? 0.3f : 0.1f)
: Colours::lightgrey.withAlpha (0.1f));
AffineTransform trans (AffineTransform::scale (w / 9.0f, h / 9.0f).translated (x, y));
g.fillPath (box, trans);
g.setColour (Colours::black.withAlpha (0.6f));
g.strokePath (box, PathStrokeType (0.9f), trans);
if (ticked)
{
Path tick;
tick.startNewSubPath (1.5f, 3.0f);
tick.lineTo (3.0f, 6.0f);
tick.lineTo (6.0f, 0.0f);
g.setColour (isEnabled ? Colours::black : Colours::grey);
g.strokePath (tick, PathStrokeType (2.5f), trans);
}
}
示例2: getWidth
void HoaMeterComponent::draw_leds(Graphics& g)
{
int i;
float j, dB;
float angle_start, angle, angle_end, radius, center_x, center_y;
float led_width = 0.49 * getWidth() / 18.;
float h = led_width * 18.;
float thickness = led_width - 2;
if(getWidth() < 125)
thickness = led_width - 1;
Path p;
for(i = 0; i < m_meter->getNumberOfChannels(); i++)
{
angle = -m_meter->getChannelAzimuthMapped(i);
center_x = Hoa::abscissa(m_radius - h, angle);
center_y = Hoa::ordinate(m_radius - h, angle);
angle_start = angle - m_meter->getChannelWidth(i) * 0.5f;
angle_end = angle + m_meter->getChannelWidth(i) * 0.5f;
for(j = 11, dB = -34.5; j > -1; j--, dB += 3.)
{
radius = (j + 5.) * led_width;
if(m_meter->getChannelEnergy(i) > dB)
{
if(j > 8)
g.setColour(Colours::green);
else if(j > 5)
g.setColour(Colours::greenyellow);
else if(j > 2)
g.setColour(Colours::yellow);
else
g.setColour(Colours::orange);
p.addCentredArc(center_x + m_center, center_y + m_center, radius, radius, HOA_2PI, angle_start, angle_end, 1);
g.strokePath(p, PathStrokeType(thickness, PathStrokeType::beveled, PathStrokeType::butt));
p.clear();
}
else if(j != -1)
{
g.setColour(Colours::grey);
p.addCentredArc(center_x + m_center, center_y + m_center, radius, radius, HOA_2PI, angle_start, angle_end, 1);
g.strokePath(p, PathStrokeType(thickness, PathStrokeType::beveled, PathStrokeType::butt));
p.clear();
}
}
}
};
示例3: baseColour
void IntrojucerLookAndFeel::drawButtonBackground (Graphics& g,
Button& button,
const Colour& backgroundColour,
bool isMouseOverButton,
bool isButtonDown)
{
const bool flatOnLeft = button.isConnectedOnLeft();
const bool flatOnRight = button.isConnectedOnRight();
const bool flatOnTop = button.isConnectedOnTop();
const bool flatOnBottom = button.isConnectedOnBottom();
const float width = (float) button.getWidth();
const float height = (float) button.getHeight();
const float x = 0.5f;
const float y = 0.5f;
const float w = width - 1.0f;
const float h = height - 1.0f;
const float cornerSize = 4.0f;
Colour baseColour (backgroundColour.withMultipliedSaturation (button.hasKeyboardFocus (true)
? 1.3f : 0.9f)
.withMultipliedAlpha (button.isEnabled() ? 0.9f : 0.5f));
if (isButtonDown) baseColour = baseColour.contrasting (0.2f);
else if (isMouseOverButton) baseColour = baseColour.contrasting (0.1f);
const float mainBrightness = baseColour.getBrightness();
const float mainAlpha = baseColour.getFloatAlpha();
Path outline;
outline.addRoundedRectangle (x, y, w, h, cornerSize, cornerSize,
! (flatOnLeft || flatOnTop),
! (flatOnRight || flatOnTop),
! (flatOnLeft || flatOnBottom),
! (flatOnRight || flatOnBottom));
g.setGradientFill (ColourGradient (baseColour.brighter (0.2f), 0.0f, 0.0f,
baseColour.darker (0.25f), 0.0f, height, false));
g.fillPath (outline);
g.setColour (Colours::white.withAlpha (0.4f * mainAlpha * mainBrightness * mainBrightness));
g.strokePath (outline, PathStrokeType (1.0f), AffineTransform::translation (0.0f, 1.0f)
.scaled (1.0f, (h - 1.6f) / h));
g.setColour (Colours::black.withAlpha (0.4f * mainAlpha));
g.strokePath (outline, PathStrokeType (1.0f));
}
示例4: drawTrail
void drawTrail (Trail& trail, Graphics& g)
{
g.setColour (trail.colour);
g.strokePath (trail.path, PathStrokeType (20.0f, PathStrokeType::curved, PathStrokeType::rounded));
const float radius = 40.0f;
g.setColour (Colours::black);
g.drawEllipse (trail.currentPosition.x - radius,
trail.currentPosition.y - radius,
radius * 2.0f, radius * 2.0f, 2.0f);
g.setFont (14.0f);
String desc ("Mouse #");
desc << trail.source.getIndex();
if (trail.modifierKeys.isCommandDown()) desc << " (CMD)";
if (trail.modifierKeys.isShiftDown()) desc << " (SHIFT)";
if (trail.modifierKeys.isCtrlDown()) desc << " (CTRL)";
if (trail.modifierKeys.isAltDown()) desc << " (ALT)";
g.drawText (desc,
Rectangle<int> ((int) trail.currentPosition.x - 200,
(int) trail.currentPosition.y - 60,
400, 20),
Justification::centredTop, false);
}
示例5: PathStrokeType
void DistortionComponent::paint (Graphics& g)
{
g.drawImageAt (background, 0, 0);
g.setColour (Colours::white);
g.strokePath (path, PathStrokeType (2.0f));
}
示例6: paint
void paint (Graphics& g) override
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (Colours::black);
g.setColour (Colours::white);
const int fishLength = 15;
Path spinePath;
for (int i = 0; i < fishLength; ++i)
{
const float radius = 100 + 10 * std::sin (getFrameCounter() * 0.1f + i * 0.5f);
Point<float> p (getWidth() / 2.0f + 1.5f * radius * std::sin (getFrameCounter() * 0.02f + i * 0.12f),
getHeight() / 2.0f + 1.0f * radius * std::cos (getFrameCounter() * 0.04f + i * 0.12f));
// draw the circles along the fish
g.fillEllipse (p.x - i, p.y - i, 2.0f + 2.0f * i, 2.0f + 2.0f * i);
if (i == 0)
spinePath.startNewSubPath (p); // if this is the first point, start a new path..
else
spinePath.lineTo (p); // ...otherwise add the next point
}
// draw an outline around the path that we have created
g.strokePath (spinePath, PathStrokeType (4.0f));
}
示例7: drawGlassLozenge
void NonShinyLookAndFeel::drawTickBox (Graphics& g,
Component& component,
float x, float y, float w, float h,
const bool ticked,
const bool isEnabled,
const bool isMouseOverButton,
const bool isButtonDown)
{
const float boxSize = w * 0.8f;
drawGlassLozenge (g,x,y+(h-boxSize)*0.5f,boxSize,boxSize,
createBaseColour (component.findColour (TextButton::buttonColourId)
.withMultipliedAlpha (isEnabled ? 1.0f : 0.5f),
true,
isMouseOverButton,
isButtonDown),
isEnabled ? ((isButtonDown || isMouseOverButton) ? 1.2f : 0.7f) : 0.4f,
-1.0f,true,true,true,true);
if (ticked)
{
Path tick;
tick.startNewSubPath (2.0f, 3.0f);
tick.lineTo (3.5f, 6.0f);
tick.lineTo (6.5f, 0.0f);
g.setColour (isEnabled ? Colours::black : Colours::grey);
const AffineTransform trans (AffineTransform::scale (w / 9.0f, h / 9.0f)
.translated (x, y));
g.strokePath (tick, PathStrokeType (2.5f), trans);
}
}
示例8: drawRotarySlider
void drawRotarySlider (Graphics& g, int x, int y, int width, int height, float sliderPos,
float rotaryStartAngle, float rotaryEndAngle, Slider& slider) override
{
const float radius = jmin (width / 2, height / 2) - 2.0f;
const float centreX = x + width * 0.5f;
const float centreY = y + height * 0.5f;
const float rx = centreX - radius;
const float ry = centreY - radius;
const float rw = radius * 2.0f;
const float angle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);
const bool isMouseOver = slider.isMouseOverOrDragging() && slider.isEnabled();
if (slider.isEnabled())
g.setColour (slider.findColour (Slider::rotarySliderFillColourId).withAlpha (isMouseOver ? 1.0f : 0.7f));
else
g.setColour (Colour (0x80808080));
{
Path filledArc;
filledArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, angle, 0.0);
g.fillPath (filledArc);
}
{
const float lineThickness = jmin (15.0f, jmin (width, height) * 0.45f) * 0.1f;
Path outlineArc;
outlineArc.addPieSegment (rx, ry, rw, rw, rotaryStartAngle, rotaryEndAngle, 0.0);
g.strokePath (outlineArc, PathStrokeType (lineThickness));
}
}
示例9: jmin
void MyLookAndFeel::drawRotarySlider(Graphics& g,
int x, int y,
int width, int height,
float sliderPos,
const float rotaryStartAngle,
const float rotaryEndAngle,
Slider& /*slider*/)
{
const float radius = jmin (width / 2, height / 2) - 2.0f;
const float centreX = x + width * 0.5f;
const float centreY = y + height * 0.5f;
const float rx = centreX - radius;
const float ry = centreY - radius;
const float rw = radius * 2.0f;
const float angle = rotaryStartAngle + sliderPos * (rotaryEndAngle - rotaryStartAngle);
//const bool isMouseOver = slider.isMouseOverOrDragging() && slider.isEnabled();
//const float zeroPos = rotaryStartAngle + std::abs((float)slider.getMinimum() / ((float)slider.getMaximum() - (float)slider.getMinimum())) * (rotaryEndAngle - rotaryStartAngle);
Path p;
PathStrokeType (rw * 0.01f).createStrokedPath (p, p);
p.addLineSegment (Line<float>(0.0f, -radius * 0.5f, 0.00f, -radius), rw * 0.08f);
g.setColour (Colours::white.withAlpha (1.0f));
g.fillPath (p, AffineTransform::rotation (angle).translated (centreX, centreY));
g.setColour (Colours::black.withAlpha (0.7f));
g.drawEllipse (rx, ry, rw, rw, 1.0f);
}
示例10: getWidth
void FilterResponseDisplay::paint(Graphics& g)
{
float width = (float) getWidth();
float height = (float) getHeight();
g.setColour(displayBackgroundColor);
g.fillRect(0.0, 0.0, width, height);
magnitudeResponsePath.clear();
int filterType = filterToUse->getFilterType();
switch (filterType) {
case AudioFilter::filterTypeList::LowPass:
drawLowpass();
break;
case AudioFilter::filterTypeList::HighPass:
drawHighpass();
break;
}
//Close the response path drawn
magnitudeResponsePath.closeSubPath();
g.setColour(magResponseColour);
g.strokePath(magnitudeResponsePath, PathStrokeType(filterPathThickness));
/*
Fill area under/inside path with same colour at a lower alpha / highlight value.
Try setting magResponseColour.withAlpha value to different values to get a fill shade you like.
*/
g.setColour(magResponseColour.withAlpha((uint8) 0x9a));
g.fillPath(magnitudeResponsePath);
}
示例11: getWidth
void ShapeButton::paintButton (Graphics& g, bool isMouseOverButton, bool isButtonDown)
{
if (! isEnabled())
{
isMouseOverButton = false;
isButtonDown = false;
}
g.setColour ((isButtonDown) ? downColour
: (isMouseOverButton) ? overColour
: normalColour);
int w = getWidth();
int h = getHeight();
if (getComponentEffect() != nullptr)
{
w -= 4;
h -= 4;
}
const float offset = (outlineWidth * 0.5f) + (isButtonDown ? 1.5f : 0.0f);
const AffineTransform trans (shape.getTransformToScaleToFit (offset, offset,
w - offset - outlineWidth,
h - offset - outlineWidth,
maintainShapeProportions));
g.fillPath (shape, trans);
if (outlineWidth > 0.0f)
{
g.setColour (outlineColour);
g.strokePath (shape, PathStrokeType (outlineWidth), trans);
}
}
示例12: PathStrokeType
//==============================================================================
void DrumSynthEnvelope::paint (Graphics& g)
{
const int dotSize = MAX_ENVELOPE_DOT_SIZE;
const int halfDotSize = dotSize / 2;
g.fillAll (Colour (0x47ffffff));
Path myPath;
myPath.startNewSubPath (0, points[0][1]);
for (int i = 1; i < MAX_ENVELOPE_POINTS; i++)
myPath.lineTo (points[i][0], points[i][1]);
g.setColour (Colours::white);
g.strokePath (myPath, PathStrokeType (2.0f));
g.setColour (Colours::black);
for (int i = 0; i < MAX_ENVELOPE_POINTS; i++)
{
int x = (int) (points[i][0]);
int y = (int) (points[i][1]);
g.setColour (Colours::white);
g.fillEllipse (x - halfDotSize, y - halfDotSize, dotSize, dotSize);
if (draggingPoint == i) {
g.setColour (Colours::red);
g.drawEllipse (x - halfDotSize, y - halfDotSize, dotSize, dotSize, 2);
} else {
g.setColour (Colours::black);
g.drawEllipse (x - halfDotSize, y - halfDotSize, dotSize, dotSize, 1);
}
示例13: paint
//==============================================================================
void paint (Graphics& g) override
{
// (Our component is opaque, so we must completely fill the background with a solid colour)
g.fillAll (Colours::black);
const float centreY = getHeight() / 2.0f;
const float radius = amplitude * 200.0f;
// Draw an ellipse based on the mouse position and audio volume
g.setColour (Colours::lightgreen);
g.fillEllipse (lastMousePosition.x - radius / 2.0f,
lastMousePosition.y - radius / 2.0f,
radius, radius);
// Draw a representative sine wave.
Path wavePath;
wavePath.startNewSubPath (0, centreY);
for (float x = 1.0f; x < getWidth(); ++x)
wavePath.lineTo (x, centreY + amplitude * getHeight() * 2.0f
* std::sin (x * frequency * 0.0001f));
g.setColour (Colours::grey);
g.strokePath (wavePath, PathStrokeType (2.0f));
}
示例14: isMouseOverOrDragging
//==============================================================================
void GraphLinkComponent::paint (Graphics& g)
{
Colour wireColour = Colours::black;
if ((to != 0 && from != 0))
{
GraphNodeComponent* node = to->getParentGraphComponent ();
wireColour = node->getConnectorColour (to, isMouseOverOrDragging());
}
else
{
if (to)
{
GraphNodeComponent* node = to->getParentGraphComponent ();
wireColour = node->getConnectorColour (to, true);
}
else if (from)
{
GraphNodeComponent* node = from->getParentGraphComponent ();
wireColour = node->getConnectorColour (from, true);
}
}
g.setColour (wireColour);
g.strokePath (path, PathStrokeType (lineThickness));
示例15: thumbCol
void IntrojucerLookAndFeel::drawScrollbar (Graphics& g, ScrollBar& scrollbar, int x, int y, int width, int height,
bool isScrollbarVertical, int thumbStartPosition, int thumbSize,
bool isMouseOver, bool isMouseDown)
{
Path thumbPath;
if (thumbSize > 0)
{
const float thumbIndent = (isScrollbarVertical ? width : height) * 0.25f;
const float thumbIndentx2 = thumbIndent * 2.0f;
if (isScrollbarVertical)
thumbPath.addRoundedRectangle (x + thumbIndent, thumbStartPosition + thumbIndent,
width - thumbIndentx2, thumbSize - thumbIndentx2, (width - thumbIndentx2) * 0.5f);
else
thumbPath.addRoundedRectangle (thumbStartPosition + thumbIndent, y + thumbIndent,
thumbSize - thumbIndentx2, height - thumbIndentx2, (height - thumbIndentx2) * 0.5f);
}
Colour thumbCol (scrollbar.findColour (ScrollBar::thumbColourId, true));
if (isMouseOver || isMouseDown)
thumbCol = thumbCol.withMultipliedAlpha (2.0f);
g.setColour (thumbCol);
g.fillPath (thumbPath);
g.setColour (thumbCol.contrasting ((isMouseOver || isMouseDown) ? 0.2f : 0.1f));
g.strokePath (thumbPath, PathStrokeType (1.0f));
}