本文整理汇总了C++中DropShadow::drawForRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ DropShadow::drawForRectangle方法的具体用法?C++ DropShadow::drawForRectangle怎么用?C++ DropShadow::drawForRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DropShadow
的用法示例。
在下文中一共展示了DropShadow::drawForRectangle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawLinearSlider
void DefaultLookAndFeel::drawLinearSlider(Graphics& g, int x, int y, int width, int height,
float slider_pos, float min, float max,
const Slider::SliderStyle style, Slider& slider) {
static const DropShadow thumb_shadow(Colour(0x88000000), 3, Point<int>(-1, 0));
bool bipolar = false;
bool active = true;
SynthSlider* s_slider = dynamic_cast<SynthSlider*>(&slider);
if (s_slider) {
bipolar = s_slider->isBipolar();
active = s_slider->isActive();
}
Colour slider_color(0xff888888);
Colour thumb_color(0xffffffff);
if (!active) {
slider_color = Colour(0xff424242);
thumb_color = Colour(0xff888888);
}
float pos = slider_pos - 1.0f;
if (style == Slider::SliderStyle::LinearBar) {
float h = slider.getHeight();
g.setColour(slider_color);
if (bipolar)
fillHorizontalRect(g, width / 2.0f, pos, h);
else
fillHorizontalRect(g, 0.0f, pos, h);
thumb_shadow.drawForRectangle(g, Rectangle<int>(pos + 0.5f, 0, 2, h));
g.setColour(thumb_color);
g.fillRect(pos, 0.0f, 2.0f, h);
}
else if (style == Slider::SliderStyle::LinearBarVertical) {
float w = slider.getWidth();
g.setColour(slider_color);
if (bipolar)
fillVerticalRect(g, height / 2.0f, pos, w);
else
fillVerticalRect(g, 0, pos, w);
thumb_shadow.drawForRectangle(g, Rectangle<int>(0, pos + 0.5f, w, 2));
g.setColour(thumb_color);
g.fillRect(0.0f, pos, w, 2.0f);
}
}
示例2: paint
void SaveSection::paint(Graphics& g) {
static const DropShadow shadow(Colour(0xff000000), 5, Point<int>(0, 0));
g.setColour(Colour(0xbb111111));
g.fillAll();
Rectangle<int> save_rect = getSaveRect();
shadow.drawForRectangle(g, save_rect);
g.setColour(Colour(0xff212121));
g.fillRect(save_rect);
g.saveState();
g.setOrigin(save_rect.getX() + PADDING_X, save_rect.getY() + PADDING_Y);
g.setFont(Fonts::instance()->proportional_regular().withPointHeight(14.0f));
g.setColour(Colour(0xff888888));
g.drawText(TRANS("PATCH NAME"),
0, PADDING_Y, DIVISION - 10, TEXT_EDITOR_HEIGHT,
Justification::centredRight, false);
g.drawText(TRANS("AUTHOR"),
0, 2 * PADDING_Y + TEXT_EDITOR_HEIGHT, DIVISION - 10, TEXT_EDITOR_HEIGHT,
Justification::centredRight, false);
g.drawText(TRANS("FOLDER"),
0, 3 * PADDING_Y + 2 * TEXT_EDITOR_HEIGHT, DIVISION - 10, TEXT_EDITOR_HEIGHT,
Justification::centredRight, false);
g.restoreState();
}
示例3: paint
void DeleteSection::paint(Graphics& g) {
static const DropShadow shadow(Colour(0xff000000), 5, Point<int>(0, 0));
g.setColour(Colour(0xbb212121));
g.fillAll();
Rectangle<int> delete_rect = getDeleteRect();
shadow.drawForRectangle(g, delete_rect);
g.setColour(Colour(0xff303030));
g.fillRect(delete_rect);
g.saveState();
g.setOrigin(delete_rect.getX() + PADDING_X, delete_rect.getY() + PADDING_Y);
g.setFont(Fonts::instance()->proportional_light().withPointHeight(14.0f));
g.setColour(Colour(0xffaaaaaa));
String text;
if (file_.isDirectory())
text = TRANS("Are you sure you want to delte this folder?");
else
text = TRANS("Are you sure you want to delte this patch?");
g.drawText(text,
0, 0.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f,
Justification::centred, false);
g.setFont(Fonts::instance()->monospace().withPointHeight(16.0f));
g.setColour(Colour(0xff03a9f4));
g.drawText(file_.getFileNameWithoutExtension(),
0, 20.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f,
Justification::centred, false);
g.restoreState();
}
示例4: drawRectangularShadow
void SynthSlider::drawRectangularShadow(Graphics &g) {
static const DropShadow shadow(Colour(0xbb000000), 2, Point<int>(0, 0));
g.saveState();
g.setOrigin(getX(), getY());
shadow.drawForRectangle(g, getLocalBounds());
g.restoreState();
}
示例5: paintBackground
void OscillatorSection::paintBackground(Graphics& g) {
static const float extra_knob_padding = 4.0f;
static const DropShadow component_shadow(Colour(0x99000000), 3, Point<int>(0, 1));
SynthSection::paintBackground(g);
g.setColour(Colour(0xff212121));
g.fillEllipse(transpose_1_->getBounds().toFloat().expanded(extra_knob_padding));
g.fillEllipse(tune_1_->getBounds().toFloat().expanded(extra_knob_padding));
g.fillEllipse(transpose_2_->getBounds().toFloat().expanded(extra_knob_padding));
g.fillEllipse(tune_2_->getBounds().toFloat().expanded(extra_knob_padding));
g.setColour(Colour(0xff303030));
g.fillRect(0, tune_1_->getBottom() + 2, getWidth(), 5);
g.setColour(Colour(0xff4fc3f7));
g.strokePath(top_left_cross_path_, PathStrokeType(1.0f));
g.setColour(Colour(0xff4fc3f7));
g.strokePath(top_right_cross_path_, PathStrokeType(1.0f));
g.setColour(Colour(0xff4fc3f7));
g.strokePath(bottom_left_cross_path_, PathStrokeType(1.0f));
g.setColour(Colour(0xff4fc3f7));
g.strokePath(bottom_right_cross_path_, PathStrokeType(1.0f));
g.setColour(Colour(0xffbbbbbb));
g.setFont(Fonts::getInstance()->proportional_regular().withPointHeight(10.0f));
drawTextForComponent(g, TRANS("MOD"), cross_modulation_);
drawTextForComponent(g, TRANS("TRANS"), transpose_1_);
drawTextForComponent(g, TRANS("TRANS"), transpose_2_);
drawTextForComponent(g, TRANS("TUNE"), tune_1_);
drawTextForComponent(g, TRANS("TUNE"), tune_2_);
drawTextForComponent(g, TRANS("UNISON"), unison_detune_1_);
drawTextForComponent(g, TRANS("UNISON"), unison_detune_2_);
component_shadow.drawForRectangle(g, wave_viewer_1_->getBounds());
component_shadow.drawForRectangle(g, wave_viewer_2_->getBounds());
g.setColour(Colour(0xff424242));
paintKnobShadows(g);
}
示例6: paintBackground
void GraphicalStepSequencer::paintBackground(Graphics& g) {
static const DropShadow shadow(Colour(0xbb000000), 1, Point<int>(0, 0));
if (sequence_.size() == 0 || num_steps_slider_ == nullptr)
return;
g.fillAll(Colour(0xff424242));
float x_inc = getWidth() / (1.0f * num_steps_);
g.setColour(Colour(0xff545454));
for (int i = 1; i * x_inc < getWidth(); ++i)
g.drawLine(i * x_inc, 0, i * x_inc, getHeight());
// Draw shadows.
float x = 0.0f;
for (int i = 0; i < num_steps_; ++i) {
float val = sequence_[i]->getValue();
float bar_position = (getHeight() - 1.0f) * ((1.0f - val) / 2.0f);
Rectangle<int> rect(x, bar_position, x_inc, 1.5f);
shadow.drawForRectangle(g, rect);
x += x_inc;
}
// Draw bars.
x = 0.0f;
for (int i = 0; i < num_steps_; ++i) {
float val = sequence_[i]->getValue();
float bar_position = (getHeight() - 1.0f) * ((1.0f - val) / 2.0f);
if (val >= 0) {
g.setColour(Colour(0xff565656));
g.fillRect(x, bar_position, x_inc, proportionOfHeight(0.5f) - bar_position);
}
else {
float half_height = proportionOfHeight(0.5f);
g.setColour(Colour(0xff565656));
g.fillRect(x, half_height, x_inc, bar_position - half_height);
}
g.setColour(Colour(0xff03a9f4));
g.fillRect(x, bar_position, x_inc, 1.5f);
x += x_inc;
}
}
示例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); }
}
示例8: paint
void DeleteSection::paint(Graphics& g) {
static Font patch_font(Typeface::createSystemTypefaceFor(BinaryData::DroidSansMono_ttf,
BinaryData::DroidSansMono_ttfSize));
static Font roboto_light(Typeface::createSystemTypefaceFor(BinaryData::RobotoLight_ttf,
BinaryData::RobotoLight_ttfSize));
static const DropShadow shadow(Colour(0xff000000), 5, Point<int>(0, 0));
g.setColour(Colour(0xbb212121));
g.fillAll();
Rectangle<int> delete_rect = getDeleteRect();
shadow.drawForRectangle(g, delete_rect);
g.setColour(Colour(0xff303030));
g.fillRect(delete_rect);
g.saveState();
g.setOrigin(delete_rect.getX() + PADDING_X, delete_rect.getY() + PADDING_Y);
g.setFont(roboto_light.withPointHeight(14.0f));
g.setColour(Colour(0xffaaaaaa));
String text;
if (file_.isDirectory())
text = TRANS("Are you sure you want to delte this folder?");
else
text = TRANS("Are you sure you want to delte this patch?");
g.drawText(text,
0, 0.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f,
Justification::centred, false);
g.setFont(patch_font.withPointHeight(16.0f));
g.setColour(Colour(0xff03a9f4));
g.drawText(file_.getFileNameWithoutExtension(),
0, 20.0f, delete_rect.getWidth() - 2 * PADDING_X, 22.0f,
Justification::centred, false);
g.restoreState();
}
示例9: paintBackground
void FullInterface::paintBackground(Graphics& g) {
static const DropShadow shadow(Colour(0xcc000000), 3, Point<int>(0, 1));
static const DropShadow logo_shadow(Colour(0xff000000), 8, Point<int>(0, 0));
static const DropShadow component_shadow(Colour(0xcc000000), 5, Point<int>(0, 1));
static Font roboto_reg(Typeface::createSystemTypefaceFor(BinaryData::RobotoRegular_ttf,
BinaryData::RobotoRegular_ttfSize));
static Font roboto_light(Typeface::createSystemTypefaceFor(BinaryData::RobotoLight_ttf,
BinaryData::RobotoLight_ttfSize));
static const Image helm_small = ImageCache::getFromMemory(BinaryData::helm_icon_32_2x_png,
BinaryData::helm_icon_32_2x_pngSize);
g.setColour(Colour(0xff212121));
g.fillRect(getLocalBounds());
shadow.drawForRectangle(g, arp_section_->getBounds());
shadow.drawForRectangle(g, global_tool_tip_->getBounds());
shadow.drawForRectangle(g, oscilloscope_->getBounds());
shadow.drawForRectangle(g, Rectangle<int>(92, 8, 244, TOP_HEIGHT));
shadow.drawForRectangle(g, Rectangle<int>(16, 8, 68, 64));
g.setColour(Colour(0xff303030));
g.fillRoundedRectangle(16.0f, 8.0f, 68.0f, 64.0f, 3.0f);
g.saveState();
g.setOrigin(18, 8);
logo_shadow.drawForImage(g, helm_small);
g.restoreState();
g.setColour(Colour(0xff303030));
g.fillRect(92, 8, 244, TOP_HEIGHT);
g.setColour(Colour(0xffbbbbbb));
g.setFont(roboto_reg.withPointHeight(10.0f));
g.drawText(TRANS("BPM"), patch_selector_->getX(), beats_per_minute_->getY(),
44, beats_per_minute_->getHeight(),
Justification::centred, false);
component_shadow.drawForRectangle(g, patch_selector_->getBounds());
paintKnobShadows(g);
}
示例10: paint
void AboutSection::paint(Graphics& g) {
static const DropShadow shadow(Colour(0xff000000), 5, Point<int>(0, 0));
g.setColour(Colour(0xbb212121));
g.fillAll();
Rectangle<int> info_rect = getInfoRect();
shadow.drawForRectangle(g, info_rect);
g.setColour(Colour(0xff303030));
g.fillRect(info_rect);
g.saveState();
g.setOrigin(info_rect.getX() + PADDING_X, info_rect.getY() + PADDING_Y);
Image helm_small = ImageCache::getFromMemory(BinaryData::helm_icon_128_1x_png,
BinaryData::helm_icon_128_1x_pngSize);
shadow.drawForImage(g, helm_small);
const Desktop::Displays::Display& display = Desktop::getInstance().getDisplays().getMainDisplay();
if (display.scale > 1.5) {
Image helm = ImageCache::getFromMemory(BinaryData::helm_icon_128_2x_png,
BinaryData::helm_icon_128_2x_pngSize);
g.drawImage(helm, 0, 0, 128, 128, 0, 0, 256, 256);
}
else
g.drawImage(helm_small, 0, 0, 128, 128, 0, 0, 128, 128);
g.setFont(Fonts::getInstance()->proportional_regular().withPointHeight(32.0));
g.setColour(Colour(0xff2196f3));
g.drawText(TRANS("HELM"),
0.0f, 0.0f,
info_rect.getWidth() - 2 * PADDING_X, 32.0f, Justification::centredTop);
g.setFont(Fonts::getInstance()->proportional_light().withPointHeight(12.0));
g.setColour(Colour(0xff666666));
g.drawText(TRANS("v") + " " + ProjectInfo::versionString,
0.0f, 36.0f,
info_rect.getWidth() - 2 * PADDING_X, 32.0f, Justification::centredTop);
g.setFont(Fonts::getInstance()->proportional_light().withPointHeight(12.0));
g.drawText(TRANS("Developed by"),
0.0f, 4.0f,
info_rect.getWidth() - 2 * PADDING_X, 20.0f, Justification::right);
g.setColour(Colour(0xffaaaaaa));
g.drawText(TRANS("Helm is free software and"),
0.0f, 62.0,
info_rect.getWidth() - 2 * PADDING_X, 20.0f, Justification::topRight);
g.drawText(TRANS("comes with no warranty"),
0.0f, 76.0f,
info_rect.getWidth() - 2 * PADDING_X, 20.0f, Justification::topRight);
g.setFont(Fonts::getInstance()->proportional_light().withPointHeight(12.0));
g.drawText(TRANS("Check for updates"),
0.0f, 141.0f,
info_rect.getWidth() - 2 * PADDING_X - 1.5 * BUTTON_WIDTH,
20.0f, Justification::topRight);
g.drawText(TRANS("Animate graphics"),
0.0f, 141.0f,
273.0f - PADDING_X - 0.5 * BUTTON_WIDTH,
20.0f, Justification::topRight);
g.restoreState();
}