private bool SetStyleValue(StylePropertyId id, StyleBackground inlineValue, StyleBackground sharedValue) { var sv = new StyleValue(); if (TryGetStyleValue(id, ref sv)) { var vectorImage = sv.resource.IsAllocated ? sv.resource.Target as VectorImage : null; var texture = sv.resource.IsAllocated ? sv.resource.Target as Texture2D : null; if ((vectorImage == inlineValue.value.vectorImage && texture == inlineValue.value.texture) && sv.keyword == inlineValue.keyword) { return(false); } if (sv.resource.IsAllocated) { sv.resource.Free(); } } else if (inlineValue.keyword == StyleKeyword.Null) { return(false); } sv.id = id; sv.keyword = inlineValue.keyword; if (inlineValue.value.vectorImage != null) { sv.resource = GCHandle.Alloc(inlineValue.value.vectorImage); } else if (inlineValue.value.texture != null) { sv.resource = GCHandle.Alloc(inlineValue.value.texture); } else { sv.resource = new GCHandle(); } SetStyleValue(sv); if (inlineValue.keyword == StyleKeyword.Null) { sv.keyword = sharedValue.keyword; if (sharedValue.value.texture != null) { sv.resource = GCHandle.Alloc(sharedValue.value.texture); } else if (sharedValue.value.vectorImage != null) { sv.resource = GCHandle.Alloc(sharedValue.value.vectorImage); } else { sv.resource = new GCHandle(); } } ApplyStyleValue(sv); return(true); }
public override bool Equals(object obj) { bool flag = !(obj is StyleBackground); bool result; if (flag) { result = false; } else { StyleBackground lhs = (StyleBackground)obj; result = (lhs == this); } return(result); }
public StyleBackground GetStyleBackground(StylePropertyId id) { StyleValue styleValue = default(StyleValue); bool flag = this.TryGetStyleValue(id, ref styleValue); StyleBackground result; if (flag) { Texture2D v = styleValue.resource.IsAllocated ? (styleValue.resource.Target as Texture2D) : null; result = new StyleBackground(v, styleValue.keyword); } else { result = StyleKeyword.Null; } return(result); }
private bool SetInlineStyle(StylePropertyID id, StyleBackground inlineValue, StyleBackground sharedValue) { var sv = new StyleValue(); if (TryGetInlineStyleValue(id, ref sv)) { var texture = sv.resource.IsAllocated ? sv.resource.Target as Texture2D : null; if (texture == inlineValue.value.texture && sv.keyword == inlineValue.keyword) { return(false); } if (sv.resource.IsAllocated) { sv.resource.Free(); } } sv.id = id; sv.keyword = inlineValue.keyword; sv.resource = inlineValue.value.texture != null?GCHandle.Alloc(inlineValue.value.texture) : new GCHandle(); SetInlineStyle(sv); int specificity = StyleValueExtensions.InlineSpecificity; if (inlineValue.keyword == StyleKeyword.Null) { specificity = sharedValue.specificity; sv.keyword = sharedValue.keyword; sv.resource = sharedValue.value.texture != null?GCHandle.Alloc(sharedValue.value.texture) : new GCHandle(); } ApplyStyleValue(sv, specificity); return(true); }
public bool Equals(StyleBackground other) { return(other == this); }
internal StyleBackground(GCHandle gcHandle, StyleKeyword keyword) { this = new StyleBackground(gcHandle.IsAllocated ? Background.FromObject(gcHandle.Target) : default(Background), keyword); }
internal StyleBackground(VectorImage v, StyleKeyword keyword) { this = new StyleBackground(Background.FromVectorImage(v), keyword); }
internal StyleBackground(Texture2D v, StyleKeyword keyword) { this = new StyleBackground(Background.FromTexture2D(v), keyword); }
public StyleBackground(StyleKeyword keyword) { this = new StyleBackground(default(Background), keyword); }
public StyleBackground(VectorImage v) { this = new StyleBackground(v, StyleKeyword.Undefined); }
public StyleBackground(Texture2D v) { this = new StyleBackground(v, StyleKeyword.Undefined); }
public StyleBackground(Background v) { this = new StyleBackground(v, StyleKeyword.Undefined); }