/// <summary> /// Determines whether a particular border exists. /// </summary> public bool HasBorder(BorderType type) { if (!Enum.IsDefined(typeof(BorderType), type)) throw new InvalidEnumArgumentException("type"); return this.GetBorder(type) != null; }
internal XUnit GetWidth(BorderType type) { if (this.borders == null) return 0; return borders.GetEffectiveWidth(type); }
public Border(BorderType left, BorderType right, BorderType top, BorderType bottom) { Left = left; Right = right; Top = top; Bottom = bottom; }
/// <summary> /// Determines whether a particular border exists. /// </summary> public bool HasBorder(BorderType type) { if (!Enum.IsDefined(typeof(BorderType), type)) throw new InvalidEnumArgumentException("type"); return !(this.IsNull(type.ToString())); }
/// <summary> /// Determines whether a particular border exists. /// </summary> public bool HasBorder(BorderType type) { if (!Enum.IsDefined(typeof(BorderType), type)) throw new /*InvalidEnum*/ArgumentException(DomSR.InvalidEnumValue(type), "type"); return GetBorderReadOnly(type) != null; }
public SpeechBubbleShape( Vector2f dimension, float radius, float outlineThickness, Color backgroundColor, Color outlineColor, Boolean tipMode = false, BorderType tipBorderType = DEFAULT_TIP_BORDER_TYPE, Boolean shadowMode = false, float shadowOffset = DEFAULT_SHADOW_OFFSET, float tipPosition = DEFAULT_TIP_POSITION, float tipSize = DEFAULT_TIP_SIZE) { Background = new Shape(); Background.EnableFill(true); Background.EnableOutline(true); Tip = new Shape(); Tip.EnableFill(true); Effect = new Shape(); Effect.EnableFill(true); Effect.EnableOutline(true); EffectTip = new Shape(); ShadowEffect = new Shape(); ShadowEffect.EnableFill(true); ShadowEffect.EnableOutline(true); ShadowEffectTip = new Shape(); ShadowEffectTip.EnableFill(true); ShadowEffectTip.EnableOutline(false); Dimension = dimension; ShadowMode = shadowMode; ShadowOffset = new Vector2f(shadowOffset, shadowOffset); Radius = radius; OutlineThickness = outlineThickness; AdjustSize(); TipMode = tipMode; TipBorderType = tipBorderType; BackgroundColor = backgroundColor; BackgroundColor.A = BACKGROUND_COLOR_ALPHA; OutlineColor = outlineColor; OutlineColor.A = BACKGROUND_COLOR_ALPHA; Background.OutlineThickness = OutlineThickness; Effect.OutlineThickness = OutlineThickness; ShadowEffect.OutlineThickness = OutlineThickness; TipPosition = tipPosition; TipSize = tipSize; Build(); }
public Window(WindowManager _WM,State _parentState, int _X,int _Y, int _SizeX, int _SizeY,string _Title,BorderType Btype) : base(_X,_Y,_SizeX,_SizeY,_WM) { bordType = Btype; ParentState = _parentState; Widgets = new List<Widget>(); GenerateBorder(); Title = new Text(_Title, WM.font); SetSize(_SizeX, _SizeY); SetPosition(_X, _Y); }
private BorderStyle GetStyle(BorderType type) { BorderStyle style = BorderStyle.Single; Border border = GetBorder(type); if (border != null && !border._style.IsNull) style = border.Style; else if (!_borders._style.IsNull) style = _borders.Style; return style; }
/// <summary> /// Forms a border around the image /// </summary> /// <param name="src">The source image</param> /// <param name="dst">The destination image; will have the same type as src and /// the size Size(src.cols+left+right, src.rows+top+bottom)</param> /// <param name="top">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param> /// <param name="bottom">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param> /// <param name="left">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param> /// <param name="right">Specify how much pixels in each direction from the source image rectangle one needs to extrapolate</param> /// <param name="borderType">The border type</param> /// <param name="value">The border value if borderType == Constant</param> public static void CopyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, BorderType borderType, Scalar? value = null) { if (src == null) throw new ArgumentNullException("src"); if (dst == null) throw new ArgumentNullException("dst"); src.ThrowIfDisposed(); dst.ThrowIfNotReady(); Scalar value0 = value.GetValueOrDefault(new Scalar()); NativeMethods.imgproc_copyMakeBorder(src.CvPtr, dst.CvPtr, top, bottom, left, right, (int)borderType, value0); dst.Fix(); }
private BorderStyle GetStyle(BorderType type) { BorderStyle style = BorderStyle.Single; Border border = GetBorder(type); if (border != null && !border.IsNull("Style")) style = border.Style; else if (!this.borders.IsNull("Style")) style = this.borders.Style; return style; }
public static BorderCharacter TopBorder(BorderType borderType, Point location) { switch (borderType) { case BorderType.SingleLine: return new BorderCharacter(BorderInfo.SingleTop, location); case BorderType.DoubleLine: return new BorderCharacter(BorderInfo.DoubleTop, location); default: throw new ArgumentOutOfRangeException("borderType"); } }
public Cell() { this.m_anchor = AnchorStyles.Left | AnchorStyles.Top; this.m_bVisible = true; this.m_sName = ""; this.Changed = null; this.m_anchor = AnchorStyles.Left | AnchorStyles.Top; this.m_BackColor = Resco.Controls.AdvancedList.AdvancedList.TransparentColor; this.m_ForeColor = Resco.Controls.AdvancedList.AdvancedList.TransparentColor; this.m_Bounds = new Rectangle(-1, -1, -1, -1); this.m_cellSource = new Resco.Controls.AdvancedList.CellSource(); this.m_cellSource.Parent = this; this.m_Border = BorderType.None; this.m_IsAutoHeight = false; this.m_CustomizeCell = false; this.m_scale = new SizeF(1f, 1f); }
public Cell(Cell cell) { this.m_anchor = AnchorStyles.Left | AnchorStyles.Top; this.m_bVisible = true; this.m_sName = ""; this.Changed = null; this.m_anchor = cell.m_anchor; this.m_BackColor = cell.m_BackColor; this.m_ForeColor = cell.m_ForeColor; this.m_Bounds = cell.m_Bounds; this.m_cellSource = cell.m_cellSource.Copy(); this.m_Border = cell.m_Border; this.m_CustomizeCell = cell.m_CustomizeCell; this.Name = cell.Name; this.m_IsAutoHeight = cell.m_IsAutoHeight; this.m_bSelectable = cell.m_bSelectable; this.m_bVisible = cell.m_bVisible; this.m_scale = cell.m_scale; }
private XColor GetColor(BorderType type) { Color clr = Colors.Black; Border border = GetBorder(type); if (border != null && !border.Color.IsEmpty) clr = border.Color; else if (!_borders.Color.IsEmpty) clr = _borders.Color; #if noCMYK return XColor.FromArgb((int)clr.Argb); #else // bool cmyk = false; // BUG CMYK // if (_borders.Document != null) // cmyk = _borders.Document.UseCmykColor; //#if DEBUG // else // GetT ype(); //#endif return ColorHelper.ToXColor(clr, _borders.Document.UseCmykColor); #endif }
internal XUnit GetWidth(BorderType type) { if (this.borders == null) return 0; Border border = GetBorder(type); if (border != null) { if (!border.IsNull("Visible") && !border.Visible) return 0; if (border != null && !border.IsNull("Width")) return border.Width.Point; if (!border.IsNull("Color") || !border.IsNull("Style") || border.Visible) { if (!this.borders.IsNull("Width")) return this.borders.Width.Point; return 0.5; } } else if (!(type == BorderType.DiagonalDown || type == BorderType.DiagonalUp)) { if (!this.borders.IsNull("Visible") && !this.borders.Visible) return 0; if (!this.borders.IsNull("Width")) return this.borders.Width.Point; if (!this.borders.IsNull("Color") || !this.borders.IsNull("Style") || this.borders.Visible) return 0.5; } return 0; }
internal Border GetBorderReadOnly(BorderType type) { switch (type) { case BorderType.Bottom: return _bottom; case BorderType.DiagonalDown: return _diagonalDown; case BorderType.DiagonalUp: return _diagonalUp; case BorderType.Horizontal: case BorderType.Vertical: return (Border)GetValue(type.ToString(), GV.GetNull); case BorderType.Left: return _left; case BorderType.Right: return _right; case BorderType.Top: return _top; } if (!Enum.IsDefined(typeof(BorderType), type)) throw new /*InvalidEnum*/ArgumentException(DomSR.InvalidEnumValue(type), "type"); return null; }
public static Image DrawBorder(Image img, Color fromBorderColor, Color toBorderColor, LinearGradientMode gradientType, int borderSize, BorderType borderType) { int width = img.Width; int height = img.Height; if (borderType == BorderType.Outside) { width += borderSize * 2; height += borderSize * 2; } using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, width, height), fromBorderColor, toBorderColor, gradientType)) using (Pen borderPen = new Pen(brush, borderSize) { Alignment = PenAlignment.Inset }) { return DrawBorder(img, borderPen, borderType); } }
private static bool smethod_0(BorderType A_0) { return((A_0 != BorderType.DiagonalDown) && (A_0 != BorderType.DiagonalUp)); }
public PhongEffect(Game game, BorderType borderType) : base(game, borderType) { Effect = Game.Content.Load <Effect>("Effects/Phong").Clone(game.GraphicsDevice); textureLibrary = (TexturesLibrary)game.Services.GetService(typeof(TexturesLibrary)); }
public static Range SetBorder(this Range range, BorderType borderType) { range.SetOutlineBorder(borderType, CellBorderType.Thin, Color.Silver); return(range); }
public Border(BorderType bt) { border_type = bt; }
protected void btnSave_ServerClick(object sender, EventArgs e) { Page.Validate(); if (!Page.IsValid) { return; } FormController fc = new FormController(FormDocumentData); if (!String.IsNullOrEmpty(itemUid)) //edit { FormSectionData = fc.GetSectionByUid(new Guid(itemUid)); FormSectionData.BorderType = (cbShowBorder.Checked ? 1 : 0); FormSectionData.ShowLabel = cbShowTitle.Checked; FormLabel lbl = null; foreach (FormLabel temp in FormSectionData.Labels) { if (temp.Code.ToLower().Equals(Thread.CurrentThread.CurrentUICulture.Name.ToLower())) { lbl = temp; } } if (lbl == null) { lbl = new FormLabel(); lbl.Code = Thread.CurrentThread.CurrentUICulture.Name.ToLower(); FormSectionData.Labels.Add(lbl); } lbl.Title = txtTitle.Text; foreach (Control c in phProperties.Controls) { if (c is SmartTableLayoutProperties) { SmartTableLayoutProperties sp = (SmartTableLayoutProperties)c; FormSectionData.Control.CellPadding = sp.CellPadding; if (!String.IsNullOrEmpty(sp.Columns)) { FormSectionData.Control.Columns = sp.Columns; } } } } else //create { if (ddControl.SelectedValue.Equals(FormController.SmartTableLayoutType)) { int cellPadding = 5; string columns = "50%;*"; foreach (Control c in phProperties.Controls) { if (c is SmartTableLayoutProperties) { SmartTableLayoutProperties sp = (SmartTableLayoutProperties)c; cellPadding = sp.CellPadding; if (!String.IsNullOrEmpty(sp.Columns)) { columns = sp.Columns; } } } BorderType bType = (cbShowBorder.Checked ? BorderType.TemplateBorder : BorderType.None); FormSection newSection = FormController.CreateSectionSTL(bType, cbShowBorder.Checked, txtTitle.Text, Unit.Percentage(100), columns, cellPadding); fc.AddSection(newSection); } } string newUid = Guid.NewGuid().ToString("N"); Session[newUid] = FormDocumentData; CloseAndRefresh(newUid); }
private void isolatedBtn_CheckedChanged(object sender, EventArgs e) { borderType = BorderType.Isolated; }
private void ResetColorBorderToNormal() { RootElement.Style = Resources["Normal"] as Style; BorderType = _originalBorderType; }
public Border(float width, BorderType type, Color color) { this.Width = width; this.Type = type; this.Color = color; }
/// <summary> /// Constructor with item and border type</summary> /// <param name="item">Item with border</param> /// <param name="border">Border type</param> public DiagramBorder(object item, BorderType border) { Item = item; Border = border; }
public Image Affine(Image dst, System.Windows.Media.Matrix matrix, BorderType borderType, uint borderValue) { const float Eps = 1e-8f; if (matrix.IsIdentity) { return(this.Copy(dst, true)); } // IPP does not support 1bpp images - convert to 8bpp Image src; bool convert1bpp = false; if (this.BitsPerPixel == 1) { src = this.Convert1To8(null); borderValue = borderValue != 0 ? 0u : 255u; convert1bpp = true; } else { src = this; } // calculate new image size and position PointD tr = TransformPoint(src.Width, 0); PointD br = TransformPoint(src.Width, src.Height); PointD bl = TransformPoint(0, src.Height); double x1dst = Core.MinMax.Min(bl.X, tr.X, br.X, 0.0); double x2dst = Core.MinMax.Max(bl.X, tr.X, br.X, 0.0); double y1dst = Core.MinMax.Min(bl.Y, tr.Y, br.Y, 0.0); double y2dst = Core.MinMax.Max(bl.Y, tr.Y, br.Y, 0.0); // translate matrix so the transformed image fits into new frame matrix.OffsetX = -Core.MinMax.Min(x1dst, x2dst); matrix.OffsetY = -Core.MinMax.Min(y1dst, y2dst); // note: add epsilon to avoid rounding problems int widthdst = (int)Math.Floor(x2dst - x1dst + Eps); int heightdst = (int)Math.Floor(y2dst - y1dst + Eps); bool inplace = dst == this; dst = src.CreateTemplate(dst, widthdst, heightdst, src.BitsPerPixel); IPP.Execute(() => { return(NativeMethods.affine( src.BitsPerPixel, src.Width, src.Height, src.Stride, src.Bits, dst.Width, dst.Height, dst.Stride, dst.Bits, matrix.M11, matrix.M12, matrix.OffsetX, matrix.M21, matrix.M22, matrix.OffsetY, (int)borderType, borderValue)); }); dst.AppendTransform(new MatrixTransform(matrix)); // convert back to 1bpp if (convert1bpp) { dst.Convert8To1(dst, 1); /*using (Pix pixs = transformedImage.CreatePix()) * { * using (Pix pixd = pixs.pixOtsu(false)) * { * if (pixd != null) * { * return pixd.CreateImage(transformedImage.HorizontalResolution, transformedImage.VerticalResolution); * } * } * }*/ } if (inplace) { this.Attach(dst); return(this); } return(dst); PointD TransformPoint(int ptx, int pty) { return(new PointD( (matrix.M11 * ptx) + (matrix.M12 * pty) + matrix.OffsetX, (matrix.M21 * ptx) + (matrix.M22 * pty) + matrix.OffsetY)); } }
private void Draw(PPDDevice device, WorkspaceTexture filterTexture, Border border, BorderType type, float thickness) { using (var workspaceTexture = device.Workspace.Get()) { #if BENCHMARK using (var handler = Benchmark.Instance.Start("Copy")) { #endif device.StretchRectangle(device.GetRenderTarget(), workspaceTexture); #if BENCHMARK } #endif effect.Technique = String.Format("{0}{1}Border", type, border.Blend); effect.SetTexture(filterTextureHandle, filterTexture.Texture); effect.SetTexture(lastRenderTargetTextureHandle, workspaceTexture.Texture); effect.SetValue(colorHandle, border.Color); var intThickness = (int)Math.Ceiling(thickness * 2 + 1); effect.SetValue(thicknessHandle, (float)intThickness); effect.SetValue(thickness2Handle, (int)Math.Pow(intThickness, 2)); effect.SetValue(actualThicknessHandle, thickness); var passCount = effect.Begin(); effect.BeginPass(0); effect.CommitChanges(); device.VertexDeclaration = effect.VertexDeclaration; var screenVertex = device.GetModule <ShaderCommon>().ScreenVertex; device.SetStreamSource(screenVertex.VertexBucket.VertexBuffer); device.DrawPrimitives(PrimitiveType.TriangleStrip, screenVertex.Offset, 2); effect.EndPass(); effect.End(); } }
public BorderStyle(int width, BorderType type, Color color) : this(width, type, color, 3) { }
/// <summary> /// Calculates the first x- or y- image derivative using Scharr operator /// </summary> /// <param name="ddepth">The destination image depth</param> /// <param name="xorder">Order of the derivative x</param> /// <param name="yorder">Order of the derivative y</param> /// <param name="scale">The optional scale factor for the computed derivative values (by default, no scaling is applie</param> /// <param name="delta">The optional delta value, added to the results prior to storing them in dst</param> /// <param name="borderType">The pixel extrapolation method</param> /// <returns>The destination image; will have the same size and the same number of channels as src</returns> public Mat Scharr(MatType ddepth, int xorder, int yorder, double scale = 1, double delta = 0, BorderType borderType = BorderType.Default) { var dst = new Mat(); Cv2.Scharr(this, dst, ddepth, xorder, yorder, scale, delta, borderType); return dst; }
public Border(ControlBase parent) : base(parent) { m_BorderType = BorderType.PanelNormal; }
/// <summary> /// computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix. /// </summary> /// <param name="blockSize"></param> /// <param name="ksize"></param> /// <param name="borderType"></param> public Mat CornerEigenValsAndVecs(int blockSize, int ksize, BorderType borderType = BorderType.Default) { var dst = new Mat(); Cv2.CornerEigenValsAndVecs(this, dst, blockSize, ksize, borderType); return dst; }
public static void SetBorderType(BindableObject view, BorderType value) { view.SetValue(BorderTypeProperty, value); }
internal bool method_19(BorderType A_0) { return(this.interface63_0.imethod_3().Contains(A_0)); }
/// <summary> /// Sets the border outside specified area of interest. /// </summary> /// <param name="x">The x-coordinate of the upper-left corner of the area.</param> /// <param name="y">The y-coordinate of the upper-left corner of the area.</param> /// <param name="width">The width of the area.</param> /// <param name="height">The height of the area.</param> /// <param name="borderType">The type of border.</param> /// <param name="borderValue">The value of border pixels when <paramref name="borderType"/> is <see cref="BorderType.BorderConst"/>.</param> internal void SetBorder(int x, int y, int width, int height, BorderType borderType, float borderValue) { int stride = this.Stride; float[] bits = this.Bits; int right = x + width; int bottom = y + height; int offy = y * stride; switch (borderType) { case BorderType.BorderRepl: SetBorderRepl(); break; case BorderType.BorderConst: SetBorderConst(); break; } void SetBorderRepl() { // set top if (y > 0) { Vectors.Tile(this.Width, y, bits, offy + stride, bits, 0); } // set left if (x > 0) { for (int i = y, off = offy; i < height; i++, off += stride) { Vectors.Set(x, bits[off + x], bits, off); } } // set right int len = this.Width - right; if (len > 0) { for (int i = y, off = offy + right; i < height; i++, off += stride) { Vectors.Set(len, bits[off - 1], bits, off); } } // set bottom len = this.Height - bottom; if (len > 0) { Vectors.Tile(this.Width, len, bits, (bottom - 1) * stride, bits, bottom * stride); } } void SetBorderConst() { // set top if (y > 0) { Vectors.Set(offy, borderValue, bits, 0); } // set left if (x > 0) { for (int i = y, off = offy; i < height; i++, off += stride) { Vectors.Set(x, borderValue, bits, off); } } // set right int len = this.Width - right; if (len > 0) { for (int i = y, off = offy + right; i < height; i++, off += stride) { Vectors.Set(len, borderValue, bits, off); } } // set bottom len = this.Height - bottom; if (len > 0) { Vectors.Set(len * stride, borderValue, bits, bottom * stride); } } }
/// <summary> /// Draws the label flat. /// </summary> /// <param name="context">Context.</param> /// <param name="bordertype">Bordertype.</param> /// <param name="labelposition">Labelposition.</param> /// <param name="pin">Pin.</param> /// <param name="xpos">Xpos.</param> /// <param name="ypos">Ypos.</param> private static void DrawLabelFlat(Cairo.Context context, BorderType bordertype, LabelPosition labelposition, IPin pin, int xpos = 0, int ypos = 0) { string displaytext = ""; var color = GdkToCairo(pin.PlotColor); displaytext = pin.DisplayNumberShort + " " + pin.Name; if (displaytext.Length > 12) { displaytext = displaytext.Substring(0, 12); displaytext += "..."; } if (bordertype == BorderType.Line) { DrawRoundedRectangle(context, xpos, ypos, LabelWidth - LabelBorderWeight, FlatHeight, 5); context.SetSourceRGBA(color.R, color.G, color.B, color.A); context.LineWidth = LabelBorderWeight; context.Stroke(); } //PinToLabelLine int xposlabelline = 0; int yposlabelline = 0; switch (labelposition) { case LabelPosition.Left: xposlabelline = xpos + LabelWidth; yposlabelline = ypos + (FlatHeight / 2); break; case LabelPosition.Right: xposlabelline = xpos; yposlabelline = ypos + (FlatHeight / 2); break; case LabelPosition.Bottom: xpos = xpos + LabelWidth / 2; yposlabelline = ypos; break; default: break; } if (PinLocations.ContainsKey((int)pin.RealNumber)) { DrawLines( context, xposlabelline, yposlabelline, (int)(MCUImageXZero + PinLocations [(int)pin.RealNumber].x), (int)(MCUImageYZero + PinLocations [(int)pin.RealNumber].y), color ); } //Number context.SetSourceRGB(0, 0, 0); context.SelectFontFace("Sans", FontSlant.Normal, FontWeight.Bold); context.SetFontSize(LabelFontSize); context.MoveTo(xpos + 5, ypos + LabelFontSize + LabelBorderWeight); context.ShowText(displaytext); }
private BorderStyle GetStyle(BorderType type) { return(borders.GetEffectiveBorderStyle(type)); }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="rect"></param> /// <param name="fgColor"></param> /// <param name="style"></param> /// <param name="textBoxBorder"></param> /// <param name="borderType"></param> public static void PaintBorder(Graphics g, Rectangle rect, Color fgColor, ControlStyle style, bool textBoxBorder, BorderType borderType = BorderType.Thin) { Pen pen = null; bool shouldPaintBorder = !(style == ControlStyle.TwoD && borderType == BorderType.NoBorder); if (shouldPaintBorder) { if (style == ControlStyle.TwoD) { pen = PensCache.GetInstance().Get(fgColor); } if (style == ControlStyle.TwoD && borderType == BorderType.Thick) { // back up the original properties of pen PenAlignment originalAlligment = pen.Alignment; float originalwidth = pen.Width; // set properties of pen pen.Width = 2; pen.Alignment = PenAlignment.Inset; PaintBorder(g, pen, rect, style, textBoxBorder); // restore the original properties of pen pen.Alignment = originalAlligment; pen.Width = originalwidth; } else { PaintBorder(g, pen, rect, style, textBoxBorder); } } }
/// <summary> /// 指定の構造要素を用いて画像の収縮を行います. /// </summary> /// <param name="element">収縮に用いられる構造要素. element=new Mat() の場合, 3x3 の矩形の構造要素が用いられます</param> /// <param name="anchor">構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します</param> /// <param name="iterations">収縮が行われる回数. [既定値は1]</param> /// <param name="borderType">ピクセル外挿手法.[既定値はBorderType.Constant]</param> /// <param name="borderValue">定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます.[既定値はCvCpp.MorphologyDefaultBorderValue()]</param> /// <returns>src と同じサイズ,同じ型の出力画像</returns> #else /// <summary> /// Erodes an image by using a specific structuring element. /// </summary> /// <param name="element">The structuring element used for dilation. If element=new Mat(), a 3x3 rectangular structuring element is used</param> /// <param name="anchor">Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center</param> /// <param name="iterations">The number of times erosion is applied</param> /// <param name="borderType">The pixel extrapolation method</param> /// <param name="borderValue">The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]</param> /// <returns>The destination image. It will have the same size and the same type as src</returns> #endif public Mat Erode(InputArray element, CvPoint? anchor = null, int iterations = 1, BorderType borderType = BorderType.Constant, CvScalar? borderValue = null) { var dst = new Mat(); Cv2.Erode(this, dst, element, anchor, iterations, borderType, borderValue); return dst; }
public static void AssertBorder(BorderType border, BorderState b, BorderValues style = BorderValues.Single) { Assert.AreEqual((int)border.Size.Value / 8f, b.Thickness); Assert.AreEqual(border.Color.Value, b.Color); Assert.AreEqual(style, b.Style); }
/// <summary> /// Applies a perspective transformation to an image. /// </summary> /// <param name="m">3x3 transformation matrix.</param> /// <param name="dsize">size of the output image.</param> /// <param name="flags">combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) /// and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src).</param> /// <param name="borderMode">pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).</param> /// <param name="borderValue">value used in case of a constant border; by default, it equals 0.</param> /// <returns>output image that has the size dsize and the same type as src.</returns> public Mat WarpPerspective(Mat m, Size dsize, Interpolation flags = Interpolation.Linear, BorderType borderMode = BorderType.Constant, Scalar? borderValue = null) { var dst = new Mat(); Cv2.WarpPerspective(this, dst, m, dsize, flags, borderMode, borderValue); return dst; }
/// <summary> /// Upsamples an image and then blurs it. /// </summary> /// <param name="dstSize">size of the output image; by default, it is computed as Size(src.cols*2, (src.rows*2)</param> /// <param name="borderType"></param> /// <returns></returns> public Mat PyrUp(Size? dstSize = null, BorderType borderType = BorderType.Default) { var dst = new Mat(); Cv2.PyrUp(this, dst, dstSize, borderType); return dst; }
/// <summary> /// Draws the labels. /// </summary> /// <param name="context">Context.</param> /// <param name="pins">Pins.</param> /// <param name="xpos">Xpos.</param> /// <param name="ypos">Ypos.</param> /// <param name="labelposition">Labelposition.</param> /// <param name="labelformat">Labelformat.</param> /// <param name="bordtype">Bordtype.</param> public static void SetPinLabels(Cairo.Context context, List <IPin> pins, int xpos, int ypos, LabelPosition labelposition, LabelFormat labelformat = LabelFormat.Flat, BorderType bordtype = BorderType.Line) { int height = (labelformat == LabelFormat.Flat) ? FlatHeight : BoldHeight; for (int i = 0; i < pins.Count; i++) { DrawLabel(context, labelformat, bordtype, labelposition, pins [i], xpos, ypos + (i * height + i * Space)); } }
private static void GenerateBorderStyle(XElement pBdr, XName sideXName, Dictionary<string, string> style, BorderType borderType) { string whichSide; if (sideXName == W.top) whichSide = "top"; else if (sideXName == W.right) whichSide = "right"; else if (sideXName == W.bottom) whichSide = "bottom"; else whichSide = "left"; if (pBdr == null) { style.Add("border-" + whichSide, "none"); if (borderType == BorderType.Cell && (whichSide == "left" || whichSide == "right")) style.Add("padding-" + whichSide, "5.4pt"); return; } var side = pBdr.Element(sideXName); if (side == null) { style.Add("border-" + whichSide, "none"); if (borderType == BorderType.Cell && (whichSide == "left" || whichSide == "right")) style.Add("padding-" + whichSide, "5.4pt"); return; } var type = (string)side.Attribute(W.val); if (type == "nil" || type == "none") { style.Add("border-" + whichSide + "-style", "none"); var space = (decimal?)side.Attribute(W.space); if (space == null) space = 0; if (borderType == BorderType.Cell && (whichSide == "left" || whichSide == "right")) if (space < 5.4m) space = 5.4m; style.Add("padding-" + whichSide, space == 0 ? "0in" : space.ToString() + "pt"); } else { var sz = (int)side.Attribute(W.sz); var space = (decimal?)side.Attribute(W.space); if (space == null) space = 0; var color = (string)side.Attribute(W.color); if (color == null || color == "auto") color = "windowtext"; else color = ConvertColor(color); decimal borderWidthInPoints = Math.Max(1m, Math.Min(96m, Math.Max(2m, sz)) / 8m); var borderStyle = "solid"; if (BorderStyleMap.ContainsKey(type)) { var borderInfo = BorderStyleMap[type]; borderStyle = borderInfo.CssName; if (type == "double") { if (sz <= 8) borderWidthInPoints = 2.5m; else if (sz <= 18) borderWidthInPoints = 6.75m; else borderWidthInPoints = sz / 3m; } else if (type == "triple") { if (sz <= 8) borderWidthInPoints = 8m; else if (sz <= 18) borderWidthInPoints = 11.25m; else borderWidthInPoints = 11.25m; } else if (type.ToLower().Contains("dash")) { if (sz <= 4) borderWidthInPoints = 1m; else if (sz <= 12) borderWidthInPoints = 1.5m; else borderWidthInPoints = 2m; } else if (type != "single") borderWidthInPoints = borderInfo.CssSize; } if (type == "outset" || type == "inset") color = ""; var borderWidth = string.Format("{0:0.0}pt", borderWidthInPoints); style.Add("border-" + whichSide, borderStyle + " " + color + " " + borderWidth); if (borderType == BorderType.Cell && (whichSide == "left" || whichSide == "right")) if (space < 5.4m) space = 5.4m; style.Add("padding-" + whichSide, space == 0 ? "0in" : space.ToString() + "pt"); } }
private void reflectedBtn_CheckedChanged(object sender, EventArgs e) { borderType = BorderType.Reflect; }
public Class1031 method_1(int A_0) { BorderType key = (BorderType)this.interface63_0.imethod_3().GetKey(A_0); return(this.method_0(key)); }
/// <summary> /// Calculates the Laplacian of an image /// </summary> /// <param name="ddepth">The desired depth of the destination image</param> /// <param name="ksize">The aperture size used to compute the second-derivative filters</param> /// <param name="scale">The optional scale factor for the computed Laplacian values (by default, no scaling is applied</param> /// <param name="delta">The optional delta value, added to the results prior to storing them in dst</param> /// <param name="borderType">The pixel extrapolation method</param> /// <returns>Destination image; will have the same size and the same number of channels as src</returns> public Mat Laplacian(MatType ddepth, int ksize = 1, double scale = 1, double delta = 0, BorderType borderType = BorderType.Default) { var dst = new Mat(); Cv2.Laplacian(this, dst, ddepth, ksize, scale, delta, borderType); return dst; }
private void replicateBtn_CheckedChanged(object sender, EventArgs e) { borderType = BorderType.Replicate; }
/// <summary> /// computes another complex cornerness criteria at each pixel /// </summary> /// <param name="ksize"></param> /// <param name="borderType"></param> public Mat PreCornerDetect(int ksize, BorderType borderType = BorderType.Default) { var dst = new Mat(); Cv2.PreCornerDetect(this, dst, ksize, borderType); return dst; }
private Border GetBorder(BorderType type) { return(_borders.GetBorderReadOnly(type)); }
/// <summary> /// 高度なモルフォロジー変換を行います. /// </summary> /// <param name="op">モルフォロジー演算の種類</param> /// <param name="element">構造要素</param> /// <param name="anchor">構造要素内のアンカー位置.デフォルト値の (-1, -1) は,アンカーが構造要素の中心にあることを意味します.</param> /// <param name="iterations">収縮と膨張が適用される回数. [既定値は1]</param> /// <param name="borderType">ピクセル外挿手法. [既定値はBorderType.Constant]</param> /// <param name="borderValue">定数境界モードで利用されるピクセル値.デフォルト値は特別な意味を持ちます. [既定値は CvCpp.MorphologyDefaultBorderValue()]</param> /// <returns>src と同じサイズ,同じ型の出力画像</returns> #else /// <summary> /// Performs advanced morphological transformations /// </summary> /// <param name="op">Type of morphological operation</param> /// <param name="element">Structuring element</param> /// <param name="anchor">Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center</param> /// <param name="iterations">Number of times erosion and dilation are applied. [By default this is 1]</param> /// <param name="borderType">The pixel extrapolation method. [By default this is BorderType.Constant]</param> /// <param name="borderValue">The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]</param> /// <returns>Destination image. It will have the same size and the same type as src</returns> #endif public Mat MorphologyEx(MorphologyOperation op, InputArray element, CvPoint? anchor = null, int iterations = 1, BorderType borderType = BorderType.Constant, CvScalar? borderValue = null) { var dst = new Mat(); Cv2.MorphologyEx(this, dst, op, element, anchor, iterations, borderType, borderValue); return dst; }
public void FormatRange(string from, string to, Color?background, Align vertical, Align horizontal, BorderType borderType, BorderLineStyle borderStyle) { range = worksheet.get_Range(from, to); if (background != null) { range.Interior.Color = ColorTranslator.ToOle(background.Value); } if (!vertical.Equals(Align.None)) { range.VerticalAlignment = vertical; } if (!horizontal.Equals(Align.None)) { range.HorizontalAlignment = horizontal; } if (borderType == BorderType.None) { return; } if (borderType == BorderType.BorderOutside) { range.BorderAround(borderStyle, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexNone, missing); } else { range.Borders.LineStyle = borderStyle; } }
/// <summary> /// Applies a generic geometrical transformation to an image. /// </summary> /// <param name="map1">The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2.</param> /// <param name="map2">The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.</param> /// <param name="interpolation">Interpolation method. The method INTER_AREA is not supported by this function.</param> /// <param name="borderMode">Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, /// it means that the pixels in the destination image that corresponds to the "outliers" in /// the source image are not modified by the function.</param> /// <param name="borderValue">Value used in case of a constant border. By default, it is 0.</param> /// <returns>Destination image. It has the same size as map1 and the same type as src</returns> public Mat Remap(InputArray map1, InputArray map2, Interpolation interpolation = Interpolation.Linear, BorderType borderMode = BorderType.Constant, CvScalar? borderValue = null) { var dst = new Mat(); Cv2.Remap(this, dst, map1, map2, interpolation, borderMode, borderValue); return dst; }
private Border GetBorder(BorderType type) { return((Border)this.borders.GetValue(type.ToString(), GV.ReadOnly)); }
BorderRenderer CreateBorderRenderer(Border border, BorderType borderType) { BorderRenderer brdrRndrr = new BorderRenderer(border, this.docRenderer); brdrRndrr.ParentCell = this.parentCell; brdrRndrr.ParentFormat = this.parentFormat; brdrRndrr.BorderType = borderType; return brdrRndrr; }
public static BorderType SetBorderColor(this BorderType obj, string color) { obj.Color = color; return(obj); }
public static Image DrawBorder(Image img, Color borderColor, int borderSize, BorderType borderType) { using (Pen borderPen = new Pen(borderColor, borderSize) { Alignment = PenAlignment.Inset }) { return DrawBorder(img, borderPen, borderType); } }
public static Image DrawBorder(Image img, Color fromBorderColor, Color toBorderColor, LinearGradientMode gradientType, int borderSize, BorderType borderType) { int width = img.Width; int height = img.Height; if (borderType == BorderType.Outside) { width += borderSize * 2; height += borderSize * 2; } using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, width, height), fromBorderColor, toBorderColor, gradientType)) using (Pen borderPen = new Pen(brush, borderSize) { Alignment = PenAlignment.Inset }) { return(DrawBorder(img, borderPen, borderType)); } }
public static Image DrawBorder(Image img, Pen borderPen, BorderType borderType) { Bitmap bmp; if (borderType == BorderType.Inside) { bmp = (Bitmap)img; using (Graphics g = Graphics.FromImage(bmp)) { g.DrawRectangleProper(borderPen, 0, 0, img.Width, img.Height); } } else { int borderSize = (int)borderPen.Width; bmp = img.CreateEmptyBitmap(borderSize * 2, borderSize * 2); using (Graphics g = Graphics.FromImage(bmp)) using (img) { g.DrawRectangleProper(borderPen, 0, 0, bmp.Width, bmp.Height); g.SetHighQuality(); g.DrawImage(img, borderSize, borderSize, img.Width, img.Height); } } return bmp; }
private void Init(MachineType machineType, List <byte[]> files, bool autoTape, BorderType bType) { _machineType = machineType; // setup the emulated model based on the MachineType switch (machineType) { case MachineType.CPC464: _machine = new CPC464(this, _cpu, files, autoTape, bType); var roms64 = new List <RomData>(); roms64.Add(RomData.InitROM(MachineType.CPC464, GetFirmware(0x4000, "OS464ROM"), RomData.ROMChipType.Lower)); roms64.Add(RomData.InitROM(MachineType.CPC464, GetFirmware(0x4000, "BASIC1-0ROM"), RomData.ROMChipType.Upper, 0)); _machine.InitROM(roms64.ToArray()); break; case MachineType.CPC6128: _machine = new CPC6128(this, _cpu, files, autoTape, bType); var roms128 = new List <RomData>(); roms128.Add(RomData.InitROM(MachineType.CPC6128, GetFirmware(0x4000, "OS6128ROM"), RomData.ROMChipType.Lower)); roms128.Add(RomData.InitROM(MachineType.CPC6128, GetFirmware(0x4000, "BASIC1-1ROM"), RomData.ROMChipType.Upper, 0)); roms128.Add(RomData.InitROM(MachineType.CPC6128, GetFirmware(0x4000, "AMSDOS0-5ROM"), RomData.ROMChipType.Upper, 7)); _machine.InitROM(roms128.ToArray()); break; } }