785 {
788
791
792
793
795
796
798
799
801
804
809 srcInfo,
811 info.minRowBytes()));
812
813
816 case ColorSpace::kHSL: convertFn =
srgb_to_hsl;
break;
817 case ColorSpace::kHWB: convertFn =
srgb_to_hwb;
break;
824 default: break;
825 }
826
828 bool anyPowerlessHue = false;
830 if (convertFn) {
831 for (
int i = 0;
i < colorCount; ++
i) {
833 anyPowerlessHue = anyPowerlessHue || hueIsPowerless[
i];
834 }
835 }
836
837 if (anyPowerlessHue) {
838
839
840
843
844 for (
int i = 0;
i < colorCount; ++
i) {
846 float curPos = shader->
getPos(
i);
847
848 if (!hueIsPowerless[
i]) {
849 newColors.push_back(curColor);
850 newPositions.push_back(curPos);
851 continue;
852 }
853
855
856
858 };
859
860
861
863 newPositions.push_back(curPos);
864 newColors.push_back(colorWithHueFrom(curColor,
fColors[
i - 1]));
865 }
866 if (
i != colorCount - 1) {
867 newPositions.push_back(curPos);
868 newColors.push_back(colorWithHueFrom(curColor,
fColors[
i + 1]));
869 }
870 }
871
876 }
877
878
879
880
881
882
883
886 for (
int i = 0;
i < colorCount - 1; ++
i) {
891 case HueMethod::kShorter:
892 if (h2 - h1 > 180) {
893 h2 -= 360;
895 } else if (h2 - h1 < -180) {
896 h2 += 360;
898 }
899 break;
900 case HueMethod::kLonger:
903
904
905 } else if (0 < h2 - h1 && h2 - h1 < 180) {
906 h2 -= 360;
908 } else if (-180 < h2 - h1 && h2 - h1 <= 0) {
909 h2 += 360;
911 }
912 break;
913 case HueMethod::kIncreasing:
914 if (h2 < h1) {
915 h2 += 360;
917 }
918 break;
919 case HueMethod::kDecreasing:
920 if (h1 < h2) {
921 h2 -= 360;
923 }
924 break;
925 }
926 }
927 }
928
929
931 if (
static_cast<bool>(interpolation.
fInPremul)) {
933 case ColorSpace::kHSL:
934 case ColorSpace::kHWB:
935 case ColorSpace::kLCH:
936 case ColorSpace::kOKLCH:
938 break;
939 default:
941 break;
942 }
943 }
944
945 if (premulFn) {
946 for (
int i = 0;
i < colorCount; ++
i) {
948 }
949 }
950
951
954 float posScale = 1.0f / (colorCount - 1);
955 for (
int i = 0;
i < colorCount;
i++) {
957 }
959 }
960}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
@ 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)