Maps an IconId to its embedded SVG source (headers generated from src/resources/icons/*.svg, one " _svg.h" per icon). Returns {data, size}; every IconId has a matching array, so there is no "not found" case.
| 47 | // {data, size}; every IconId has a matching array, so there is no |
| 48 | // "not found" case. |
| 49 | std::pair<const unsigned char*, std::size_t> svg_source_for(IconId id) { |
| 50 | using enum IconId; |
| 51 | switch (id) { |
| 52 | case ChannelRed: |
| 53 | return {icons::kLabelRedChannelSvg, sizeof(icons::kLabelRedChannelSvg)}; |
| 54 | case ChannelGreen: |
| 55 | return {icons::kLabelGreenChannelSvg, |
| 56 | sizeof(icons::kLabelGreenChannelSvg)}; |
| 57 | case ChannelBlue: |
| 58 | return {icons::kLabelBlueChannelSvg, |
| 59 | sizeof(icons::kLabelBlueChannelSvg)}; |
| 60 | case ChannelAlpha: |
| 61 | return {icons::kLabelAlphaChannelSvg, |
| 62 | sizeof(icons::kLabelAlphaChannelSvg)}; |
| 63 | case LowerUpperBound: |
| 64 | return {icons::kLowerUpperBoundSvg, sizeof(icons::kLowerUpperBoundSvg)}; |
| 65 | case GoToX: |
| 66 | return {icons::kXSvg, sizeof(icons::kXSvg)}; |
| 67 | case GoToY: |
| 68 | return {icons::kYSvg, sizeof(icons::kYSvg)}; |
| 69 | } |
| 70 | return {nullptr, 0}; |
| 71 | } |
| 72 | |
| 73 | } // namespace |
| 74 |