Skip to content

Commit

Permalink
Merge pull request #281 from StoneyDSP/preview
Browse files Browse the repository at this point in the history
module/HP1-HP2-HP4
  • Loading branch information
nathanjhood authored Dec 23, 2024
2 parents ce674aa + 158f7a5 commit fad3036
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 3 deletions.
4 changes: 4 additions & 0 deletions include/StoneyVCV/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ namespace Panels {
extern ::NVGcolor bgBlack;
extern ::NVGcolor bgWhite;
extern ::NVGcolor borderColor;
extern ::NVGcolor bgGradientBlackS0;
extern ::NVGcolor bgGradientBlackS1;
extern ::NVGcolor bgGradientWhiteS0;
extern ::NVGcolor bgGradientWhiteS1;
extern ::StoneyDSP::float_t MIN_WIDTH;
extern ::StoneyDSP::float_t MIN_HEIGHT;

Expand Down
23 changes: 22 additions & 1 deletion src/StoneyVCV/HP1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ void ::StoneyDSP::StoneyVCV::HP1::HP1Widget::draw(const ::StoneyDSP::StoneyVCV::
const auto& bgBlack = ::StoneyDSP::StoneyVCV::Panels::bgBlack;
const auto& bgWhite = ::StoneyDSP::StoneyVCV::Panels::bgWhite;
const auto& bgColor = ::rack::settings::preferDarkPanels ? bgBlack : bgWhite;
const auto& bgGradientS0 = ::rack::settings::preferDarkPanels ? ::StoneyDSP::StoneyVCV::Panels::bgGradientBlackS0 : ::StoneyDSP::StoneyVCV::Panels::bgGradientWhiteS0;
const auto& bgGradientS1 = ::rack::settings::preferDarkPanels ? ::StoneyDSP::StoneyVCV::Panels::bgGradientBlackS1 : ::StoneyDSP::StoneyVCV::Panels::bgGradientWhiteS1;
const auto& borderColor = ::StoneyDSP::StoneyVCV::Panels::borderColor;
const auto& minWidth = ::StoneyDSP::StoneyVCV::Panels::MIN_WIDTH;
const auto& minHeight = ::StoneyDSP::StoneyVCV::Panels::MIN_HEIGHT;
const auto& size = this->getSize();

// draw Themed BG
// Draw Themed BG
::nvgBeginPath(args.vg);
::nvgRect(args.vg,
/** x */0.0F,
Expand All @@ -148,6 +150,25 @@ void ::StoneyDSP::StoneyVCV::HP1::HP1Widget::draw(const ::StoneyDSP::StoneyVCV::
::nvgFillColor(args.vg, bgColor);
::nvgFill(args.vg);

// Draw themed BG gradient
const auto& bgGradient = ::nvgLinearGradient(args.vg,
size.x * 0.5,
0.0F,
size.x * 0.5,
380.0F,
bgGradientS0,
bgGradientS1
);
::nvgBeginPath(args.vg);
::nvgRect(args.vg,
/** x */0.0F,
/** y */0.0F,
/** w */size.x,
/** h */size.y
);
::nvgFillPaint(args.vg, bgGradient);
::nvgFill(args.vg);

// Draw line
::nvgBeginPath(args.vg);
::nvgMoveTo(args.vg,
Expand Down
23 changes: 22 additions & 1 deletion src/StoneyVCV/HP2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,14 @@ void ::StoneyDSP::StoneyVCV::HP2::HP2Widget::draw(const ::StoneyDSP::StoneyVCV::
const auto& bgBlack = ::StoneyDSP::StoneyVCV::Panels::bgBlack;
const auto& bgWhite = ::StoneyDSP::StoneyVCV::Panels::bgWhite;
const auto& bgColor = ::rack::settings::preferDarkPanels ? bgBlack : bgWhite;
const auto& bgGradientS0 = ::rack::settings::preferDarkPanels ? ::StoneyDSP::StoneyVCV::Panels::bgGradientBlackS0 : ::StoneyDSP::StoneyVCV::Panels::bgGradientWhiteS0;
const auto& bgGradientS1 = ::rack::settings::preferDarkPanels ? ::StoneyDSP::StoneyVCV::Panels::bgGradientBlackS1 : ::StoneyDSP::StoneyVCV::Panels::bgGradientWhiteS1;
const auto& borderColor = ::StoneyDSP::StoneyVCV::Panels::borderColor;
const auto& minWidth = ::StoneyDSP::StoneyVCV::Panels::MIN_WIDTH;
const auto& minHeight = ::StoneyDSP::StoneyVCV::Panels::MIN_HEIGHT;
const auto& size = this->getSize();

// draw Themed BG
// Draw Themed BG
::nvgBeginPath(args.vg);
::nvgRect(args.vg,
/** x */0.0F,
Expand All @@ -150,6 +152,25 @@ void ::StoneyDSP::StoneyVCV::HP2::HP2Widget::draw(const ::StoneyDSP::StoneyVCV::
::nvgFillColor(args.vg, bgColor);
::nvgFill(args.vg);

// Draw themed BG gradient
const auto& bgGradient = ::nvgLinearGradient(args.vg,
size.x * 0.5,
0.0F,
size.x * 0.5,
380.0F,
bgGradientS0,
bgGradientS1
);
::nvgBeginPath(args.vg);
::nvgRect(args.vg,
/** x */0.0F,
/** y */0.0F,
/** w */size.x,
/** h */size.y
);
::nvgFillPaint(args.vg, bgGradient);
::nvgFill(args.vg);

// Draw line L
::nvgBeginPath(args.vg);
::nvgMoveTo(args.vg,
Expand Down
23 changes: 22 additions & 1 deletion src/StoneyVCV/HP4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ void ::StoneyDSP::StoneyVCV::HP4::HP4Widget::draw(const ::StoneyDSP::StoneyVCV::
const auto& bgBlack = ::StoneyDSP::StoneyVCV::Panels::bgBlack;
const auto& bgWhite = ::StoneyDSP::StoneyVCV::Panels::bgWhite;
const auto& bgColor = ::rack::settings::preferDarkPanels ? bgBlack : bgWhite;
const auto& bgGradientS0 = ::rack::settings::preferDarkPanels ? ::StoneyDSP::StoneyVCV::Panels::bgGradientBlackS0 : ::StoneyDSP::StoneyVCV::Panels::bgGradientWhiteS0;
const auto& bgGradientS1 = ::rack::settings::preferDarkPanels ? ::StoneyDSP::StoneyVCV::Panels::bgGradientBlackS1 : ::StoneyDSP::StoneyVCV::Panels::bgGradientWhiteS1;
const auto& borderColor = ::StoneyDSP::StoneyVCV::Panels::borderColor;
const auto& minWidth = ::StoneyDSP::StoneyVCV::Panels::MIN_WIDTH;
const auto& minHeight = ::StoneyDSP::StoneyVCV::Panels::MIN_HEIGHT;
const auto& size = this->getSize();

// draw Themed BG
// Draw Themed BG
::nvgBeginPath(args.vg);
::nvgRect(args.vg,
/** x */0.0F,
Expand All @@ -148,6 +150,25 @@ void ::StoneyDSP::StoneyVCV::HP4::HP4Widget::draw(const ::StoneyDSP::StoneyVCV::
::nvgFillColor(args.vg, bgColor);
::nvgFill(args.vg);

// Draw themed BG gradient
const auto& bgGradient = ::nvgLinearGradient(args.vg,
size.x * 0.5,
0.0F,
size.x * 0.5,
380.0F,
bgGradientS0,
bgGradientS1
);
::nvgBeginPath(args.vg);
::nvgRect(args.vg,
/** x */0.0F,
/** y */0.0F,
/** w */size.x,
/** h */size.y
);
::nvgFillPaint(args.vg, bgGradient);
::nvgFill(args.vg);

// Draw line L
::nvgBeginPath(args.vg);
::nvgMoveTo(args.vg,
Expand Down
4 changes: 4 additions & 0 deletions src/StoneyVCV/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ namespace Panels {
::NVGcolor bgBlack = ::nvgRGBA(43, 43, 43, 255);
::NVGcolor bgWhite = ::nvgRGBA(235, 235, 235, 255);
::NVGcolor borderColor = nvgRGBAf(0.5F, 0.5F, 0.5F, 0.5F);
::NVGcolor bgGradientBlackS0 = ::nvgRGB(42, 42, 43);
::NVGcolor bgGradientBlackS1 = ::nvgRGB(23, 23, 23);
::NVGcolor bgGradientWhiteS0 = ::nvgRGB(235, 235, 235);
::NVGcolor bgGradientWhiteS1 = ::nvgRGB(225, 225, 225);
::StoneyDSP::float_t MIN_WIDTH = ::rack::window::mm2px(5.079999999F);
::StoneyDSP::float_t MIN_HEIGHT = ::rack::window::mm2px(128.693333312F);

Expand Down

0 comments on commit fad3036

Please sign in to comment.