Vital
Loading...
Searching...
No Matches
paths.h
Go to the documentation of this file.
1#pragma once
2
3#include "JuceHeader.h"
4#include "synth_constants.h"
5
14class Paths {
15 public:
17 static constexpr int kLogoWidth = 1701;
18
22 Paths() = delete;
23
30 static Path fromSvgData(const void* data, size_t data_size) {
31 std::unique_ptr<Drawable> drawable(Drawable::createFromImageData(data, data_size));
32 return drawable->getOutlineAsPath();
33 }
34
39 static Path vitalRing() {
40 Path path = fromSvgData((const void*)BinaryData::vital_ring_svg, BinaryData::vital_ring_svgSize);
41 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
42 path.addLineSegment(Line<float>(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f);
43 return path;
44 }
45
50 static Path vitalV() {
51 Path path = fromSvgData((const void*)BinaryData::vital_v_svg, BinaryData::vital_ring_svgSize);
52 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
53 path.addLineSegment(Line<float>(kLogoWidth, kLogoWidth, kLogoWidth, kLogoWidth), 0.2f);
54 return path;
55 }
56
61 static Path vitalWord() {
62 return fromSvgData((const void*)BinaryData::vital_word_svg, BinaryData::vital_word_svgSize);
63 }
64
69 static Path vitalWordRing() {
70 return fromSvgData((const void*)BinaryData::vital_word_ring_svg, BinaryData::vital_word_ring_svgSize);
71 }
72
77 static Path chorus() {
78 return fromSvgData((const void*)BinaryData::chorus_svg, BinaryData::chorus_svgSize);
79 }
80
85 static Path compressor() {
86 return fromSvgData((const void*)BinaryData::compressor_svg, BinaryData::compressor_svgSize);
87 }
88
93 static Path delay() {
94 return fromSvgData((const void*)BinaryData::delay_svg, BinaryData::delay_svgSize);
95 }
96
101 static Path distortion() {
102 return fromSvgData((const void*)BinaryData::distortion_svg, BinaryData::distortion_svgSize);
103 }
104
109 static Path equalizer() {
110 return fromSvgData((const void*)BinaryData::equalizer_svg, BinaryData::equalizer_svgSize);
111 }
112
117 static Path effectsFilter() {
118 return fromSvgData((const void*)BinaryData::effects_filter_svg, BinaryData::effects_filter_svgSize);
119 }
120
125 static Path flanger() {
126 return fromSvgData((const void*)BinaryData::flanger_svg, BinaryData::flanger_svgSize);
127 }
128
133 static Path folder() {
134 return fromSvgData((const void*)BinaryData::folder_svg, BinaryData::folder_svgSize);
135 }
136
141 static Path phaser() {
142 return fromSvgData((const void*)BinaryData::phaser_svg, BinaryData::phaser_svgSize);
143 }
144
149 static Path reverb() {
150 return fromSvgData((const void*)BinaryData::reverb_svg, BinaryData::reverb_svgSize);
151 }
152
157 static Path prev() {
158 static const PathStrokeType arrow_stroke(0.1f, PathStrokeType::JointStyle::curved,
159 PathStrokeType::EndCapStyle::rounded);
160
161 Path prev_line, prev_shape;
162 prev_line.startNewSubPath(0.65f, 0.3f);
163 prev_line.lineTo(0.35f, 0.5f);
164 prev_line.lineTo(0.65f, 0.7f);
165
166 arrow_stroke.createStrokedPath(prev_shape, prev_line);
167 prev_shape.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
168 prev_shape.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
169 return prev_shape;
170 }
171
176 static Path next() {
177 static const PathStrokeType arrow_stroke(0.1f, PathStrokeType::JointStyle::curved,
178 PathStrokeType::EndCapStyle::rounded);
179
180 Path next_line, next_shape;
181 next_line.startNewSubPath(0.35f, 0.3f);
182 next_line.lineTo(0.65f, 0.5f);
183 next_line.lineTo(0.35f, 0.7f);
184
185 arrow_stroke.createStrokedPath(next_shape, next_line);
186 next_shape.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
187 next_shape.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
188 return next_shape;
189 }
190
195 static Path clock() {
196 static const float kClockAngle = 1.0f;
197 static const float kClockWidth = 0.4f;
198 static const float kBuffer = (1.0f - kClockWidth) / 2.0f;
199
200 Path path;
201 path.addPieSegment(kBuffer, kBuffer, kClockWidth, kClockWidth, 0.0f, kClockAngle - 2.0f * vital::kPi, 0.0f);
202 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
203 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
204 return path;
205 }
206
211 static Path dragDropArrows() {
212 return fromSvgData((const void*)BinaryData::drag_drop_arrows_svg, BinaryData::drag_drop_arrows_svgSize);
213 }
214
219 static Path note() {
220 static constexpr float kLeftAdjustment = 1.0f / 32.0f;
221 static constexpr float kNoteWidth = 1.0f / 4.0f;
222 static constexpr float kNoteHeight = 1.0f / 5.0f;
223 static constexpr float kBarHeight = 2.0f / 5.0f;
224 static constexpr float kBarWidth = 1.0f / 20.0f;
225 static constexpr float kY = 1.0f - (1.0f - kBarHeight + kNoteHeight / 2.0f) / 2.0f;
226 static constexpr float kX = (1.0f - kNoteWidth) / 2.0f - kLeftAdjustment;
227
228 Path path;
229 path.addEllipse(kX, kY - kNoteHeight / 2.0f, kNoteWidth, kNoteHeight);
230 path.addRectangle(kX + kNoteWidth - kBarWidth, kY - kBarHeight, kBarWidth, kBarHeight);
231 path.closeSubPath();
232
233 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
234 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
235 return path;
236 }
237
242 static Path tripletNotes() {
243 static constexpr float kNoteWidth = 1.0f / 5.0f;
244 static constexpr float kNoteHeight = 1.0f / 6.0f;
245 static constexpr float kX = (1.0f - 3.0f * kNoteWidth) / 2.0f;
246 static constexpr float kBarWidth = 1.0f / 20.0f;
247 static constexpr float kBarHeight = 1.0f / 4.0f;
248 static constexpr float kY = 1.0f - (1.0f - kBarHeight) / 2.0f;
249
250 Path path;
251 path.addRectangle(kX + kNoteWidth - kBarWidth, kY - kBarHeight - kBarWidth,
252 2.0f * kNoteWidth + kBarWidth, kBarWidth);
253
254 path.addEllipse(kX, kY - kNoteHeight / 2.0f, kNoteWidth, kNoteHeight);
255 path.addRectangle(kX + kNoteWidth - kBarWidth, kY - kBarHeight, kBarWidth, kBarHeight);
256 path.addEllipse(kX + kNoteWidth, kY - kNoteHeight / 2.0f, kNoteWidth, kNoteHeight);
257 path.addRectangle(kX + kNoteWidth - kBarWidth + kNoteWidth, kY - kBarHeight, kBarWidth, kBarHeight);
258 path.addEllipse(kX + 2.0f * kNoteWidth, kY - kNoteHeight / 2.0f, kNoteWidth, kNoteHeight);
259 path.addRectangle(kX + kNoteWidth - kBarWidth + 2.0f * kNoteWidth, kY - kBarHeight, kBarWidth, kBarHeight);
260 path.closeSubPath();
261
262 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
263 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
264 return path;
265 }
266
271 static Path menu() {
272 Path path;
273 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
274 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
275 path.addLineSegment(Line<float>(0.2f, 0.3f, 0.8f, 0.3f), 0.05f);
276 path.addLineSegment(Line<float>(0.2f, 0.5f, 0.8f, 0.5f), 0.05f);
277 path.addLineSegment(Line<float>(0.2f, 0.7f, 0.8f, 0.7f), 0.05f);
278 return path;
279 }
280
286 static Path menu(int width) {
287 static constexpr float kBuffer = 0.2f;
288 static constexpr float kLineWidth = 0.04f;
289 static constexpr float kSpacing = 0.2f;
290
291 int buffer = std::round(width * kBuffer);
292 int line_width = std::max<int>(1, width * kLineWidth);
293 int spacing = width * kSpacing;
294
295 float center = (line_width % 2) * 0.5f + (width / 2);
296 Path path;
297 path.addLineSegment(Line<float>(buffer, center - spacing, width - buffer, center - spacing), line_width);
298 path.addLineSegment(Line<float>(buffer, center, width - buffer, center), line_width);
299 path.addLineSegment(Line<float>(buffer, center + spacing, width - buffer, center + spacing), line_width);
300 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
301 path.addLineSegment(Line<float>(width, width, width, width), 0.2f);
302 return path;
303 }
304
305 static Path plus(int width) {
306 static constexpr float kBuffer = 0.35f;
307 static constexpr float kLineWidth = 0.04f;
308
309 int buffer = std::round(width * kBuffer);
310 int line_width = std::max<int>(1, width * kLineWidth);
311
312 float center = (line_width % 2) * 0.5f + (width / 2);
313 Path path;
314 path.addLineSegment(Line<float>(buffer, center, width - buffer, center), line_width);
315 path.addLineSegment(Line<float>(center, buffer, center, width - buffer), line_width);
316
317 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
318 path.addLineSegment(Line<float>(width, width, width, width), 0.2f);
319 return path;
320 }
321
322 static Path plusOutline() {
323 static constexpr float kBuffer = 0.2f;
324 static constexpr float kLineWidth = 0.15f;
325
326 float start = kBuffer;
327 float end = 1.0f - kBuffer;
328 float close = 0.5f - kLineWidth * 0.5f;
329 float far = 0.5f + kLineWidth * 0.5f;
330
331 Path path;
332 path.startNewSubPath(start, close);
333 path.lineTo(start, far);
334 path.lineTo(close, far);
335 path.lineTo(close, end);
336 path.lineTo(far, end);
337 path.lineTo(far, far);
338 path.lineTo(end, far);
339 path.lineTo(end, close);
340 path.lineTo(far, close);
341 path.lineTo(far, start);
342 path.lineTo(close, start);
343 path.lineTo(close, close);
344 path.lineTo(start, close);
345 path.closeSubPath();
346
347 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
348 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
349 return path;
350 }
351
352 static Path save(int width) {
353 static constexpr float kLineWidth = 0.04f;
354 static constexpr float kSpacingX = 0.3f;
355 static constexpr float kSpacingY = 0.25f;
356 static constexpr float kArrowMovement = 0.14f;
357 static constexpr float kBoxWrap = 0.07f;
358
359 int line_width = std::max<int>(1, width * kLineWidth);
360 int spacing_x = width * kSpacingX;
361 int spacing_y = width * kSpacingY;
362 float movement = width * kArrowMovement / 2.0f;
363 float wrap = width * kBoxWrap;
364
365 float center = (line_width % 2) * 0.5f + (width / 2);
366
367 Path outline;
368 outline.startNewSubPath(center, center - spacing_y);
369 outline.lineTo(center, center + movement);
370
371 outline.startNewSubPath(center - 2 * movement, center - movement);
372 outline.lineTo(center, center + movement);
373 outline.lineTo(center + 2 * movement, center - movement);
374
375 outline.startNewSubPath(center - spacing_x + wrap, center);
376 outline.lineTo(center - spacing_x, center);
377 outline.lineTo(center - spacing_x, center + spacing_y);
378 outline.lineTo(center + spacing_x, center + spacing_y);
379 outline.lineTo(center + spacing_x, center);
380 outline.lineTo(center + spacing_x - wrap, center);
381
382 Path path;
383 PathStrokeType stroke(line_width, PathStrokeType::curved, PathStrokeType::rounded);
384 stroke.createStrokedPath(path, outline);
385 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
386 path.addLineSegment(Line<float>(width, width, width, width), 0.2f);
387 return path;
388 }
389
390 static Path downTriangle() {
391 Path path;
392
393 path.startNewSubPath(0.33f, 0.4f);
394 path.lineTo(0.66f, 0.4f);
395 path.lineTo(0.5f, 0.6f);
396 path.closeSubPath();
397
398 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
399 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
400 return path;
401 }
402
403 static Path upTriangle() {
404 Path path;
405
406 path.startNewSubPath(0.33f, 0.6f);
407 path.lineTo(0.66f, 0.6f);
408 path.lineTo(0.5f, 0.4f);
409 path.closeSubPath();
410
411 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
412 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
413 return path;
414 }
415
416 static Path exitX() {
417 Path outline;
418 outline.startNewSubPath(0.25f, 0.25f);
419 outline.lineTo(0.75f, 0.75f);
420 outline.startNewSubPath(0.25f, 0.75f);
421 outline.lineTo(0.75f, 0.25f);
422
423 Path path;
424 PathStrokeType stroke(0.03f, PathStrokeType::curved, PathStrokeType::rounded);
425 stroke.createStrokedPath(path, outline);
426 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
427 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
428 return path;
429 }
430
431 static Path thickX() {
432 Path outline;
433 outline.startNewSubPath(0.25f, 0.25f);
434 outline.lineTo(0.75f, 0.75f);
435 outline.startNewSubPath(0.25f, 0.75f);
436 outline.lineTo(0.75f, 0.25f);
437
438 Path path;
439 PathStrokeType stroke(0.1f, PathStrokeType::curved, PathStrokeType::butt);
440 stroke.createStrokedPath(path, outline);
441 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
442 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
443 return path;
444 }
445
446 static Path star() {
447 Path path;
448 path.addStar(Point<float>(0.5f, 0.5f), 5, 0.2f, 0.4f);
449 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
450 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
451 return path;
452 }
453
454 static Path keyboard() {
455 Path path;
456 path.addLineSegment(Line<float>(0.2f, 0.2f, 0.2f, 0.2f), 0.01f);
457 path.addLineSegment(Line<float>(0.8f, 0.8f, 0.8f, 0.8f), 0.01f);
458
459 path.startNewSubPath(0.24f, 0.35f);
460 path.lineTo(0.24f, 0.65f);
461 path.lineTo(0.41f, 0.65f);
462 path.lineTo(0.41f, 0.5f);
463 path.lineTo(0.35f, 0.5f);
464 path.lineTo(0.35f, 0.35f);
465 path.closeSubPath();
466
467 path.startNewSubPath(0.48f, 0.65f);
468 path.lineTo(0.48f, 0.35f);
469 path.lineTo(0.52f, 0.35f);
470 path.lineTo(0.52f, 0.5f);
471 path.lineTo(0.58f, 0.5f);
472 path.lineTo(0.58f, 0.65f);
473 path.lineTo(0.42f, 0.65f);
474 path.lineTo(0.42f, 0.5f);
475 path.lineTo(0.48f, 0.5f);
476 path.closeSubPath();
477
478 path.startNewSubPath(0.65f, 0.35f);
479 path.lineTo(0.76f, 0.35f);
480 path.lineTo(0.76f, 0.65f);
481 path.lineTo(0.59f, 0.65f);
482 path.lineTo(0.59f, 0.5f);
483 path.lineTo(0.65f, 0.5f);
484 path.lineTo(0.65f, 0.35f);
485 path.closeSubPath();
486
487 return path;
488 }
489
490 static Path keyboardBordered() {
491 Path board = keyboard();
492
493 board.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.01f);
494 board.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.01f);
495 return board;
496 }
497
498 static Path fullKeyboard() {
499 Path path;
500 path.startNewSubPath(1, 0);
501 path.lineTo(1, 2);
502 path.lineTo(23, 2);
503 path.lineTo(23, 1);
504 path.lineTo(15, 1);
505 path.lineTo(15, 0);
506 path.closeSubPath();
507
508 path.startNewSubPath(29, 0);
509 path.lineTo(29, 1);
510 path.lineTo(25, 1);
511 path.lineTo(25, 2);
512 path.lineTo(47, 2);
513 path.lineTo(47, 1);
514 path.lineTo(43, 1);
515 path.lineTo(43, 0);
516 path.closeSubPath();
517
518 path.startNewSubPath(57, 0);
519 path.lineTo(57, 1);
520 path.lineTo(49, 1);
521 path.lineTo(49, 2);
522 path.lineTo(71, 2);
523 path.lineTo(71, 0);
524 path.closeSubPath();
525
526 path.startNewSubPath(73, 0);
527 path.lineTo(73, 2);
528 path.lineTo(95, 2);
529 path.lineTo(95, 1);
530 path.lineTo(83, 1);
531 path.lineTo(83, 0);
532 path.closeSubPath();
533
534 path.startNewSubPath(99, 0);
535 path.lineTo(99, 1);
536 path.lineTo(97, 1);
537 path.lineTo(97, 2);
538 path.lineTo(119, 2);
539 path.lineTo(119, 1);
540 path.lineTo(112, 1);
541 path.lineTo(112, 0);
542 path.closeSubPath();
543
544 path.startNewSubPath(128, 0);
545 path.lineTo(128, 1);
546 path.lineTo(121, 1);
547 path.lineTo(121, 2);
548 path.lineTo(143, 2);
549 path.lineTo(143, 1);
550 path.lineTo(141, 1);
551 path.lineTo(141, 0);
552 path.closeSubPath();
553
554 path.startNewSubPath(157, 0);
555 path.lineTo(157, 1);
556 path.lineTo(145, 1);
557 path.lineTo(145, 2);
558 path.lineTo(167, 2);
559 path.lineTo(167, 0);
560 path.closeSubPath();
561
562 return path;
563 }
564
565 static Path gear() {
566 static constexpr float kRadius = 0.3f;
567 static constexpr float kGearOuterRatio = 1.2f;
568 static constexpr int kNumGearTeeth = 8;
569
570 Path path;
571 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
572 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
573 float offset = 0.5f - kRadius;
574 float diameter = 2.0f * kRadius;
575 path.addPieSegment(offset, offset, diameter, diameter, 0.0f, 2.0f * vital::kPi, 0.5f);
576 for (int i = 0; i < kNumGearTeeth; ++i) {
577 float phase = 2.0f * i * vital::kPi / kNumGearTeeth;
578 float x_offset = kRadius * cosf(phase);
579 float y_offset = kRadius * sinf(phase);
580 Line<float> line(0.5f + x_offset, 0.5f + y_offset,
581 0.5f + kGearOuterRatio * x_offset, 0.5f + kGearOuterRatio * y_offset);
582 path.addLineSegment(line, 0.13f);
583 }
584
585 return path;
586 }
587
588 static Path magnifyingGlass() {
589 static constexpr float kRadius = 0.22f;
590 static constexpr float kWidthRatio = 0.3f;
591 static constexpr float kGlassOffset = 0.2f;
592 static constexpr float kSqrt2 = 1.41421356237f;
593
594 Path path;
595 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
596 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
597 float diameter = 2.0f * kRadius;
598 path.addPieSegment(kGlassOffset, kGlassOffset, diameter, diameter, 0.0f, 2.0f * vital::kPi, 1.0f - kWidthRatio);
599
600 float line_width = kWidthRatio * kRadius;
601 float line_start = kGlassOffset + kSqrt2 * kRadius + line_width / 2.0f;
602 path.addLineSegment(Line<float>(line_start, line_start, 1.0f - kGlassOffset, 1.0f - kGlassOffset), line_width);
603
604 return path;
605 }
606
607 static Path save() {
608 Path outline;
609 outline.startNewSubPath(0.5f, 0.25f);
610 outline.lineTo(0.5f, 0.6f);
611 outline.startNewSubPath(0.35f, 0.45f);
612 outline.lineTo(0.5f, 0.6f);
613 outline.lineTo(0.65f, 0.45f);
614
615 outline.startNewSubPath(0.25f, 0.5f);
616 outline.lineTo(0.2f, 0.5f);
617 outline.lineTo(0.2f, 0.75f);
618 outline.lineTo(0.8f, 0.75f);
619 outline.lineTo(0.8f, 0.5f);
620 outline.lineTo(0.75f, 0.5f);
621
622 Path path;
623 PathStrokeType stroke(0.05f, PathStrokeType::curved, PathStrokeType::rounded);
624 stroke.createStrokedPath(path, outline);
625 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
626 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
627 return path;
628 }
629
630 static Path loop() {
631 Path outline;
632 outline.startNewSubPath(0.68f, 0.3f);
633 outline.lineTo(0.85f, 0.3f);
634 outline.lineTo(0.85f, 0.7f);
635 outline.lineTo(0.15f, 0.7f);
636 outline.lineTo(0.15f, 0.3f);
637 outline.lineTo(0.61f, 0.3f);
638 PathStrokeType outer_stroke(0.12f, PathStrokeType::curved, PathStrokeType::rounded);
639
640 Path path;
641 outer_stroke.createStrokeWithArrowheads(path, outline, 0.0f, 0.0f, 0.4f, 0.26f);
642 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
643 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
644 return path;
645 }
646
647 static Path bounce() {
648 Path left_outline, right_outline;
649 left_outline.startNewSubPath(0.5f, 0.5f);
650 left_outline.lineTo(0.0f, 0.5f);
651 left_outline.startNewSubPath(0.5f, 0.5f);
652 left_outline.lineTo(1.0f, 0.5f);
653
654 PathStrokeType stroke(0.12f, PathStrokeType::curved, PathStrokeType::butt);
655 Path left_path, right_path;
656 stroke.createStrokeWithArrowheads(left_path, left_outline, 0.0f, 0.0f, 0.4f, 0.26f);
657 stroke.createStrokeWithArrowheads(right_path, right_outline, 0.0f, 0.0f, 0.4f, 0.26f);
658
659 Path path;
660 path.addPath(left_path);
661 path.addPath(right_path);
662
663 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
664 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
665 return path;
666 }
667
668 static Path bipolar() {
669 Path left_outline, right_outline;
670 left_outline.startNewSubPath(0.3f, 0.5f);
671 left_outline.lineTo(0.0f, 0.5f);
672 left_outline.startNewSubPath(0.7f, 0.5f);
673 left_outline.lineTo(1.0f, 0.5f);
674
675 PathStrokeType stroke(0.12f, PathStrokeType::curved, PathStrokeType::rounded);
676 Path left_path, right_path;
677 stroke.createStrokeWithArrowheads(left_path, left_outline, 0.0f, 0.0f, 0.4f, 0.26f);
678 stroke.createStrokeWithArrowheads(right_path, right_outline, 0.0f, 0.0f, 0.4f, 0.26f);
679
680 Path path;
681 path.addEllipse(0.4f, 0.4f, 0.2f, 0.2f);
682 path.addPath(left_path);
683 path.addPath(right_path);
684
685 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
686 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
687 return path;
688 }
689
690 static Path shuffle() {
691 Path over;
692 over.startNewSubPath(0.1f, 0.7f);
693 over.lineTo(0.25f, 0.7f);
694 over.lineTo(0.55f, 0.3f);
695 over.lineTo(0.95f, 0.3f);
696
697 Path under_first;
698 under_first.startNewSubPath(0.1f, 0.3f);
699 under_first.lineTo(0.25f, 0.3f);
700 under_first.lineTo(0.325f, 0.4f);
701
702 Path under_second;
703 under_second.startNewSubPath(0.475f, 0.6f);
704 under_second.lineTo(0.55f, 0.7f);
705 under_second.lineTo(0.95f, 0.7f);
706
707 PathStrokeType stroke(0.12f, PathStrokeType::curved, PathStrokeType::butt);
708 Path over_path;
709 stroke.createStrokeWithArrowheads(over_path, over, 0.0f, 0.0f, 0.35f, 0.26f);
710 Path under_path_first;
711 stroke.createStrokedPath(under_path_first, under_first);
712 Path under_path_second;
713 stroke.createStrokeWithArrowheads(under_path_second, under_second, 0.0f, 0.0f, 0.35f, 0.26f);
714
715 Path path;
716 path.addPath(over_path);
717 path.addPath(under_path_first);
718 path.addPath(under_path_second);
719
720 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
721 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
722 return path;
723 }
724
725 static Path pencil() {
726 static constexpr float kPencilDimension = 0.14f;
727 static constexpr float kEraserLength = 0.6f * kPencilDimension;
728 static constexpr float kSeparatorWidth = 0.15f * kPencilDimension;
729 static constexpr float kPencilRemoval = kEraserLength + kSeparatorWidth;
730 static constexpr float kBorder = 0.22f;
731
732 Path path;
733 path.startNewSubPath(kBorder, 1.0f - kBorder);
734 path.lineTo(kBorder + kPencilDimension, 1.0f - kBorder);
735 path.lineTo(1.0f - kBorder - kPencilRemoval, kBorder + kPencilDimension + kPencilRemoval);
736 path.lineTo(1.0f - kBorder - kPencilRemoval - kPencilDimension, kBorder + kPencilRemoval);
737 path.lineTo(kBorder, 1.0f - kBorder - kPencilDimension);
738 path.closeSubPath();
739
740 path.startNewSubPath(1.0f - kBorder - kPencilDimension, kBorder);
741 path.lineTo(1.0f - kBorder, kBorder + kPencilDimension);
742 path.lineTo(1.0f - kBorder - kEraserLength, kBorder + kPencilDimension + kEraserLength);
743 path.lineTo(1.0f - kBorder - kEraserLength - kPencilDimension, kBorder + kEraserLength);
744 path.closeSubPath();
745
746 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
747 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
748 return path;
749 }
750
751 static Path halfSinCurve() {
752 static constexpr float kBorder = 0.15f;
753 static constexpr float kLineWidth = 0.1f;
754 static constexpr float kEndpointStrokeWidth = 0.08f;
755 static constexpr float kEndpointRadius = 0.09f;
756 static constexpr int kNumCurvePoints = 16;
757 static constexpr float kFullRadians = vital::kPi * 2.0f;
758 static constexpr float kBumpIn = kEndpointRadius;
759 static constexpr float kAdjustXIn = kBumpIn + kEndpointRadius / 2.0f;
760
761 Path curve;
762 float start_x = kBorder + kAdjustXIn;
763 float start_y = 1.0f - kBorder - kBumpIn;
764 float end_x = 1.0f - kBorder - kAdjustXIn;
765 float end_y = kBorder + kBumpIn;
766
767 curve.startNewSubPath(start_x, end_x);
768 for (int i = 0; i < kNumCurvePoints; ++i) {
769 float t = (1.0f + i) / kNumCurvePoints;
770 float x = t * end_x + (1.0f - t) * start_x;
771 float y_t = sinf((t - 0.5f) * vital::kPi) * 0.5f + 0.5f;
772 float y = y_t * end_y + (1.0f - y_t) * start_y;
773 curve.lineTo(x, y);
774 }
775
776 Path path;
777 PathStrokeType line_stroke(kLineWidth, PathStrokeType::curved, PathStrokeType::butt);
778 PathStrokeType endpoint_stroke(kEndpointStrokeWidth, PathStrokeType::curved, PathStrokeType::butt);
779 line_stroke.createStrokedPath(path, curve);
780
781 Path arc;
782 arc.addCentredArc(end_x + kBumpIn, end_y, kEndpointRadius, kEndpointRadius, 0.0f, 0.0f, kFullRadians, true);
783 arc.addCentredArc(start_x - kBumpIn, start_y, kEndpointRadius, kEndpointRadius, 0.0f, 0.0f, kFullRadians, true);
784 Path end_points;
785 endpoint_stroke.createStrokedPath(end_points, arc);
786 path.addPath(end_points);
787
788 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
789 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
790 return path;
791 }
792
793 static Path ellipses() {
794 Path path;
795 path.addEllipse(0.1f, 0.4f, 0.2f, 0.2f);
796 path.addEllipse(0.4f, 0.4f, 0.2f, 0.2f);
797 path.addEllipse(0.7f, 0.4f, 0.2f, 0.2f);
798
799 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
800 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
801 return path;
802 }
803
804 static Path paintBrush() {
805 static constexpr float kBrushWideDimension = 0.3f;
806 static constexpr float kBrushHandleDimension = 0.08f;
807 static constexpr float kBrushLength = 0.6f * kBrushWideDimension;
808 static constexpr float kSeparatorWidth = 0.15f * kBrushWideDimension;
809 static constexpr float kConnectionDistance = kBrushLength + kSeparatorWidth;
810 static constexpr float kHandleDistance = kConnectionDistance + kBrushWideDimension * 0.8f;
811 static constexpr float kBorder = 0.15f;
812
813 Path path;
814 path.startNewSubPath(kBorder, 1.0f - kBorder);
815 path.lineTo(kBorder + kBrushHandleDimension, 1.0f - kBorder);
816 path.lineTo(1.0f - kBorder - kHandleDistance, kBorder + kBrushHandleDimension + kHandleDistance);
817 path.lineTo(1.0f - kBorder - kConnectionDistance, kBorder + kBrushWideDimension + kConnectionDistance);
818 path.lineTo(1.0f - kBorder - kConnectionDistance - kBrushWideDimension, kBorder + kConnectionDistance);
819 path.lineTo(1.0f - kBorder - kHandleDistance - kBrushHandleDimension, kBorder + kHandleDistance);
820 path.lineTo(kBorder, 1.0f - kBorder - kBrushHandleDimension);
821 path.closeSubPath();
822
823 path.startNewSubPath(1.0f - kBorder - kBrushWideDimension, kBorder);
824 path.lineTo(1.0f - kBorder, kBorder + kBrushWideDimension);
825 path.lineTo(1.0f - kBorder - kBrushLength, kBorder + kBrushWideDimension + kBrushLength);
826 path.lineTo(1.0f - kBorder - kBrushLength - kBrushWideDimension, kBorder + kBrushLength);
827 path.closeSubPath();
828
829 path.addLineSegment(Line<float>(0.0f, 0.0f, 0.0f, 0.0f), 0.2f);
830 path.addLineSegment(Line<float>(1.0f, 1.0f, 1.0f, 1.0f), 0.2f);
831 return path;
832 }
833
834 static Path createFilterStroke(const Path& outline, float line_thickness = 0.1f) {
835 PathStrokeType stroke(line_thickness, PathStrokeType::curved, PathStrokeType::rounded);
836
837 Path path;
838 stroke.createStrokedPath(path, outline);
839 return path;
840 }
841
842 static Path lowPass(float line_thickness = 0.1f) {
843 Path outline;
844 outline.startNewSubPath(1.0f, 0.8f);
845 outline.lineTo(0.7f, 0.3f);
846 outline.lineTo(0.5f, 0.5f);
847 outline.lineTo(0.0f, 0.5f);
848 Path path = createFilterStroke(outline, line_thickness);
849 path.addLineSegment(Line<float>(1.0f, 0.2f, 1.0f, 0.2f), 0.2f);
850 return path;
851 }
852
853 static Path highPass() {
854 Path outline;
855 outline.startNewSubPath(0.0f, 0.8f);
856 outline.lineTo(0.3f, 0.3f);
857 outline.lineTo(0.5f, 0.5f);
858 outline.lineTo(1.0f, 0.5f);
859 Path path = createFilterStroke(outline);
860 path.addLineSegment(Line<float>(1.0f, 0.2f, 1.0f, 0.2f), 0.2f);
861 return path;
862 }
863
864 static Path bandPass() {
865 static constexpr float kMiddle = 3.0f / 5.0f;
866 static constexpr float kBottom = 4.0f / 5.0f;
867
868 Path outline;
869 outline.startNewSubPath(0.0f, kBottom);
870 outline.lineTo(1.0f / 3.0f, kMiddle);
871 outline.lineTo(0.5f, 0.25f);
872 outline.lineTo(2.0f / 3.0f, kMiddle);
873 outline.lineTo(1.0f, kBottom);
874
875 Path path = createFilterStroke(outline);
876 path.addLineSegment(Line<float>(1.0f, 0.2f, 1.0f, 0.2f), 0.2f);
877 return path;
878 }
879
880 static Path leftArrow() {
881 static constexpr float kArrowAmount = 1.0f / 3.0f;
882 static constexpr float kBuffer = 0.0f;
883
884 Path outline;
885 outline.startNewSubPath(1.0f - kBuffer, 0.5f);
886 outline.lineTo(kBuffer, 0.5f);
887 outline.startNewSubPath(kBuffer, 0.5f);
888 outline.lineTo(kBuffer + kArrowAmount, 0.5f - kArrowAmount);
889 outline.startNewSubPath(kBuffer, 0.5f);
890 outline.lineTo(kBuffer + kArrowAmount, 0.5f + kArrowAmount);
891 return createFilterStroke(outline);
892 }
893
894 static Path rightArrow() {
895 static constexpr float kArrowAmount = 1.0f / 3.0f;
896 static constexpr float kBuffer = 0.0f;
897
898 Path outline;
899 outline.startNewSubPath(1.0f - kBuffer, 0.5f);
900 outline.lineTo(kBuffer, 0.5f);
901 outline.startNewSubPath(1.0f - kBuffer, 0.5f);
902 outline.lineTo(1.0f - kArrowAmount - kBuffer, 0.5f - kArrowAmount);
903 outline.startNewSubPath(1.0f - kBuffer, 0.5f);
904 outline.lineTo(1.0f - kArrowAmount - kBuffer, 0.5f + kArrowAmount);
905 return createFilterStroke(outline);
906 }
907
908 static Path phaser1() {
909 Path outline;
910 outline.startNewSubPath(0.0f, 0.5f);
911 outline.lineTo(1.0f / 3.0f, 3.0f / 4.0f);
912 outline.lineTo(1.0f / 2.0f, 1.0f / 4.0f);
913 outline.lineTo(2.0f / 3.0f, 3.0f / 4.0f);
914 outline.lineTo(1.0f, 0.5f);
915
916 Path path = createFilterStroke(outline);
917 path.addLineSegment(Line<float>(1.0f, 0.15f, 1.0f, 0.15f), 0.1f);
918 path.addLineSegment(Line<float>(1.0f, 0.85f, 1.0f, 0.85f), 0.1f);
919 return path;
920 }
921
922 static Path phaser3() {
923 static constexpr int kNumHumps = 5;
924
925 static const float kUp = 1.0f / 4.0f;
926 static const float kDown = 3.0f / 4.0f;
927
928 float delta = 1.0f / (2 * kNumHumps + 2);
929 Path outline;
930 outline.startNewSubPath(0.0f, 0.5f);
931
932 float position = 0.0f;
933 for (int i = 0; i < kNumHumps; ++i) {
934 position += delta;
935 outline.lineTo(position, kDown);
936 position += delta;
937 outline.lineTo(position, kUp);
938 }
939 position += delta;
940 outline.lineTo(position, kDown);
941 outline.lineTo(1.0f, 0.5f);
942
943 Path path = createFilterStroke(outline);
944 path.addLineSegment(Line<float>(1.0f, 0.15f, 1.0f, 0.15f), 0.1f);
945 path.addLineSegment(Line<float>(1.0f, 0.85f, 1.0f, 0.85f), 0.1f);
946 return path;
947 }
948
949 static Path notch() {
950 static constexpr float kTop = 2.0f / 5.0f;
951 static constexpr float kBottom = 4.0f / 5.0f;
952
953 Path outline;
954 outline.startNewSubPath(0.0f, kTop);
955 outline.lineTo(1.0f / 3.0f, kTop);
956 outline.lineTo(1.0f / 2.0f, kBottom);
957 outline.lineTo(2.0f / 3.0f, kTop);
958 outline.lineTo(1.0f, kTop);
959
960 Path path = createFilterStroke(outline);
961 path.addLineSegment(Line<float>(1.0f, 0.2f, 1.0f, 0.2f), 0.1f);
962 return path;
963 }
964
965 static Path narrowBand() {
966 static constexpr float kTop = 2.0f / 5.0f;
967 static constexpr float kBottom = 4.0f / 5.0f;
968
969 Path outline;
970 outline.startNewSubPath(0.0f, kBottom);
971 outline.lineTo(1.0f / 3.0f, kBottom);
972 outline.lineTo(0.5f, kTop);
973 outline.lineTo(2.0f / 3.0f, kBottom);
974 outline.lineTo(1.0f, kBottom);
975
976 Path path = createFilterStroke(outline);
977 path.addLineSegment(Line<float>(1.0f, 0.2f, 1.0f, 0.2f), 0.1f);
978 return path;
979 }
980
981 static Path wideBand() {
982 static constexpr float kTop = 2.0f / 5.0f;
983 static constexpr float kBottom = 4.0f / 5.0f;
984
985 Path outline;
986 outline.startNewSubPath(0.0f, kBottom);
987 outline.lineTo(1.0f / 3.0f, kTop);
988 outline.lineTo(2.0f / 3.0f, kTop);
989 outline.lineTo(1.0f, kBottom);
990
991 Path path = createFilterStroke(outline);
992 path.addLineSegment(Line<float>(1.0f, 0.2f, 1.0f, 0.2f), 0.1f);
993 return path;
994 }
995};
996
A utility class providing static functions to generate various SVG-based or programmatic paths.
Definition paths.h:14
static Path delay()
Creates a delay effect icon path from embedded SVG data.
Definition paths.h:93
static Path pencil()
Definition paths.h:725
static Path fromSvgData(const void *data, size_t data_size)
Creates a JUCE Path from embedded SVG data.
Definition paths.h:30
static Path phaser()
Creates a phaser effect icon path.
Definition paths.h:141
static Path equalizer()
Creates an equalizer icon path.
Definition paths.h:109
static Path downTriangle()
Definition paths.h:390
static Path ellipses()
Definition paths.h:793
static Path chorus()
Creates a chorus icon path from embedded SVG data.
Definition paths.h:77
static Path vitalWordRing()
Creates the Vital wordmark with ring path.
Definition paths.h:69
static Path save()
Definition paths.h:607
static Path note()
Creates a musical note icon path.
Definition paths.h:219
static Path dragDropArrows()
Creates a drag-and-drop arrows icon path.
Definition paths.h:211
static Path compressor()
Creates a compressor icon path from embedded SVG data.
Definition paths.h:85
static Path star()
Definition paths.h:446
static Path bounce()
Definition paths.h:647
static Path halfSinCurve()
Definition paths.h:751
static Path tripletNotes()
Creates a triplet notes icon path.
Definition paths.h:242
static Path highPass()
Definition paths.h:853
static Path plus(int width)
Definition paths.h:305
static Path fullKeyboard()
Definition paths.h:498
static Path menu()
Creates a menu icon path (three horizontal lines).
Definition paths.h:271
static Path bipolar()
Definition paths.h:668
static Path magnifyingGlass()
Definition paths.h:588
static Path leftArrow()
Definition paths.h:880
static constexpr int kLogoWidth
Width reference used for scaling Vital's logo paths.
Definition paths.h:17
static Path paintBrush()
Definition paths.h:804
static Path shuffle()
Definition paths.h:690
static Path notch()
Definition paths.h:949
static Path reverb()
Creates a reverb effect icon path.
Definition paths.h:149
static Path plusOutline()
Definition paths.h:322
static Path distortion()
Creates a distortion effect icon path.
Definition paths.h:101
Paths()=delete
Deleted constructor to prevent instantiation.
static Path menu(int width)
Overloaded menu path with custom width.
Definition paths.h:286
static Path vitalWord()
Creates the Vital wordmark path.
Definition paths.h:61
static Path next()
Creates a 'next' arrow icon path.
Definition paths.h:176
static Path clock()
Creates a clock icon path.
Definition paths.h:195
static Path vitalV()
Creates the Vital 'V' logo path.
Definition paths.h:50
static Path flanger()
Creates a flanger effect icon path.
Definition paths.h:125
static Path gear()
Definition paths.h:565
static Path rightArrow()
Definition paths.h:894
static Path createFilterStroke(const Path &outline, float line_thickness=0.1f)
Definition paths.h:834
static Path narrowBand()
Definition paths.h:965
static Path folder()
Creates a folder icon path.
Definition paths.h:133
static Path phaser1()
Definition paths.h:908
static Path loop()
Definition paths.h:630
static Path keyboardBordered()
Definition paths.h:490
static Path phaser3()
Definition paths.h:922
static Path bandPass()
Definition paths.h:864
static Path keyboard()
Definition paths.h:454
static Path exitX()
Definition paths.h:416
static Path upTriangle()
Definition paths.h:403
static Path lowPass(float line_thickness=0.1f)
Definition paths.h:842
static Path wideBand()
Definition paths.h:981
static Path prev()
Creates a 'previous' arrow icon path.
Definition paths.h:157
static Path effectsFilter()
Creates an effects filter icon path.
Definition paths.h:117
static Path vitalRing()
Creates the Vital ring logo path.
Definition paths.h:39
static Path thickX()
Definition paths.h:431
static Path save(int width)
Definition paths.h:352
constexpr mono_float kPi
Pi constant.
Definition common.h:36