AddColorStop() public method

public AddColorStop ( double offset, Color c ) : Status
offset double
c Color
return Status
示例#1
0
文件: Util.cs 项目: codecopy/core-1
            static void GetShadowPattern(Cairo.Gradient shadow, ShadowParameters shadowParams)
            {
                double denLog = Math.Log(1.0f / shadowParams.shadowRadius);

                shadow.AddColorStop(0.0, new Cairo.Color(0, 0, 0, shadowParams.shadowAlpha));

                for (int i = 2; i <= shadowParams.shadowRadius; i++)
                {
                    double step = i / shadowParams.shadowRadius;
                    shadow.AddColorStop(step, new Cairo.Color(0, 0, 0, shadowParams.shadowAlpha * (Math.Log(step) / denLog)));
                }
            }
 static void ShadowGradient(Cairo.Gradient lg, double strength)
 {
     lg.AddColorStop(0, new Cairo.Color(0, 0, 0, strength));
     lg.AddColorStop(1.0 / 6.0, new Cairo.Color(0, 0, 0, .85 * strength));
     lg.AddColorStop(2.0 / 6.0, new Cairo.Color(0, 0, 0, .54 * strength));
     lg.AddColorStop(3.0 / 6.0, new Cairo.Color(0, 0, 0, .24 * strength));
     lg.AddColorStop(4.0 / 6.0, new Cairo.Color(0, 0, 0, .07 * strength));
     lg.AddColorStop(5.0 / 6.0, new Cairo.Color(0, 0, 0, .01 * strength));
     lg.AddColorStop(1, new Cairo.Color(0, 0, 0, 0));
 }