private ColorDescriptor ColorFor(L4j level) { switch (level) { case L4j.Fatal: return(_fatal ?? (_fatal = _doc.createColor(Color.Red))); case L4j.Error: return(_error ?? (_error = _doc.createColor(Color.Red))); case L4j.Warn: return(_warn ?? (_warn = _doc.createColor(Color.Yellow))); case L4j.Info: return(_info ?? (_info = _doc.createColor(Color.White))); case L4j.Debug: return(_debug ?? (_debug = _doc.createColor(Color.DarkGray))); case L4j.Trace: return(_trace ?? (_trace = _doc.createColor(Color.SlateGray))); case L4j.Off: return(_off ?? (_off = _doc.createColor(Color.Transparent))); default: throw Error.Unsupported(level); } }
private System.Drawing.Color GetColor(ColorDescriptor colorDescriptor) { int r = colorDescriptor.R; int g = colorDescriptor.G; int b = colorDescriptor.B; return(System.Drawing.Color.FromArgb(r, g, b)); }
public ChartSeries Deserialize(byte[] bytes) { ChartSeries chartSeries = new ChartSeries() { Name = null, ColorDescriptor = null, Points = new List <ChartPoint>() }; //Name StringSerialization ss = new StringSerialization(); byte[] nameLengthBytes = new byte[TypeSizes.SIZE_INT]; Array.Copy(bytes, 0, nameLengthBytes, 0, TypeSizes.SIZE_INT); int length = BitConverter.ToInt32(nameLengthBytes, 0); byte[] nameBytes = new byte[length]; Array.Copy(bytes, TypeSizes.SIZE_INT, nameBytes, 0, length); string name = ss.Deserialize(nameBytes); int typeOffset = TypeSizes.SIZE_INT + nameBytes.Length; //Type byte[] typeBytes = new byte[TypeSizes.SIZE_SHORT]; Array.Copy(bytes, typeOffset, typeBytes, 0, TypeSizes.SIZE_SHORT); ChartSeriesType seriesType = (ChartSeriesType)BitConverter.ToInt16(typeBytes, 0); int colorOffset = typeOffset + TypeSizes.SIZE_SHORT; //Color ColorDescriptorSerialization cds = new ColorDescriptorSerialization(); byte[] colorBytes = new byte[cds.SizeInBytes]; Array.Copy(bytes, colorOffset, colorBytes, 0, cds.SizeInBytes); ColorDescriptor colorDescriptor = cds.Deserialize(colorBytes); //Points ChartPointSerialization cps = new ChartPointSerialization(); int offset = colorOffset + cds.SizeInBytes; while (offset < bytes.Count()) { byte[] pointBytes = new byte[cps.SizeInBytes]; Array.Copy(bytes, offset, pointBytes, 0, cps.SizeInBytes); ChartPoint point = cps.Deserialize(pointBytes); chartSeries.Points.Add(point); offset += cps.SizeInBytes; } chartSeries.Name = name; chartSeries.Type = seriesType; chartSeries.ColorDescriptor = colorDescriptor; return(chartSeries); }
public RtfChunkWriter(RtfDocument doc, Encoding encoding) { _doc = doc; _encoding = encoding; doc.DefaultCharFormat.FontSize = 10; _inFg = doc.createColor(new RtfColor(App.Current.Res.InboundFlowTextBrush.Color)); _inBg = doc.createColor(new RtfColor(App.Current.Res.InboundFlowBrush.Color)); _outFg = doc.createColor(new RtfColor(App.Current.Res.OutboundFlowTextBrush.Color)); _outBg = doc.createColor(new RtfColor(App.Current.Res.OutboundFlowBrush.Color)); }
static ParticleType _createPentagonType() { var type = new ParticleType(Polygon.Regular(5, 25), 75); type.BlendMode = BlendMode.Additive; type.AddDescriptors(new IParticleTypeDescriptor[] { ColorDescriptor.Uniform(), new InitialStateDescriptor().UniformRotation().UniformScale(1, 2), new TransformationDescriptor().UniformRotation(Angle.Deg(-3), Angle.Deg(3)).ConstantScaling(0.95), LinearMotionDescriptor.Uniform(5, 12), FadeoutDescriptor.Default, attractor }); return(type); }