public IVisio.Shape AddShape(TextBlock block) { // Remember this Block this.Blocks.Add(block); // Calculate the Correct Full Rectangle var ll = new Drawing.Point(this.InsertionPoint.X, this.InsertionPoint.Y - block.Size.Height); var tr = new Drawing.Point(this.InsertionPoint.X + block.Size.Width, this.InsertionPoint.Y); var rect = new Drawing.Rectangle(ll, tr); // Draw the Shape var newshape = this._page.DrawRectangle(rect); block.VisioShape = newshape; block.VisioShapeID = newshape.ID; block.Rectangle = rect; // Handle Text If Needed if (block.Text != null) { newshape.Text = block.Text; } this.AdjustInsertionPoint(block.Size); return(newshape); }
public static IVisio.Shape DrawRectangle(this IVisio.Page page, Drawing.Rectangle rect) { var surface = new Drawing.DrawingSurface(page); var shape = surface.DrawRectangle(rect); return(shape); }
private static void SetViewRectToSelection(IVisio.Window window, IVisio.VisBoundingBoxArgs bbargs, double padding_scale) { if (padding_scale < 0.0) { throw new System.ArgumentOutOfRangeException(nameof(padding_scale)); } if (padding_scale > 1.0) { throw new System.ArgumentOutOfRangeException(nameof(padding_scale)); } var app = window.Application; var active_window = app.ActiveWindow; var sel = active_window.Selection; var sel_bb = sel.GetBoundingBox(bbargs); var delta = sel_bb.Size * padding_scale; var view_rect = new Drawing.Rectangle(sel_bb.Left - delta.Width, sel_bb.Bottom - delta.Height, sel_bb.Right + delta.Height, sel_bb.Top + delta.Height); window.SetViewRect(view_rect); }
private static double GetSide(Drawing.Rectangle r, LayoutDirection direction) { switch (direction) { case (LayoutDirection.Up): { return(r.Top); } case (LayoutDirection.Down): { return(r.Bottom); } case (LayoutDirection.Left): { return(r.Left); } case (LayoutDirection.Right): { return(r.Right); } default: { throw new System.ArgumentOutOfRangeException(); } } }
public static Drawing.Rectangle GetBoundingBox(this IVisio.Selection selection, IVisio.VisBoundingBoxArgs args) { double bbx0, bby0, bbx1, bby1; selection.BoundingBox((short) args, out bbx0, out bby0, out bbx1, out bby1); var r = new Drawing.Rectangle(bbx0, bby0, bbx1, bby1); return r; }
public IVisio.Shape RenderPie(IVisio.Page page) { if (this.Angle == 0.0) { var p1 = this.GetPointAtRadius(this.Center, this.Radius, this.SectorStartAngle); return(page.DrawLine(this.Center, p1)); } else if (this.Angle >= 2 * System.Math.PI) { var A = this.Center.Add(-this.Radius, -this.Radius); var B = this.Center.Add(this.Radius, this.Radius); var rect = new Drawing.Rectangle(A, B); var shape = page.DrawOval(rect); return(shape); } else { int degree; var pie_bez = this.GetShapeBezierForPie(out degree); // Render the bezier var doubles_array = Drawing.Point.ToDoubles(pie_bez).ToArray(); var pie_slice = page.DrawBezier(doubles_array, (short)degree, 0); return(pie_slice); } }
public Oval DrawOval(Drawing.Rectangle r) { var oval = new Oval(r); this.Add(oval); return(oval); }
public static void SetViewRect( Microsoft.Office.Interop.Visio.Window window, Drawing.Rectangle rect) { // MSDN: http://msdn.microsoft.com/en-us/library/office/ms367542(v=office.14).aspx window.SetViewRect(rect.Left, rect.Top, rect.Width, rect.Height); }
public override void AddTabBorder(Drawing.Drawing2D.GraphicsPath path, Drawing.Rectangle tabBounds) { switch (tabControl.Alignment) { case TabAlignment.Top: path.AddLine(tabBounds.X, tabBounds.Bottom, tabBounds.X, tabBounds.Y); path.AddLine(tabBounds.X, tabBounds.Y, tabBounds.Right, tabBounds.Y); path.AddLine(tabBounds.Right, tabBounds.Y, tabBounds.Right, tabBounds.Bottom); break; case TabAlignment.Bottom: path.AddLine(tabBounds.Right, tabBounds.Y, tabBounds.Right, tabBounds.Bottom); path.AddLine(tabBounds.Right, tabBounds.Bottom, tabBounds.X, tabBounds.Bottom); path.AddLine(tabBounds.X, tabBounds.Bottom, tabBounds.X, tabBounds.Y); break; case TabAlignment.Left: path.AddLine(tabBounds.Right, tabBounds.Bottom, tabBounds.X, tabBounds.Bottom); path.AddLine(tabBounds.X, tabBounds.Bottom, tabBounds.X, tabBounds.Y); path.AddLine(tabBounds.X, tabBounds.Y, tabBounds.Right, tabBounds.Y); break; case TabAlignment.Right: path.AddLine(tabBounds.X, tabBounds.Y, tabBounds.Right, tabBounds.Y); path.AddLine(tabBounds.Right, tabBounds.Y, tabBounds.Right, tabBounds.Bottom); path.AddLine(tabBounds.Right, tabBounds.Bottom, tabBounds.X, tabBounds.Bottom); break; } }
public IVisio.Shape AddShape(TextBlock block) { // Remember this Block this.Blocks.Add(block); // Calculate the Correct Full Rectangle var ll = new Drawing.Point(this.InsertionPoint.X, this.InsertionPoint.Y - block.Size.Height); var tr = new Drawing.Point(this.InsertionPoint.X + block.Size.Width, this.InsertionPoint.Y); var rect = new Drawing.Rectangle(ll, tr); // Draw the Shape var newshape = this.page.DrawRectangle(rect); block.VisioShape = newshape; block.VisioShapeID = newshape.ID; block.Rectangle = rect; // Handle Text If Needed if (block.Text != null) { newshape.Text = block.Text; } this.AdjustInsertionPoint(block.Size); return newshape; }
public Rectangle DrawRectangle(Drawing.Rectangle r) { var rectangle = new Rectangle(r); this.Add(rectangle); return(rectangle); }
public Shape Drop(string master, string stencil, Drawing.Rectangle rect) { var m = new Shape(master, stencil, rect); this.Add(m); return(m); }
public void Form_DpiChanged_Bounds(int newDpi) { // Run tests only on Windows 10 versions that support thread dpi awareness. if (!PlatformDetection.IsWindows10Version1803OrGreater) { return; } IntPtr originalAwarenessContext = User32.SetThreadDpiAwarenessContext(User32.DPI_AWARENESS_CONTEXT.PER_MONITOR_AWARE_V2); try { using var form = new Form(); form.AutoScaleMode = AutoScaleMode.Dpi; form.Show(); Drawing.Rectangle initialBounds = form.Bounds; float initialFontSize = form.Font.Size; DpiMessageHelper.TriggerDpiMessage(User32.WM.DPICHANGED, form, newDpi); var factor = newDpi / DpiHelper.LogicalDpi; // Lab machines giving strange values that I could not explain. for ex: on local machine, // I get 1050*1050 for factor 3.5. This is not same on lab machines ( ex, we get 1044). For now, // just verifying they are scaled. Assert.NotEqual(initialBounds.Width, form.Bounds.Width); Assert.NotEqual(initialBounds.Height, form.Bounds.Height); Assert.NotEqual(initialFontSize, form.Font.Size); form.Close(); } finally { // Reset back to original awareness context. User32.SetThreadDpiAwarenessContext(originalAwarenessContext); } }
public static Drawing.Rectangle GetBoundingBox(this IVisio.Master master, IVisio.VisBoundingBoxArgs args) { // MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vissdk11/html/vimthBoundingBox_HV81900422.asp double bbx0, bby0, bbx1, bby1; master.BoundingBox((short) args, out bbx0, out bby0, out bbx1, out bby1); var r = new Drawing.Rectangle(bbx0, bby0, bbx1, bby1); return r; }
public PieChart(Drawing.Rectangle rect) { var center = rect.Center; var radius = System.Math.Min(rect.Width, rect.Height) / 2.0; this.DataPoints = new DataPointList(); this.Center = center; this.Radius = radius; }
public static Drawing.Rectangle GetBoundingBox(IVisio.Selection selection, IVisio.VisBoundingBoxArgs args) { double bbx0, bby0, bbx1, bby1; selection.BoundingBox((short)args, out bbx0, out bby0, out bbx1, out bby1); var r = new Drawing.Rectangle(bbx0, bby0, bbx1, bby1); return(r); }
public static Drawing.Rectangle GetBoundingBox(this IVisio.Master master, IVisio.VisBoundingBoxArgs args) { // MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vissdk11/html/vimthBoundingBox_HV81900422.asp double bbx0, bby0, bbx1, bby1; master.BoundingBox((short)args, out bbx0, out bby0, out bbx1, out bby1); var r = new Drawing.Rectangle(bbx0, bby0, bbx1, bby1); return(r); }
public IVisio.Shape Oval(double x0, double y0, double x1, double y1) { var surface = this.GetDrawingSurface(); var rect = new Drawing.Rectangle(x0, y0, x1, y1); var application = this._client.Application.Get(); using (var undoscope = this._client.Application.NewUndoScope("Draw Oval")) { var shape = surface.DrawOval(rect); return(shape); } }
public static Drawing.Rectangle GetViewRect(this IVisio.Window window) { // MSDN: http://msdn.microsoft.com/en-us/library/office/ff765846.aspx double left, top, height, width; window.GetViewRect(out left, out top, out width, out height); double x0 = left; double x1 = left + width; double y0 = top - height; double y1 = y0 + height; var r = new Drawing.Rectangle(x0, y0, x1, y1); return r; }
public static Drawing.Rectangle GetViewRect(IVisio.Window window) { // MSDN: http://msdn.microsoft.com/en-us/library/office/ff765846.aspx double left, top, height, width; window.GetViewRect(out left, out top, out width, out height); double x0 = left; double x1 = left + width; double y0 = top - height; double y1 = y0 + height; var r = new Drawing.Rectangle(x0, y0, x1, y1); return(r); }
public IVisio.Shape RenderDoughnut(IVisio.Page page) { double total_angle = this.Angle; if (total_angle == 0.0) { var p1 = this.GetPointAtRadius(this.Center, this.SectorStartAngle, this.InnerRadius); var p2 = this.GetPointAtRadius(this.Center, this.SectorStartAngle, this.Radius); var shape = page.DrawLine(p1, p2); return(shape); } else if (total_angle >= System.Math.PI) { var outer_radius_point = new Drawing.Point(this.Radius, this.Radius); var C = this.Center - outer_radius_point; var D = this.Center + outer_radius_point; var outer_rect = new Drawing.Rectangle(C, D); var inner_radius_point = new Drawing.Point(this.InnerRadius, this.InnerRadius); var A = this.Center - inner_radius_point - C; var B = this.Center + inner_radius_point - C; var inner_rect = new Drawing.Rectangle(A, B); var shape = page.DrawOval(outer_rect); shape.DrawOval(inner_rect.Left, inner_rect.Bottom, inner_rect.Right, inner_rect.Top); return(shape); } else { int degree; var thickarc = this.GetShapeBezierForDoughnut(out degree); // Render the bezier var doubles_array = Drawing.Point.ToDoubles(thickarc).ToArray(); var pie_slice = page.DrawBezier(doubles_array, (short)degree, 0); return(pie_slice); } }
private static void SetViewRectToSelection(IVisio.Window window, IVisio.VisBoundingBoxArgs bbargs, double padding_scale) { if (padding_scale < 0.0) { throw new System.ArgumentOutOfRangeException(nameof(padding_scale)); } if (padding_scale > 1.0) { throw new System.ArgumentOutOfRangeException(nameof(padding_scale)); } var app = window.Application; var active_window = app.ActiveWindow; var sel = active_window.Selection; var sel_bb = sel.GetBoundingBox(bbargs); var delta = sel_bb.Size*padding_scale; var view_rect = new Drawing.Rectangle(sel_bb.Left - delta.Width, sel_bb.Bottom - delta.Height, sel_bb.Right + delta.Height, sel_bb.Top + delta.Height); window.SetViewRect(view_rect); }
public IVisio.Shape Oval(double x0, double y0, double x1, double y1) { var surface = this.GetDrawingSurface(); var rect = new Drawing.Rectangle(x0, y0, x1, y1); var application = this.Client.Application.Get(); using (var undoscope = this.Client.Application.NewUndoScope("Draw Oval")) { var shape = surface.DrawOval(rect); return shape; } }
public BarChart(Drawing.Rectangle rect) { this.Rectangle = rect; this.DataPoints = new DataPointList(); }
public IVisio.Shape Oval(double x0, double y0, double x1, double y1) { var rect = new Drawing.Rectangle(x0, y0, x1, y1); return(this.Oval(rect)); }
public void PerformLayout() { var max_rows = this.Containers.Select(c => c.ContainerItems.Count).Max(); var col_indexes = Enumerable.Range(0, this.Containers.Count); var row_indexes = Enumerable.Range(0, max_rows); var col_lefts = col_indexes.Select(i => i * (this.LayoutOptions.ItemWidth + this.LayoutOptions.ContainerHorizontalDistance + (2 * this.LayoutOptions.Padding))).ToList(); var col_rights = col_lefts.Select(x => x + this.LayoutOptions.ItemWidth).ToList(); var row_tops = row_indexes.Select(i => i * -(this.LayoutOptions.ItemHeight + this.LayoutOptions.ItemVerticalSpacing)).ToList(); var row_bottoms = row_tops.Select(y => y - this.LayoutOptions.ItemHeight).ToList(); for (int container = 0; container < this.Containers.Count; container++) { var ct = this.Containers[container]; for (int ri = 0; ri < ct.ContainerItems.Count; ri++) { double left = col_lefts[container]; double right = col_rights[container]; double top = row_tops[ri]; double bottom = row_bottoms[ri]; var rect = new Drawing.Rectangle(left, bottom, right, top); var item = ct.ContainerItems[ri]; item.Rectangle = rect; } } int ctn = 0; foreach (var ct in this.Containers) { if (ct.ContainerItems.Count < 1) { double top = this.LayoutOptions.Padding + this.LayoutOptions.ContainerHeaderHeight; double bottom = top - this.LayoutOptions.ContainerHeaderHeight - this.LayoutOptions.Padding; ct.Rectangle = new Drawing.Rectangle(col_lefts[ctn], bottom, col_rights[ctn], top); } else { double max_top = ct.ContainerItems.Select(i => i.Rectangle.Top).Max(); double max_right = ct.ContainerItems.Select(i => i.Rectangle.Right).Max(); double min_bottom = ct.ContainerItems.Select(i => i.Rectangle.Bottom).Min(); double min_left = ct.ContainerItems.Select(i => i.Rectangle.Left).Min(); max_top += this.LayoutOptions.Padding + this.LayoutOptions.ContainerHeaderHeight; max_right += this.LayoutOptions.Padding; min_left -= this.LayoutOptions.Padding; min_bottom -= this.LayoutOptions.Padding; ct.Rectangle = new Drawing.Rectangle(min_left, min_bottom, max_right, max_top); } ctn++; } this.IsLayedOut = true; }
public void PerformLayout() { var max_rows = this.Containers.Select(c => c.ContainerItems.Count).Max(); var col_indexes = Enumerable.Range(0, this.Containers.Count); var row_indexes = Enumerable.Range(0, max_rows); var col_lefts = col_indexes.Select(i => i * (this.LayoutOptions.ItemWidth + this.LayoutOptions.ContainerHorizontalDistance + (2 * this.LayoutOptions.Padding))).ToList(); var col_rights = col_lefts.Select(x => x + this.LayoutOptions.ItemWidth).ToList(); var row_tops = row_indexes.Select(i => i * -(this.LayoutOptions.ItemHeight + this.LayoutOptions.ItemVerticalSpacing)).ToList(); var row_bottoms = row_tops.Select(y => y - this.LayoutOptions.ItemHeight).ToList(); for (int container = 0; container< this.Containers.Count; container++) { var ct = this.Containers[container]; for (int ri=0;ri<ct.ContainerItems.Count;ri++) { double left = col_lefts[container]; double right = col_rights[container]; double top = row_tops[ri]; double bottom = row_bottoms[ri]; var rect = new Drawing.Rectangle(left, bottom, right, top); var item = ct.ContainerItems[ri]; item.Rectangle = rect; } } int ctn = 0; foreach (var ct in this.Containers) { if (ct.ContainerItems.Count < 1) { double top = this.LayoutOptions.Padding + this.LayoutOptions.ContainerHeaderHeight; double bottom = top - this.LayoutOptions.ContainerHeaderHeight - this.LayoutOptions.Padding; ct.Rectangle = new Drawing.Rectangle(col_lefts[ctn], bottom, col_rights[ctn], top); } else { double max_top = ct.ContainerItems.Select(i => i.Rectangle.Top).Max(); double max_right = ct.ContainerItems.Select(i => i.Rectangle.Right).Max(); double min_bottom = ct.ContainerItems.Select(i => i.Rectangle.Bottom).Min(); double min_left = ct.ContainerItems.Select(i => i.Rectangle.Left).Min(); max_top += this.LayoutOptions.Padding + this.LayoutOptions.ContainerHeaderHeight; max_right += this.LayoutOptions.Padding; min_left -= this.LayoutOptions.Padding; min_bottom -= this.LayoutOptions.Padding; ct.Rectangle = new Drawing.Rectangle(min_left, min_bottom, max_right, max_top); } ctn++; } this.IsLayedOut = true; }
public RECT(Drawing.Rectangle rectangle) { left = rectangle.Left; top = rectangle.Top; right = rectangle.Right; bottom = rectangle.Bottom; }
public IVisio.Shape RenderDoughnut(IVisio.Page page) { double total_angle = this.Angle; if (total_angle == 0.0) { var p1 = this.GetPointAtRadius(this.Center, this.SectorStartAngle, this.InnerRadius); var p2 = this.GetPointAtRadius(this.Center, this.SectorStartAngle, this.Radius); var shape = page.DrawLine(p1, p2); return shape; } else if (total_angle >= System.Math.PI) { var outer_radius_point = new Drawing.Point(this.Radius, this.Radius); var C = this.Center - outer_radius_point; var D = this.Center + outer_radius_point; var outer_rect = new Drawing.Rectangle(C, D); var inner_radius_point = new Drawing.Point(this.InnerRadius, this.InnerRadius); var A = this.Center - inner_radius_point - C; var B = this.Center + inner_radius_point - C; var inner_rect = new Drawing.Rectangle(A, B); var shape = page.DrawOval(outer_rect); shape.DrawOval(inner_rect.Left, inner_rect.Bottom, inner_rect.Right, inner_rect.Top); return shape; } else { int degree; var thickarc = this.GetShapeBezierForDoughnut(out degree); // Render the bezier var doubles_array = Drawing.Point.ToDoubles(thickarc).ToArray(); var pie_slice = page.DrawBezier(doubles_array, (short)degree, 0); return pie_slice; } }
public void Render(IVisio.Page page) { this.TotalMarginWidth = this.Rectangle.Width * (0.10); this.TotalBarSpacingWidth = this.Rectangle.Width * (0.10); this.TotalBarWidth = this.Rectangle.Width * (0.80); int num_points = this.DataPoints.Count; double bar_spacing = num_points > 1 ? this.TotalBarSpacingWidth / num_points : 0.0; double bar_width = num_points > 0 ? this.TotalBarWidth / num_points : this.TotalBarWidth; double cur_x = this.Rectangle.Left + (this.TotalMarginWidth / 2.0); double max = this.DataPoints.Select(i => i.Value).Max(); double min = this.DataPoints.Select(i => i.Value).Min(); var range = ChartUtil.GetValueRangeDistance(min, max); double base_y = this.Rectangle.Bottom; if (min < 0.0) { base_y += System.Math.Abs(this.Rectangle.Height * (min / range)); } var category_axis_start_point = new Drawing.Point(this.Rectangle.Left, base_y); var category_axis_end_point = new Drawing.Point(this.Rectangle.Right, base_y); var category_axis_shape = page.DrawLine(category_axis_start_point, category_axis_end_point); foreach (var p in this.DataPoints) { var value_height = System.Math.Abs(this.Rectangle.Height * (p.Value / range)); Drawing.Point bar_p0; Drawing.Point bar_p1; if (p.Value >= 0.0) { bar_p0 = new Drawing.Point(cur_x, base_y); bar_p1 = new Drawing.Point(cur_x + bar_width, base_y + value_height); } else { bar_p0 = new Drawing.Point(cur_x, base_y - value_height); bar_p1 = new Drawing.Point(cur_x + bar_width, base_y); } var bar_rect = new Drawing.Rectangle(bar_p0, bar_p1); var shape = page.DrawRectangle(bar_rect); p.VisioShape = shape; if (p.Label != null) { shape.Text = p.Label; } cur_x += bar_width + bar_spacing; } var allshapes = this.DataPoints.Select(dp => dp.VisioShape).Where(s => s != null).ToList(); allshapes.Add(category_axis_shape); ChartUtil.GroupShapesIfNeeded(page, allshapes); }
public Oval(Drawing.Rectangle r0) { this.P0 = r0.LowerLeft; this.P1 = r0.UpperRight; }
public IVisio.Shape RenderPie( IVisio.Page page) { if (this.Angle == 0.0) { var p1 = this.GetPointAtRadius(this.Center, this.Radius, this.SectorStartAngle); return page.DrawLine(this.Center, p1); } else if (this.Angle >= 2*System.Math.PI) { var A = this.Center.Add(-this.Radius, -this.Radius); var B = this.Center.Add(this.Radius, this.Radius); var rect = new Drawing.Rectangle(A, B); var shape = page.DrawOval(rect); return shape; } else { int degree; var pie_bez = this.GetShapeBezierForPie(out degree); // Render the bezier var doubles_array = Drawing.Point.ToDoubles(pie_bez).ToArray(); var pie_slice = page.DrawBezier(doubles_array, (short)degree, 0); return pie_slice; } }
public static IVisio.Shape DrawRectangle(this IVisio.Page page, Drawing.Rectangle rect) { return(VA.Pages.PageHelper.DrawRectangle(page, rect)); }
public static void SetViewRect( this IVisio.Window window, Drawing.Rectangle rect) { VisioAutomation.Windows.WindowHelper.SetViewRect(window, rect); }
public static IVisio.Shape DrawOval(this IVisio.Page page, Drawing.Rectangle rect) { return(VisioAutomation.Pages.PageHelper.DrawOval(page, rect)); }
public static CpuBlit.MemBitmap CreateMaskBitmap(this ReconstructedRegionData rgnData, Drawing.Color solidPartColor, Drawing.Color holeColor, bool useFitBounds = true) { //1. find size of membitmap Drawing.Rectangle fitBounds = rgnData.GetBounds(); //2. fit bounds or not int bmpW, bmpH, offsetX, offsetY; if (useFitBounds) { bmpW = fitBounds.Width; bmpH = fitBounds.Height; offsetX = -fitBounds.X; offsetY = -fitBounds.Y; } else { bmpW = fitBounds.Left + fitBounds.Right; bmpH = fitBounds.Top + fitBounds.Height; offsetX = 0; offsetY = 0; } //3. create mask bmp MemBitmap maskBmp = new MemBitmap(bmpW, bmpH); //4. fill mask data maskBmp.Clear(solidPartColor); int holdColorInt32 = (holeColor.A << CO.A_SHIFT) | (holeColor.B << CO.B_SHIFT) | (holeColor.G << CO.G_SHIFT) | (holeColor.R << CO.R_SHIFT); var memPtr = MemBitmap.GetBufferPtr(maskBmp); unsafe { int *buffer = (int *)memPtr.Ptr; //fill HSpan[] hspans = rgnData.HSpans; if (useFitBounds) { int totalBufferLen = bmpW * bmpH; for (int i = 0; i < hspans.Length; ++i) { HSpan span = hspans[i]; int len = span.endX - span.startX; #if DEBUG int offset = ((span.y + offsetY) * bmpW + (span.startX + offsetX)); if (offset >= totalBufferLen || offset + len > totalBufferLen) { throw new System.Exception("out-of-range"); break; } else if (offset < 0 || offset + len < 0) { } #endif int *pixAddr = buffer + ((span.y + offsetY) * bmpW + (span.startX + offsetX)); //with offsetX,offsetY for (int n = len - 1; n >= 0; --n) { *pixAddr = holdColorInt32; pixAddr++; } } } else { for (int i = 0; i < hspans.Length; ++i) { HSpan span = hspans[i]; int len = span.endX - span.startX; int *pixAddr = buffer + ((span.y) * bmpW + (span.startX)); //no offsetX,offsetY for (int n = len - 1; n >= 0; --n) { *pixAddr = holdColorInt32; pixAddr++; } } } } //return null; return(maskBmp); }
/// <summary> /// draw glyph image with transparent /// </summary> /// <param name="bmp"></param> /// <param name="x"></param> /// <param name="y"></param> public void DrawGlyphImageWithSubPixelRenderingTechnique(GLBitmap bmp, float x, float y) { PixelFarm.Drawing.Rectangle r = new Drawing.Rectangle(0, bmp.Height, bmp.Width, bmp.Height); DrawGlyphImageWithSubPixelRenderingTechnique(bmp, ref r, x, y, 1); }
public void Render(IVisio.Page page) { this.TotalMarginWidth = this.Rectangle.Width*(0.10); this.TotalBarSpacingWidth = this.Rectangle.Width * (0.10); this.TotalBarWidth = this.Rectangle.Width*(0.80); int num_points = this.DataPoints.Count; double bar_spacing = num_points > 1 ? this.TotalBarSpacingWidth/num_points : 0.0; double bar_width = num_points > 0 ? this.TotalBarWidth/num_points : this.TotalBarWidth; double cur_x = this.Rectangle.Left + (this.TotalMarginWidth/2.0); double max = this.DataPoints.Select(i => i.Value).Max(); double min = this.DataPoints.Select(i => i.Value).Min(); var range = ChartUtil.GetValueRangeDistance(min, max); double base_y = this.Rectangle.Bottom; if (min < 0.0) { base_y += System.Math.Abs(this.Rectangle.Height * (min / range)); } var category_axis_start_point = new Drawing.Point(this.Rectangle.Left, base_y); var category_axis_end_point = new Drawing.Point(this.Rectangle.Right, base_y); var category_axis_shape = page.DrawLine(category_axis_start_point, category_axis_end_point); foreach (var p in this.DataPoints) { var value_height = System.Math.Abs(this.Rectangle.Height*(p.Value/range)); Drawing.Point bar_p0; Drawing.Point bar_p1; if (p.Value >= 0.0) { bar_p0 = new Drawing.Point(cur_x, base_y); bar_p1 = new Drawing.Point(cur_x + bar_width, base_y + value_height); } else { bar_p0 = new Drawing.Point(cur_x, base_y - value_height); bar_p1 = new Drawing.Point(cur_x + bar_width, base_y); } var bar_rect = new Drawing.Rectangle(bar_p0, bar_p1); var shape = page.DrawRectangle(bar_rect); p.VisioShape = shape; if (p.Label != null) { shape.Text = p.Label; } cur_x += bar_width + bar_spacing; } var allshapes = this.DataPoints.Select(dp => dp.VisioShape).Where(s => s != null).ToList(); allshapes.Add(category_axis_shape); ChartUtil.GroupShapesIfNeeded(page, allshapes); }
public Shape(string mastername, string stencilname, Drawing.Rectangle rect) { this.Master = new MasterRef(mastername, stencilname); this.DropPosition = rect.Center; this.DropSize = rect.Size; }
public Shape(IVisio.Master master, Drawing.Rectangle rect) { this.Master = new MasterRef(master); this.DropPosition = rect.Center; this.DropSize = rect.Size; }