/// <exclude/> protected override void Clean() { base.Clean(); if (mesh == null) { return; } _gradientColors[0].position = 0; _gradientColors[_gradientColors.Length - 1].position = 100 - _gradientColors[_gradientColors.Length - 1].size; CloneGradientColors(); _gradientOrientation_ = _gradientOrientation; var colors = new Color[mesh.vertexCount]; int vp = 0; for (int c = 0; c < _gradientColors.Length; c++) { if (vp < mesh.vertexCount / 2) { colors[(vp * 2)] = _gradientColors[c].color; colors[(vp * 2) + 1] = _gradientColors[c].color; } vp++; if (_gradientColors[c].size > 0 && vp < mesh.vertexCount / 2) { colors[(vp * 2)] = _gradientColors[c].color; colors[(vp * 2) + 1] = _gradientColors[c].color; vp++; } } mesh.colors = colors; }
public void InsertGradientStyleCSS(GradientOrientation paGraditenOrientation, String paStartColor, String paEndColor) { String lcDirectionStart; String lcDirectionEnd; lcDirectionStart = paGraditenOrientation == GradientOrientation.Horizontal ? "left" : "top"; lcDirectionEnd = paGraditenOrientation == GradientOrientation.Horizontal ? "right" : "bottom"; clCSSStyleManager.AddStyle(CSSStyle.Filter, ctIEGradient.Replace("$STARTCOLOR", paStartColor).Replace("$ENDCOLOR", paEndColor).Replace("$GRADIENTTYPE", paGraditenOrientation == GradientOrientation.Horizontal ? "1" : "0")); clCSSStyleManager.AddStyle(CSSStyle.Background, ctWEBKITGradient.Replace("$STARTCOLOR", paStartColor).Replace("$ENDCOLOR", paEndColor).Replace("$DIRECTIONSTART", lcDirectionStart)); clCSSStyleManager.AddStyle(CSSStyle.Background, ctMOZGradient.Replace("$STARTCOLOR", paStartColor).Replace("$ENDCOLOR", paEndColor).Replace("$DIRECTIONSTART", lcDirectionStart)); clCSSStyleManager.AddStyle(CSSStyle.Background, ctMSLinearGradient.Replace("$STARTCOLOR", paStartColor).Replace("$ENDCOLOR", paEndColor).Replace("$DIRECTIONSTART", lcDirectionStart)); clCSSStyleManager.AddStyle(CSSStyle.Background, ctLinearGradient.Replace("$STARTCOLOR", paStartColor).Replace("$ENDCOLOR", paEndColor).Replace("$DIRECTIONEND", lcDirectionEnd)); clCSSStyleManager.AddStyle(CSSStyle.Background, ctOperaGradient.Replace("$STARTCOLOR", paStartColor).Replace("$ENDCOLOR", paEndColor).Replace("$DIRECTIONSTART", lcDirectionStart)); }
protected override void Awake() { CloneGradientColors(); _gradientOrientation_ = _gradientOrientation; base.Awake(); }
/// <exclude/> protected override void Clean() { base.Clean(); if (mesh == null) return; _gradientColors[0].position = 0; _gradientColors[_gradientColors.Length-1].position = 100-_gradientColors[_gradientColors.Length-1].size; CloneGradientColors(); _gradientOrientation_ = _gradientOrientation; var colors = new Color[mesh.vertexCount]; int vp = 0; for (int c=0; c<_gradientColors.Length; c++) { Color col = _gradientColors[c].color; col.a = (col.a * alpha); col.r = (col.r * tintColor.r); col.g = (col.g * tintColor.g); col.b = (col.b * tintColor.b); if (vp < mesh.vertexCount/2) { colors[(vp*2)] = col; colors[(vp*2)+1] = col; } vp++; if (_gradientColors[c].size>0 && vp < mesh.vertexCount/2) { colors[(vp*2)] = col; colors[(vp*2)+1] = col; vp++; } } mesh.colors = colors; }
protected override void Awake() { CloneGradientColors(); _gradientOrientation_ = _gradientOrientation; base.Awake(); }
public static void SetOrientation(BindableObject view, GradientOrientation value) { view.SetValue(OrientationProperty, value); }
//----------------------------------------------------------------------------- // overridden subclass methods //----------------------------------------------------------------------------- /// <exclude /> protected override void CheckSettings() { base.CheckSettings(); if (_gradientColors.Length<2) { System.Array.Resize(ref _gradientColors,2); } _gradientColors[0].position = 0; _gradientColors[_gradientColors.Length-1].position = 100; if (_gradientColors.Length!=_gradientColors_.Length || GradientMeshChanged() || _gradientOrientation_ != _gradientOrientation) meshDirty = true; else if (GradientColorChanged()) { isDirty = true; } if (meshDirty || isDirty) { CloneGradientColors(); _gradientOrientation_ = _gradientOrientation; } }
public void Reset() { this.Orientation = GradientOrientation.Vertical; this.From = Color.black; this.To = Color.white; }