MCPcopy Create free account
hub / github.com/DISTRHO/Cardinal / invertPaintForLightMode

Function invertPaintForLightMode

src/custom/dep.cpp:872–1107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870}
871
872static inline
873bool invertPaintForLightMode(const LightMode mode, NSVGshape* const shape, NSVGpaint& paint)
874{
875 if (paint.type == NSVG_PAINT_LINEAR_GRADIENT)
876 {
877 switch (mode)
878 {
879 case kModeFundamental:
880 paint.gradient->stops[0].color = 0xffffffff;
881 paint.gradient->stops[1].color = 0xffe6d6d6;
882 return true;
883 default:
884 for (int i=0; i<paint.gradient->nstops; ++i)
885 paint.gradient->stops[i].color = invertColor(paint.gradient->stops[i].color);
886 return true;
887 }
888 }
889
890 if (paint.type == NSVG_PAINT_RADIAL_GRADIENT && mode == kModeMog)
891 {
892 std::free(paint.gradient);
893 paint.type = NSVG_PAINT_COLOR;
894 paint.color = 0xffe5e5e5;
895 return true;
896 }
897
898 if (paint.type == NSVG_PAINT_NONE)
899 return true;
900 if (paint.type != NSVG_PAINT_COLOR)
901 return false;
902
903 switch (mode)
904 {
905 case kMode8Mode:
906 switch (paint.color)
907 {
908 case 0xff000000:
909 if (std::strcmp(shape->id, "rect1211") == 0)
910 break;
911 return false;
912 case 0xff1a1a1a:
913 if (std::strcmp(shape->id, "rect1523") != 0)
914 break;
915 return false;
916 default:
917 return false;
918 }
919 break;
920 case kModeAutinn:
921 switch (paint.color)
922 {
923 // red stripe
924 case 0xff0a115e:
925 paint.color = 0xffa1a8f5;
926 return true;
927 // logo
928 case 0xff00d7ff:
929 paint.color = 0xff005868;

Callers 1

Calls 1

invertColorFunction · 0.85

Tested by

no test coverage detected