本文整理汇总了C++中DropShadow::drawForPath方法的典型用法代码示例。如果您正苦于以下问题:C++ DropShadow::drawForPath方法的具体用法?C++ DropShadow::drawForPath怎么用?C++ DropShadow::drawForPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DropShadow
的用法示例。
在下文中一共展示了DropShadow::drawForPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void Oscilloscope::paint(Graphics& g) {
static const DropShadow shadow(Colour(0xbb000000), 5, Point<int>(0, 0));
g.drawImageWithin(background_,
0, 0, getWidth(), getHeight(), RectanglePlacement());
shadow.drawForPath(g, wave_path_);
g.setColour(Colour(0xff565656));
g.fillPath(wave_path_);
g.setColour(Colour(0xffaaaaaa));
g.strokePath(wave_path_, PathStrokeType(1.0f, PathStrokeType::beveled, PathStrokeType::rounded));
}
示例2: drawLinearSliderThumb
void CustomLookAndFeel::drawLinearSliderThumb (Graphics& g, int x, int y, int width,
int height, float sliderPos,
float minSliderPos, float maxSliderPos,
const Slider::SliderStyle style,
Slider& slider)
{
if (style == Slider::LinearVertical)
{
bool isDownOrDragging = slider.isEnabled() && (slider.isMouseOverOrDragging() || slider.isMouseButtonDown());
Colour knobColour (slider.findColour (Slider::thumbColourId).withMultipliedSaturation ((slider.hasKeyboardFocus (false) || isDownOrDragging) ? 1.3f : 0.9f)
.withMultipliedAlpha (slider.isEnabled() ? 1.0f : 0.7f));
const float thumbWidth = jmin (slider.getWidth() - 2 * spaceBetweenThumbAndComponentBorder,
maxThumbWidthVertical);
const float thumbHeight = thumbWidth * heightToWidthRatioVertical;
const float xCenter = x + width * 0.5f;
// Originally it was yCenter = sliderPos. But that way the thumb (and especially the center line) did
// not always look the same because of aliasing. With this additional rounding it is ensured that the
// vertical position of the thumb "snaps" to the closest pixel and therefore looks always the same.
const float yCenter = (int)(sliderPos) + 0.5f;
const float xThumb = xCenter - 0.5f * thumbWidth;
const float yThumb = yCenter - 0.5f * thumbHeight;
// The shape of the thumb
Path p;
p.addRoundedRectangle(xThumb, yThumb, thumbWidth, thumbHeight, 5.0f);
// Drop shadow
const DropShadow ds (Colours::black, 4, Point<int> (0, 0));
ds.drawForPath (g, p);
// Outline
const float outlineThickness = slider.isEnabled() ? 0.8f : 0.3f;
g.setColour (Colours::black);
//g.setColour (knobColour.darker());
g.strokePath (p, PathStrokeType (outlineThickness));
// Fill
ColourGradient gradient (knobColour.darker(), xThumb, yThumb,
knobColour.darker(), xThumb, yThumb + thumbHeight, false);
gradient.addColour (0.5, knobColour.brighter());
g.setGradientFill(gradient);
g.fillPath (p);
// g.setColour (knobColour);
// g.fillPath (p);
// Middle line
g.setColour(Colours::black);
g.drawLine(xThumb, yCenter, xThumb + thumbWidth, yCenter);
}
else
{
// Just call the base class for the demo
LookAndFeel_V3::drawLinearSliderThumb (g, x, y, width, height, sliderPos, minSliderPos, maxSliderPos, style, slider);
}
}
示例3: drawRotaryShadow
void SynthSlider::drawRotaryShadow(Graphics &g) {
static const DropShadow shadow(Colour(0xbb000000), 3, Point<int>(0, 0));
static const float shadow_angle = mopo::PI / 1.3f;
g.saveState();
g.setOrigin(getX(), getY());
float full_radius = std::min(getWidth() / 2.0f, getHeight() / 2.0f);
Path shadow_path;
shadow_path.addCentredArc(full_radius, full_radius,
0.87f * full_radius, 0.85f * full_radius,
0, -shadow_angle, shadow_angle, true);
shadow.drawForPath(g, shadow_path);
g.restoreState();
}
示例4: paint
void FilterResponse::paint(Graphics& g) {
static const PathStrokeType stroke(1.5f, PathStrokeType::beveled, PathStrokeType::rounded);
static const DropShadow shadow(Colour(0xbb000000), 5, Point<int>(0, 0));
g.drawImage(background_,
0, 0, getWidth(), getHeight(),
0, 0, background_.getWidth(), background_.getHeight());
shadow.drawForPath(g, filter_response_path_);
g.setColour(Colour(0xff565656));
g.fillPath(filter_response_path_);
g.setColour(Colour(0xff03a9f4));
g.strokePath(filter_response_path_, stroke);
}
示例5: drawRoundThumb
void drawRoundThumb (Graphics& g, const float x, const float y,
const float diameter, const Colour& colour, float outlineThickness)
{
const Rectangle<float> a (x, y, diameter, diameter);
const float halfThickness = outlineThickness * 0.5f;
Path p;
p.addEllipse (x + halfThickness, y + halfThickness, diameter - outlineThickness, diameter - outlineThickness);
const DropShadow ds (Colours::black, 1, Point<int> (0, 0));
ds.drawForPath (g, p);
g.setColour (colour);
g.fillPath (p);
g.setColour (colour.brighter());
g.strokePath (p, PathStrokeType (outlineThickness));
}
示例6: paintBackground
void WaveViewer::paintBackground(Graphics& g) {
static const DropShadow shadow(Colour(0xbb000000), 5, Point<int>(0, 0));
g.fillAll(Colour(0xff424242));
g.setColour(Colour(0xff4a4a4a));
for (int x = 0; x < getWidth(); x += GRID_CELL_WIDTH)
g.drawLine(x, 0, x, getHeight());
for (int y = 0; y < getHeight(); y += GRID_CELL_WIDTH)
g.drawLine(0, y, getWidth(), y);
shadow.drawForPath(g, wave_path_);
g.setColour(Colour(0xff565656));
g.fillPath(wave_path_);
g.setColour(Colour(0xff03a9f4));
g.strokePath(wave_path_, PathStrokeType(1.5f, PathStrokeType::beveled, PathStrokeType::rounded));
}
示例7: drawToggleButton
void DefaultLookAndFeel::drawToggleButton(Graphics& g, ToggleButton& button,
bool isMouseOverButton, bool isButtonDown) {
static const DropShadow shadow(Colour(0x88000000), 1.0f, Point<int>(0, 0));
static float stroke_percent = 0.1;
static float padding = 3.0f;
static float hover_padding = 1.0f;
float full_radius = std::min(button.getWidth(), button.getHeight()) / 2.0;
float stroke_width = 2.0f * full_radius * stroke_percent;
PathStrokeType stroke_type(stroke_width, PathStrokeType::beveled, PathStrokeType::rounded);
float outer_radius = full_radius - stroke_width - padding;
Path outer;
outer.addCentredArc(full_radius, full_radius, outer_radius, outer_radius,
mopo::PI, -POWER_ARC_ANGLE, POWER_ARC_ANGLE, true);
Path shadow_path;
stroke_type.createStrokedPath(shadow_path, outer);
shadow.drawForPath(g, shadow_path);
Rectangle<int> bar_shadow_rect(full_radius - 1.0f, padding, 2.0f, full_radius - padding);
shadow.drawForRectangle(g, bar_shadow_rect);
if (button.getToggleState())
g.setColour(Colours::white);
else
g.setColour(Colours::grey);
g.strokePath(outer, stroke_type);
g.fillRoundedRectangle(full_radius - 1.0f, padding, 2.0f, full_radius - padding, 1.0f);
if (isButtonDown) {
g.setColour(Colour(0x11000000));
g.fillEllipse(hover_padding, hover_padding,
button.getWidth() - 2 * hover_padding, button.getHeight() - 2 * hover_padding);
}
else if (isMouseOverButton) {
g.setColour(Colour(0x11ffffff));
g.fillEllipse(hover_padding, hover_padding,
button.getWidth() - 2 * hover_padding, button.getHeight() - 2 * hover_padding); }
}