private Color getColor(DynVal dv) { if (dv == null) { return(Color.black); } int r = (int)(double)dv.FindDynVal("Rd").Value; int g = (int)(double)dv.FindDynVal("Grn").Value; int b = (int)(double)dv.FindDynVal("Bl").Value; return(Util.FromArgb(r, g, b)); }
public DynVal FindDynVal(string fourccName) { if (fourccName.Equals(Name)) { return(this); } if (Children != null) { for (int i = 0, max = Children.Count; i < max; i++) { DynVal child = Children[i]; DynVal _dyn = child.FindDynVal(fourccName); if (_dyn != null) { return(_dyn); } } } if (this.Value is Dictionary <string, object> ) { Dictionary <string, object> dynDic = (Dictionary <string, object>) this.Value; foreach (object p in dynDic.Values) { if (p is DynVal) { DynVal _dyn = ((DynVal)p).FindDynVal(fourccName); if (_dyn != null) { return(_dyn); } } } } if (this.Value is List <object> ) { List <object> vs = (List <object>) this.Value; for (int i = 0; i < vs.Count; i++) { if (vs[i] is DynVal) { DynVal _dyn = ((DynVal)vs[i]).FindDynVal(fourccName); if (_dyn != null) { return(_dyn); } } } } if (this.Value is DynVal) { return(((DynVal)Value).FindDynVal(fourccName)); } return(null); }
public ObjectBasedEffect(PsdBinaryReader reader, int dataLength) { uint version = reader.ReadUInt32(); uint descriptorVersion = reader.ReadUInt32(); Descriptor = DynVal.ReadDescriptor(reader); DynVal grad = Descriptor.FindDynVal("Grad"); if (grad != null) { Gradient = new GradientEffect(); Gradient.ParseDescriptor(grad); } }
public void ParseDescriptor(DynVal gradDyn) { DynVal cols = gradDyn.FindDynVal("Clrs"); parseColors(cols); }