public static void GradientTransparencies() { int num_cols = 1; int num_rows = 10; var color1 = new VAM.Color.ColorRgb(0xff000); var color2 = new VAM.Color.ColorRgb(0x000ff); var page_size = new VA.Geometry.Size(num_rows / 2.0, num_rows); var upperleft = new VA.Geometry.Point(0, page_size.Height); var page = SampleEnvironment.Application.ActiveDocument.Pages.Add(); var app = page.Application; var docs = app.Documents; var stencil = docs.OpenStencil("basic_U.vss"); var master = stencil.Masters["Rectangle"]; SampleEnvironment.SetPageSize(page, page_size); var layout = new VAM.Layouts.Grid.GridLayout(num_cols, num_rows, new VA.Geometry.Size(6.0, 1.0), master); layout.RowDirection = VAM.Layouts.Grid.RowDirection.TopToBottom; layout.Origin = upperleft; layout.CellSpacing = new VA.Geometry.Size(0.1, 0.1); layout.PerformLayout(); double[] trans = EffectsSamples.RangeSteps(0.0, 1.0, num_rows).ToArray(); int i = 0; foreach (var node in layout.Nodes) { double transparency = trans[i]; var fmt = new VAM.Dom.ShapeCells(); node.Cells = fmt; fmt.FillPattern = 25; // Linear pattern left to right fmt.FillForeground = color1.ToFormula(); fmt.FillBackground = color2.ToFormula(); fmt.FillForegroundTransparency = 0; fmt.FillBackgroundTransparency = transparency; fmt.LinePattern = 0; node.Text = string.Format("bg trans = {0}%", transparency); i++; } layout.Render(page); page.ResizeToFitContents(); }
public static void FontGlyphComparision(IVisio.Document doc, string[] fontnames, List <string> samplechars) { var layout = new VAM.Layouts.Box.BoxLayout(); var root = new VAM.Layouts.Box.Container(VAM.Layouts.Box.Direction.TopToBottom); layout.Root = root; root.ChildSpacing = 0.5; var nodedata = new NodeData(); nodedata.Render = false; root.Data = nodedata; var fontname_cells = new VAM.Dom.ShapeCells(); fontname_cells.FillPattern = 0; fontname_cells.LinePattern = 0; fontname_cells.LineWeight = 0.0; fontname_cells.ParaHorizontalAlign = 0; fontname_cells.CharSize = "36pt"; var charbox_cells = new VAM.Dom.ShapeCells(); charbox_cells.FillPattern = 0; charbox_cells.LinePattern = 1; charbox_cells.LineWeight = 0.0; charbox_cells.LineColor = "rgb(150,150,150)"; charbox_cells.ParaHorizontalAlign = 1; charbox_cells.CharSize = "24pt"; foreach (string fontname in fontnames) { var fontname_box = root.AddNodeEx(5, 0.5, fontname); var fontname_box_data = (NodeData)fontname_box.Data; fontname_box_data.Cells = fontname_cells; var font_box = root.AddContainer(VAM.Layouts.Box.Direction.TopToBottom); font_box.ChildSpacing = 0.25; var font_vox_data = (NodeData)font_box.Data; if (font_vox_data != null) { font_vox_data.Render = false; } int numcols = 17; int numrows = 5; int numcells = numcols * numrows; foreach (int row in Enumerable.Range(0, numrows)) { var row_box = font_box.AddContainer(VAM.Layouts.Box.Direction.LeftToRight); row_box.ChildSpacing = 0.25; var row_box_data = new NodeData(); row_box_data.Render = false; row_box.Data = row_box_data; foreach (int col in Enumerable.Range(0, numcols)) { int charindex = (col + (numcols * row)) % numcells; string curchar = samplechars[charindex]; var cell_box = row_box.AddNodeEx(0.50, 0.50, curchar); var cell_box_data = (NodeData)cell_box.Data; cell_box_data.Font = fontname; cell_box_data.Cells = charbox_cells; } } } layout.PerformLayout(); var page = doc.Pages.Add(); var domshapescol = new VAM.Dom.ShapeList(); foreach (var node in layout.Nodes) { if (node.Data == null) { continue; } var node_data = (NodeData)node.Data; if (node_data.Render == false) { continue; } var shape_node = domshapescol.Drop("Rectangle", "basic_u.vss", node.Rectangle); var cells = node_data.Cells; if (cells == null) { cells = new VAM.Dom.ShapeCells(); } else { cells = node_data.Cells.ShallowCopy(); } if (node_data.Font != null) { shape_node.CharFontName = node_data.Font; } shape_node.Cells = cells; shape_node.Text = new VAM.Text.Element(node_data.Text); } domshapescol.Render(page); var bordersize = new VA.Geometry.Size(0.5, 0.5); page.ResizeToFitContents(bordersize); }
public NodeData() { this.Render = true; this.Cells = new VAM.Dom.ShapeCells(); }