コード例 #1
0
        public static StiBrush Light(StiBrush baseBrush, byte value)
        {
            if (baseBrush is StiSolidBrush)
            {
                return(new StiSolidBrush(StiColorUtils.Light(((StiSolidBrush)baseBrush).Color, value)));
            }
            else if (baseBrush is StiGradientBrush)
            {
                StiGradientBrush gradientBrush = baseBrush as StiGradientBrush;
                return(new StiGradientBrush(
                           StiColorUtils.Light(gradientBrush.StartColor, value),
                           StiColorUtils.Light(gradientBrush.EndColor, value),
                           gradientBrush.Angle));
            }
            else if (baseBrush is StiHatchBrush)
            {
                StiHatchBrush hatchBrush = baseBrush as StiHatchBrush;
                return(new StiHatchBrush(
                           hatchBrush.Style,
                           StiColorUtils.Light(hatchBrush.ForeColor, value),
                           StiColorUtils.Light(hatchBrush.BackColor, value)));
            }
            else if (baseBrush is StiGlareBrush)
            {
                StiGlareBrush glareBrush = baseBrush as StiGlareBrush;
                return(new StiGlareBrush(
                           StiColorUtils.Light(glareBrush.StartColor, value),
                           StiColorUtils.Light(glareBrush.EndColor, value),
                           glareBrush.Angle));
            }
            else if (baseBrush is StiGlassBrush)
            {
                StiGlassBrush glassBrush = baseBrush as StiGlassBrush;
                return(new StiGlassBrush(
                           StiColorUtils.Light(glassBrush.Color, value),
                           glassBrush.DrawHatch,
                           glassBrush.Blend));
            }

            return(baseBrush);
        }
コード例 #2
0
        public static StiBrush LoadFromJson(JObject jObject)
        {
            var ident = jObject.Properties().FirstOrDefault(x => x.Name == "Ident");

            switch (ident.Value.ToObject <string>())
            {
            case "StiEmptyBrush":
                return(new StiEmptyBrush());

            case "StiSolidBrush":
                var solid = new StiSolidBrush();
                solid.LoadValuesFromJson(jObject);
                return(solid);

            case "StiGradientBrush":
                var gradient = new StiGradientBrush();
                gradient.LoadValuesFromJson(jObject);
                return(gradient);

            case "StiGlareBrush":
                var glare = new StiGlareBrush();
                glare.LoadValuesFromJson(jObject);
                return(glare);

            case "StiGlassBrush":
                var glass = new StiGlassBrush();
                glass.LoadValuesFromJson(jObject);
                return(glass);

            case "StiHatchBrush":
                var hatch = new StiHatchBrush();
                hatch.LoadValuesFromJson(jObject);
                return(hatch);
            }

            throw new Exception("Type is not supported!");
        }
コード例 #3
0
 protected bool Equals(StiGlassBrush other)
 {
     return(color.Equals(other.color) && drawHatch.Equals(other.drawHatch) && blend.Equals(other.blend));
 }