737 {
740
743
744
745
747
748
750
751
753
756
761 srcInfo,
763 info.minRowBytes()));
764
765
768 case ColorSpace::kHSL: convertFn =
srgb_to_hsl;
break;
769 case ColorSpace::kHWB: convertFn =
srgb_to_hwb;
break;
776 default: break;
777 }
778
780 bool anyPowerlessHue = false;
782 if (convertFn) {
783 for (int i = 0; i < colorCount; ++i) {
785 anyPowerlessHue = anyPowerlessHue || hueIsPowerless[i];
786 }
787 }
788
789 if (anyPowerlessHue) {
790
791
792
795
796 for (int i = 0; i < colorCount; ++i) {
798 float curPos = shader->
getPos(i);
799
800 if (!hueIsPowerless[i]) {
801 newColors.push_back(curColor);
802 newPositions.push_back(curPos);
803 continue;
804 }
805
807
808
810 };
811
812
813
814 if (i != 0) {
815 newPositions.push_back(curPos);
816 newColors.push_back(colorWithHueFrom(curColor,
fColors[i - 1]));
817 }
818 if (i != colorCount - 1) {
819 newPositions.push_back(curPos);
820 newColors.push_back(colorWithHueFrom(curColor,
fColors[i + 1]));
821 }
822 }
823
828 }
829
830
831
832
833
834
835
838 for (int i = 0; i < colorCount - 1; ++i) {
843 case HueMethod::kShorter:
844 if (h2 - h1 > 180) {
845 h2 -= 360;
847 } else if (h2 - h1 < -180) {
848 h2 += 360;
850 }
851 break;
852 case HueMethod::kLonger:
855
856
857 } else if (0 < h2 - h1 && h2 - h1 < 180) {
858 h2 -= 360;
860 } else if (-180 < h2 - h1 && h2 - h1 <= 0) {
861 h2 += 360;
863 }
864 break;
865 case HueMethod::kIncreasing:
866 if (h2 < h1) {
867 h2 += 360;
869 }
870 break;
871 case HueMethod::kDecreasing:
872 if (h1 < h2) {
873 h2 -= 360;
875 }
876 break;
877 }
878 }
879 }
880
881
883 if (
static_cast<bool>(interpolation.
fInPremul)) {
885 case ColorSpace::kHSL:
886 case ColorSpace::kHWB:
887 case ColorSpace::kLCH:
888 case ColorSpace::kOKLCH:
890 break;
891 default:
893 break;
894 }
895 }
896
897 if (premulFn) {
898 for (int i = 0; i < colorCount; ++i) {
900 }
901 }
902
903
906 float posScale = 1.0f / (colorCount - 1);
907 for (int i = 0; i < colorCount; i++) {
909 }
911 }
912}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SkAssertResult(cond)
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
bool SkConvertPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRB, const SkImageInfo &srcInfo, const void *srcPixels, size_t srcRB)
static SkPMColor4f srgb_to_hwb(SkPMColor4f rgb, bool *hueIsPowerless)
static SkPMColor4f lin_srgb_to_okhcl(SkPMColor4f rgb, bool *hueIsPowerless)
static SkPMColor4f xyzd50_to_lab(SkPMColor4f xyz, bool *)
SkPMColor4f(*)(SkPMColor4f, bool *) ConvertColorProc
static SkPMColor4f srgb_to_hsl(SkPMColor4f rgb, bool *hueIsPowerless)
static bool color_space_is_polar(SkGradientShader::Interpolation::ColorSpace cs)
SkPMColor4f(*)(SkPMColor4f) PremulColorProc
static SkPMColor4f xyzd50_to_hcl(SkPMColor4f xyz, bool *hueIsPowerless)
static SkPMColor4f premul_polar(SkPMColor4f hsl)
static SkPMColor4f premul_rgb(SkPMColor4f rgb)
static SkPMColor4f lin_srgb_to_oklab(SkPMColor4f rgb, bool *)
static sk_sp< SkColorSpace > intermediate_color_space(SkGradientShader::Interpolation::ColorSpace cs, SkColorSpace *dst)
Interpolation fInterpolation
bool fFirstStopIsImplicit
SkScalar getPos(int i) const
sk_sp< SkColorSpace > fColorSpace
void reserve_exact(int n)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)