From 5cca734e54093c19e3d2eb4686ade4a60ec362c9 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sat, 10 Jul 2021 10:58:50 -0400 Subject: [PATCH] Add more graphics from Pyer. Implement new rail graphics in RackRail. --- include/app/RackRail.hpp | 1 + res/ComponentLibrary/ADAT.svg | 408 +-------- res/ComponentLibrary/MIDI_DIN.svg | 449 ++-------- res/ComponentLibrary/PB61303.svg | 109 +-- res/ComponentLibrary/RackBusboard.svg | 1121 +++++++++++-------------- res/ComponentLibrary/RackRails.svg | 39 + res/ComponentLibrary/ScrewBlack.svg | 118 +-- res/ComponentLibrary/ScrewSilver.svg | 68 +- res/ComponentLibrary/USB-B.svg | 434 ++-------- src/app/RackRail.cpp | 63 +- 10 files changed, 812 insertions(+), 1998 deletions(-) create mode 100644 res/ComponentLibrary/RackRails.svg diff --git a/include/app/RackRail.hpp b/include/app/RackRail.hpp index 6c62e75e..f8e0a1e4 100644 --- a/include/app/RackRail.hpp +++ b/include/app/RackRail.hpp @@ -9,6 +9,7 @@ namespace app { struct RackRail : widget::TransparentWidget { std::shared_ptr busBoardSvg; + std::shared_ptr railsSvg; RackRail(); void draw(const DrawArgs& args) override; diff --git a/res/ComponentLibrary/ADAT.svg b/res/ComponentLibrary/ADAT.svg index 5be20bcc..08ce9828 100644 --- a/res/ComponentLibrary/ADAT.svg +++ b/res/ComponentLibrary/ADAT.svg @@ -1,366 +1,42 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/MIDI_DIN.svg b/res/ComponentLibrary/MIDI_DIN.svg index 58ca88f3..0734d302 100644 --- a/res/ComponentLibrary/MIDI_DIN.svg +++ b/res/ComponentLibrary/MIDI_DIN.svg @@ -1,397 +1,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/PB61303.svg b/res/ComponentLibrary/PB61303.svg index e1efe7df..4721dccd 100644 --- a/res/ComponentLibrary/PB61303.svg +++ b/res/ComponentLibrary/PB61303.svg @@ -1,66 +1,43 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/RackBusboard.svg b/res/ComponentLibrary/RackBusboard.svg index 7d045a9b..1bed970b 100644 --- a/res/ComponentLibrary/RackBusboard.svg +++ b/res/ComponentLibrary/RackBusboard.svg @@ -1,620 +1,501 @@ - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/RackRails.svg b/res/ComponentLibrary/RackRails.svg new file mode 100644 index 00000000..c453e41f --- /dev/null +++ b/res/ComponentLibrary/RackRails.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/ScrewBlack.svg b/res/ComponentLibrary/ScrewBlack.svg index 7c590647..9247f761 100644 --- a/res/ComponentLibrary/ScrewBlack.svg +++ b/res/ComponentLibrary/ScrewBlack.svg @@ -1,82 +1,36 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/ComponentLibrary/ScrewSilver.svg b/res/ComponentLibrary/ScrewSilver.svg index f17f4ecd..6ef622c5 100644 --- a/res/ComponentLibrary/ScrewSilver.svg +++ b/res/ComponentLibrary/ScrewSilver.svg @@ -6,62 +6,28 @@ viewBox="0 0 15 14.9989" enable-background="new 0 0 15 14.9989" xml:space="preserve"> - + - - - - + + + + - - - - - + + + + - - + - - - - - - - - - - - + diff --git a/res/ComponentLibrary/USB-B.svg b/res/ComponentLibrary/USB-B.svg index bed8222e..5f533cb9 100644 --- a/res/ComponentLibrary/USB-B.svg +++ b/res/ComponentLibrary/USB-B.svg @@ -1,376 +1,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/RackRail.cpp b/src/app/RackRail.cpp index 35aaec84..74b7d6f8 100644 --- a/src/app/RackRail.cpp +++ b/src/app/RackRail.cpp @@ -10,12 +10,11 @@ namespace app { RackRail::RackRail() { busBoardSvg = Svg::load(asset::system("res/ComponentLibrary/RackBusboard.svg")); + railsSvg = Svg::load(asset::system("res/ComponentLibrary/RackRails.svg")); } void RackRail::draw(const DrawArgs& args) { - const float railHeight = 15; - // Background color nvgBeginPath(args.vg); nvgRect(args.vg, 0.0, 0.0, box.size.x, box.size.y); @@ -23,43 +22,21 @@ void RackRail::draw(const DrawArgs& args) { nvgFill(args.vg); // Rails - float holeRadius = 4.0; for (float y = 0; y < box.size.y; y += RACK_GRID_HEIGHT) { - nvgFillColor(args.vg, nvgRGB(0xc9, 0xc9, 0xc9)); - nvgStrokeWidth(args.vg, 1.0); - nvgStrokeColor(args.vg, nvgRGB(0x9d, 0x9f, 0xa2)); - // Top rail - nvgBeginPath(args.vg); - nvgRect(args.vg, 0, y, box.size.x, railHeight); - for (float x = 0; x < box.size.x; x += RACK_GRID_WIDTH) { - nvgCircle(args.vg, x + RACK_GRID_WIDTH / 2, y + railHeight / 2, holeRadius); - nvgPathWinding(args.vg, NVG_HOLE); - } - nvgFill(args.vg); - - nvgBeginPath(args.vg); - nvgMoveTo(args.vg, 0, y + railHeight - 0.5); - nvgLineTo(args.vg, box.size.x, y + railHeight - 0.5); - nvgStroke(args.vg); + const float busBoardWidth = busBoardSvg->handle->width; + const float busBoardHeight = busBoardSvg->handle->height; + const float busBoardY = y + (RACK_GRID_HEIGHT - busBoardHeight) / 2; + const NVGcolor shadowColor = nvgRGBA(0, 0, 0, 0x20); - // Bottom rail + // Bus board shadow nvgBeginPath(args.vg); - nvgRect(args.vg, 0, y + RACK_GRID_HEIGHT - railHeight, box.size.x, railHeight); - for (float x = 0; x < box.size.x; x += RACK_GRID_WIDTH) { - nvgCircle(args.vg, x + RACK_GRID_WIDTH / 2, y + RACK_GRID_HEIGHT - railHeight + railHeight / 2, holeRadius); - nvgPathWinding(args.vg, NVG_HOLE); - } + const float busBoardShadowY = busBoardY + busBoardHeight; + const float busBoardShadowHeight = 10; + nvgRect(args.vg, 0, busBoardShadowY, box.size.x, busBoardShadowHeight); + nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, busBoardShadowY, 0, busBoardShadowY + busBoardShadowHeight, shadowColor, color::BLACK_TRANSPARENT)); nvgFill(args.vg); - nvgBeginPath(args.vg); - nvgMoveTo(args.vg, 0, y + RACK_GRID_HEIGHT - 0.5); - nvgLineTo(args.vg, box.size.x, y + RACK_GRID_HEIGHT - 0.5); - nvgStroke(args.vg); - // Bus board - const float busBoardWidth = busBoardSvg->handle->width; - const float busBoardHeight = busBoardSvg->handle->height; - const float busBoardY = y + (RACK_GRID_HEIGHT - busBoardHeight) / 2; for (float x = 0; x < box.size.x; x += busBoardWidth) { nvgSave(args.vg); nvgTranslate(args.vg, x, busBoardY); @@ -67,15 +44,21 @@ void RackRail::draw(const DrawArgs& args) { nvgRestore(args.vg); } - // Bus board shadow + // Rails shadow nvgBeginPath(args.vg); - const float shadowY = busBoardY + busBoardHeight; - const float shadowHeight = 10; - nvgRect(args.vg, 0, shadowY, box.size.x, shadowHeight); - NVGcolor shadowColor = nvgRGBA(0, 0, 0, 0x20); - NVGcolor transparentColor = nvgRGBAf(0, 0, 0, 0); - nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, shadowY, 0, shadowY + shadowHeight, shadowColor, transparentColor)); + const float railsShadowY = y + 15; + const float railsShadowHeight = 10; + nvgRect(args.vg, 0, railsShadowY, box.size.x, railsShadowHeight); + nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, railsShadowY, 0, railsShadowY + railsShadowHeight, shadowColor, color::BLACK_TRANSPARENT)); nvgFill(args.vg); + + // Rails + for (float x = 0; x < box.size.x; x += RACK_GRID_WIDTH) { + nvgSave(args.vg); + nvgTranslate(args.vg, x, y ); + svgDraw(args.vg, railsSvg->handle); + nvgRestore(args.vg); + } } }