private static void AssignRadialGradientTex(FillColor fillcolor, String assignedName, float gradLength, IndentedTextWriter writer) { for (int ii = 0; ii < fillcolor.colorList.Count; ii++) { Color curcol = fillcolor.colorList[ii]; FillColor.AssignColorRGBTex(curcol, "color" + ii.ToString(), writer); } Color firstcol = fillcolor.colorList[0]; writer.Write("\\pgfdeclareradialshading {{{4}}} {{\\pgfpoint{{{0}pt}}{{{1}pt}}}} {{color({2}pt)=({3})", (fillcolor.focalPoint.X - 50) * gradLength / 100f, //50% is center (50 - fillcolor.focalPoint.Y) * gradLength / 100f, fillcolor.positionList[0] * gradLength / 100f, "color0!" + AlphaValTex(firstcol), assignedName); for (int ii = 1; ii < fillcolor.colorList.Count; ii++) { Color curcol = fillcolor.colorList[ii]; writer.Write("; color({0}pt)=({1})", fillcolor.positionList[ii] * gradLength / 100f, "color" + ii.ToString() + AlphaValTex(curcol)); } writer.WriteLine("}"); }
private static void AssignLinearGradientTex(FillColor fillcolor, String assignedName, float gradwidth, float gradlength, IndentedTextWriter writer) { for (int ii = 0; ii < fillcolor.colorList.Count; ii++) { Color curcol = fillcolor.colorList[ii]; FillColor.AssignColorRGBTex(curcol, "color" + ii.ToString(), writer); } Color firstcol = fillcolor.colorList[0]; writer.Write("\\pgfdeclareverticalshading {{{3}}} {{ {0}pt }} {{color({1}pt)=({2})", gradwidth, fillcolor.positionList[0] * gradlength / 100f, "color0" + AlphaValTex(firstcol), assignedName); for (int ii = 1; ii < fillcolor.colorList.Count; ii++) { Color curcol = fillcolor.colorList[ii]; writer.Write("; color({0}pt)=({1})", fillcolor.positionList[ii] * gradlength / 100f, "color" + ii.ToString() + AlphaValTex(curcol)); } writer.WriteLine("}"); }
//private void DefineLineEndings(System.Collections.Generic.List<LineEnding> lineEndingDefs, RenderInformation rendinfo, IndentedTextWriter writer, Graphics g, double scale, Hashtable fontTeXTable) //{ // if (lineEndingDefs.Count > 0) // { // writer.WriteLine("% List of LineEndings used: "); // for (int ii = 0; ii < lineEndingDefs.Count; ii++) // { // LineEnding ending = lineEndingDefs[ii]; // writer.WriteLine("\\def \\{0} {{", ending.ID); // writer.Indent += 1; // SBMLExtension.LayoutExtension.GraphicalObject glyph = new SBMLExtension.LayoutExtension.GraphicalObject(); // RectangleF refbounds = new RectangleF(); // ending.Group.ToTex(glyph, writer, g, rendinfo, ending.Group, refbounds, scale, fontTeXTable); // writer.Indent -= 1; // writer.WriteLine("}"); // } // } //} private void DefineColorsAndGradients(List <ColorDefinition> ColorDefinitions, List <GradientDefinition> GradientDefinitions, RenderInformation rendinfo, IndentedTextWriter writer) { if (ColorDefinitions.Count > 0) { writer.WriteLine("% List of colors used: "); for (var ii = 0; ii < ColorDefinitions.Count; ii++) { var def = ColorDefinitions[ii]; var color = rendinfo.GetColor(def.ID); FillColor.AssignColorRGBTex(color, def.ID, writer); } writer.WriteLine(); } if (GradientDefinitions.Count > 0) { writer.WriteLine("% List of gradients used: "); for (var ii = 0; ii < GradientDefinitions.Count; ii++) { var def = GradientDefinitions[ii]; FillColor fill; if (def is LinearGradient) { var lindef = (LinearGradient)def; fill = lindef.GetLinearGradFillColor(rendinfo); FillColor.AssignGradientTex(fill, lindef.ID, writer); } else { var raddef = (RadialGradient)def; fill = raddef.GetRadialFillColor(rendinfo); FillColor.AssignGradientTex(fill, raddef.ID, writer); } writer.WriteLine(); } } }