Ejemplo n.º 1
0
        /// <summary>
        /// Gets the type of the hack line.
        /// </summary>
        /// <param name="hackLine">The hack line.</param>
        /// <returns></returns>
        private LineTypes GetHackLineType(string hackLine)
        {
            LineTypes lType = LineTypes.Unknown;

            if (hackLine.Length == 0)
            {
                lType = LineTypes.Empty;
            }
            else if (hackLine.StartsWith("@"))
            {
                lType = LineTypes.Acommand;
            }
            else if (hackLine.StartsWith("//"))
            {
                lType = LineTypes.Comment;
            }
            else if (hackLine.All(c => new char[] { '0', '1', ' ' }.Contains(c)) &&
                     hackLine.Replace(" ", String.Empty).Length == BINARY_ROW_LENGTH)
            {
                lType = LineTypes.Assembly;
            }
            else
            {
                lType = LineTypes.Dcommand;
            }
            return(lType);
        }
Ejemplo n.º 2
0
 public ParserContext(bool objectsAllowed, LineTypes.Property[] properties, LineTypes.Component[] components, ContextType type)
 {
     this.ObjectsAllowed = objectsAllowed;
     this.Properties = properties;
     this.Components = components;
     this.Type = type;
 }
Ejemplo n.º 3
0
        //*******************************************************************************************
        /// <summary>
        ///
        /// </summary>
        //*******************************************************************************************
        public void Draw(int x1, int y1, int x2, int y2, LineTypes lineType)
        {
            CheckDisposed();

            g_LineType = lineType;
            Draw(x1, y1, x2, y2);
        }
Ejemplo n.º 4
0
            // Methods
            public void Read(BINAReader reader)
            {
                // Read the data
                uint lineType = reader.ReadUInt32();
                uint padding1 = reader.ReadUInt32();

                ulong nameOffset = reader.ReadUInt64();
                ulong padding2   = reader.ReadUInt64();

                UnknownFloat1 = reader.ReadSingle();
                byte firstCharacter  = reader.ReadByte();
                byte firstAnim       = reader.ReadByte();
                byte secondCharacter = reader.ReadByte();
                byte secondAnim      = reader.ReadByte();

                TalkingCharacter = reader.ReadUInt64();

                // Parse it
                if (nameOffset != 0)
                {
                    Name = reader.GetString((uint)nameOffset + reader.Offset);
                }

                LineType            = (LineTypes)lineType;
                FirstCharacter      = (CharacterTypes)firstCharacter;
                FirstCharAnimation  = (AnimationTypes)firstAnim;
                SecondCharacter     = (CharacterTypes)secondCharacter;
                SecondCharAnimation = (AnimationTypes)secondAnim;
            }
Ejemplo n.º 5
0
            internal override void ProcessProperty(int index, LineTypes.Property line, IParentObject obj, Stack<GameObject> objectStack, ParserContext context)
            {
                if (objectStack.Count > 0) {
                    base.ObjectProcessProperty(index, line, obj, objectStack, context);
                    return;
                }

                if (context == this.context) {
                    ShipTilePrefab tile = (ShipTilePrefab)obj;

                    switch (index) {
                        case 0:
                            tile.ID = line.argumentsData[0].ToString();
                            break;
                        case 1:
                            tile.EditorName = line.argumentsData[0].ToString();
                            break;
                        case 2:
                            tile.EditorDescription = line.argumentsData[0].ToString();
                            break;
                        case 3:
                            tile.EditorThumbnail = (Texture2D)line.argumentsData[0];
                            break;
                        case 4:
                            tile.Mass = (float)line.argumentsData[0];
                            break;
                        case 5:
                            tile.HP = (int)line.argumentsData[0];
                            break;
                    }
                    return;
                }

                throw new Exception("Invalid member in parsed lines list");
            }
Ejemplo n.º 6
0
        internal void ObjectProcessComponent(int index, LineTypes.Component line, IParentObject obj, Stack<GameObject> objectStack, Stack<ParserContext> contextStack, ParserContext context)
        {
            #region Object context
            if (context == this.objectContext) {
                switch (index) {
                    case 0:
                    case 2:
                        return;
                    case 1:
                        MeshFilter filter = objectStack.Peek().AddComponent<MeshFilter>();
                        MeshRenderer renderer = objectStack.Peek().AddComponent<MeshRenderer>();
                        filter.mesh = Utility.MeshHelper.GetQuad();
                        renderer.material = new Material(Shader.Find("Standard"));
                        return;
                }
            }
            #endregion

            if (context == this.objectContext.Components[2].context) {
                // COLLIDER

                // todo: this
            }

            // other components that have sub-components

            throw new Exception("Invalid member in parsed lines list");
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Gets the assembly code by hack line.
        /// </summary>
        /// <param name="hackLine">The hack line.</param>
        /// <returns>the assembly code for the hack line</returns>
        private string GetAssemblyCodeByLine(string hackLine)
        {
            LineTypes lType   = this.GetHackLineType(hackLine);
            string    asmLine = String.Empty;

            switch (lType)
            {
            case LineTypes.Acommand:
                asmLine = this.GetACommandAssemblyLine(hackLine);
                break;

            case LineTypes.Dcommand:
                asmLine = this.GetDCommandAssemblyLine(hackLine);
                break;

            case LineTypes.Comment:
            case LineTypes.Empty:
                asmLine = String.Empty;
                break;

            case LineTypes.Assembly:
                asmLine = hackLine;
                break;

            default:
                this.ThrowException("Unknonw line type: " + lType);
                break;
            }

            return(asmLine);
        }
 public static dynamic GetTSObject(LineTypes dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Ejemplo n.º 9
0
 //*******************************************************************************************
 /// <summary>
 ///
 /// </summary>
 //*******************************************************************************************
 static public void Draw(Graphics g, int x1, int y1, int x2, int y2, Color solidLineColor)
 {
     g_graphics           = g;
     g_StartLocation      = new Point(x1, y1);
     g_EndLocation        = new Point(x2, y2);
     g_penSolidLine.Color = solidLineColor;
     g_LineType           = LineTypes.Solid;
     Draw();
 }
Ejemplo n.º 10
0
        public static void PutTextWithCenter(Mat img, Point textCenter, string text,
                                             Scalar textColor, HersheyFonts font, double fontScale,
                                             int thickness, LineTypes lineType)
        {
            Size  textSize     = GetTextSize(text, font, fontScale);
            Point textLocation = new Point(textCenter.X - textSize.Width / 2, textCenter.Y + textSize.Height / 2);

            Cv2.PutText(img, text, textLocation, font, fontScale, textColor, thickness, lineType);
        }
Ejemplo n.º 11
0
            internal override void ProcessComponent(int index, LineTypes.Component line, IParentObject obj, Stack<GameObject> objectStack, Stack<ParserContext> contextStack, ParserContext context)
            {
                if (objectStack.Count > 0) {
                    base.ObjectProcessComponent(index, line, obj, objectStack, contextStack, context);
                    return;
                }

                throw new Exception("Invalid member in parsed lines list");
            }
Ejemplo n.º 12
0
        public static string LineTypeToString(LineTypes lineType)
        {
            if (!s_stringByLineTypes.TryGetValue(lineType, out string result))
            {
                throw new ArgumentException($"Unknown line type: {lineType}");
            }

            return(result);
        }
        public GraphicObject(LineTypes lt, Color c)
        {
            lineType = lt; color = c;
            pen      = new Pen(c);

            DashStyle ds;

            Enum.TryParse(lt.ToString(), true, out ds);
            pen.DashStyle = ds;
        }
Ejemplo n.º 14
0
        //*******************************************************************************************
        /// <summary>
        ///
        /// </summary>
        //*******************************************************************************************
        public void Draw(int x1, int y1, int x2, int y2, Color solidLineColor)
        {
            CheckDisposed();

            g_StartLocation      = new Point(x1, y1);
            g_EndLocation        = new Point(x2, y2);
            g_penSolidLine.Color = solidLineColor;
            g_LineType           = LineTypes.Solid;
            Draw();
        }
Ejemplo n.º 15
0
        private void EnsureTableItems()
        {
            var existingDimStyles = GetExistingNames(DimensionStyles.Cast <DxfSymbolTableFlags>());

            AddMissingDimensionStyles(existingDimStyles, new[] { Header.DimensionStyleName });
            AddMissingDimensionStyles(existingDimStyles, Entities.OfType <DxfDimensionBase>().Select(d => d.DimensionStyleName));
            AddMissingDimensionStyles(existingDimStyles, Entities.OfType <DxfLeader>().Select(d => d.DimensionStyleName));
            AddMissingDimensionStyles(existingDimStyles, Entities.OfType <DxfTolerance>().Select(d => d.DimensionStyleName));

            var existingLayers = GetExistingNames(Layers.Cast <DxfSymbolTableFlags>());

            AddMissingLayers(existingLayers, new[] { Header.CurrentLayer });
            AddMissingLayers(existingLayers, Blocks.Select(b => b.Layer));
            AddMissingLayers(existingLayers, Blocks.SelectMany(b => b.Entities.Select(e => e.Layer)));
            AddMissingLayers(existingLayers, Entities.Select(e => e.Layer));
            AddMissingLayers(existingLayers, Objects.OfType <DxfLayerFilter>().SelectMany(l => l.LayerNames));
            AddMissingLayers(existingLayers, Objects.OfType <DxfLayerIndex>().SelectMany(l => l.LayerNames));

            var existingLineTypes = GetExistingNames(LineTypes.Cast <DxfSymbolTableFlags>());

            AddMissingLineTypes(existingLineTypes, new[] { Header.CurrentEntityLineType, Header.DimensionLineType });
            AddMissingLineTypes(existingLineTypes, Layers.Select(l => l.LineTypeName));
            AddMissingLineTypes(existingLineTypes, Blocks.SelectMany(b => b.Entities.Select(e => e.LineTypeName)));
            AddMissingLineTypes(existingLineTypes, Entities.Select(e => e.LineTypeName));
            AddMissingLineTypes(existingLineTypes, Objects.OfType <DxfMLineStyle>().SelectMany(m => m.Elements.Select(e => e.LineType)));

            var existingStyles = GetExistingNames(Styles.Cast <DxfSymbolTableFlags>());

            AddMissingStyles(existingStyles, Entities.OfType <DxfArcAlignedText>().Select(a => a.TextStyleName));
            AddMissingStyles(existingStyles, Entities.OfType <DxfAttribute>().Select(a => a.TextStyleName));
            AddMissingStyles(existingStyles, Entities.OfType <DxfAttributeDefinition>().Select(a => a.TextStyleName));
            AddMissingStyles(existingStyles, Entities.OfType <DxfMText>().Select(m => m.TextStyleName));
            AddMissingStyles(existingStyles, Entities.OfType <DxfText>().Select(t => t.TextStyleName));
            AddMissingStyles(existingStyles, Objects.OfType <DxfMLineStyle>().Select(m => m.StyleName));

            var existingUcs = GetExistingNames(UserCoordinateSystems.Cast <DxfSymbolTableFlags>());

            AddMissingUcs(existingUcs, new[] {
                Header.UCSDefinitionName,
                Header.UCSName,
                Header.OrthoUCSReference,
                Header.PaperspaceUCSDefinitionName,
                Header.PaperspaceUCSName,
                Header.PaperspaceOrthoUCSReference,
            });

            var existingAppIds = GetExistingNames(ApplicationIds.Cast <DxfSymbolTableFlags>());

            AddMissingAppIds(existingAppIds, Entities.SelectMany(e => e.XData.Keys));
            AddMissingAppIds(existingAppIds, Objects.SelectMany(o => o.XData.Keys));
            AddMissingAppIds(existingAppIds, Blocks.SelectMany(b => b.XData.Keys));

            // don't need to do anything special for BlockRecords or ViewPorts
        }
Ejemplo n.º 16
0
 public static Boolean TryParse(String lineType, out LineTypes type)
 {
     type = LineTypes.Comment;
     if (lineType.ToLower().Equals("dialogue")) {
         type = LineTypes.Dialogue;
         return true;
     }
     if (!lineType.ToLower().Equals("comment")) return false;
     type = LineTypes.Comment;
     return true;
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LineShape"/> class.
        /// </summary>
        /// <param name="bounds">The line bounding box.</param>
        /// <param name="begin">The starting point of the line.</param>
        /// <param name="end">The ending point of the line.</param>
        /// <param name="width">The line width, in pixels.</param>
        /// <param name="types">The line types.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// The <paramref name="width"/> is zero or less.
        /// </exception>
        public LineShape(Rectangle bounds, Point begin, Point end, int width, LineTypes types)
            : base(bounds)
        {
            if (width <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(width), width, "The line width is invalid.");
            }

            this.Begin = begin;
            this.End   = end;
            this.Width = width;
            this.Types = types;
        }
Ejemplo n.º 18
0
        public Line(Int32 layer, STime start, STime end, LineTypes type, String styleName, String name,
			Margin margin, String effect, String text)
        {
            Layer = layer;
            StartTime = start;
            EndTime = end;
            LineType = type;
            Text = text;
            Effect = effect;
            Name = name;
            Margin = margin;
            Style = styleName;
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Default values method
        /// </summary>
        protected override void DefaultValues()
        {
            base.DefaultValues();

            this.meshes        = new List <Mesh>();
            this.boundingBox   = new BoundingBox();
            this.UseWorldSpace = false;
            this.lineType      = LineTypes.LineList;
            this.material      = new LineMaterial(WaveServices.GraphicsDevice.Graphics);
            this.linePoints    = new List <LinePointInfo>();
            this.textureTiling = Vector2.One;
            this.ModelMeshName = "Default";
        }
Ejemplo n.º 20
0
        protected void gridMain_InsertCommand(object source, GridCommandEventArgs e)
        {
            var editableItem = ((GridEditableItem)e.Item);

            using (var dbContext = new OTERTConnStr()) {
                var       lineType = new LineTypes();
                Hashtable values   = new Hashtable();
                editableItem.ExtractValues(values);
                lineType.Name = (string)values["Name"];
                dbContext.LineTypes.Add(lineType);
                try { dbContext.SaveChanges(); }
                catch (Exception) { ShowErrorMessage(-1); }
            }
        }
Ejemplo n.º 21
0
        public static void DrawLineTest(int x1        = 50, int y1 = 50, int x2 = 200, int y2 = 100, byte red = 255, byte green = 0, byte blue = 0,
                                        int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            Glb.DrawMatAndHist0(Glb.matSrc);

            Mat    mDst  = Glb.matSrc.Clone();
            Scalar color = new Scalar(blue, green, red);

            mDst.Line(x1, y1, x2, y2, color, thickness, lineType, shift = 0);
            Glb.DrawMatAndHist1(mDst);

            Glb.DrawMatAndHist2(null);
            mDst.Dispose();
        }
Ejemplo n.º 22
0
 public LineNode(AstNodeArgs args)
     : base(args)
 {
     LineTypes  = LineTypes.InternalLine;            // overwritten later by JavaScriptGenerator
     LineNumber = (int)((Token)args.ChildNodes[0]).Value;
     if (args.ChildNodes.Count > 2)
     {
         StatementList = (GenericJsBasicNode)args.ChildNodes[1];
     }
     else
     {
         StatementList = new GenericJsBasicNode(args);                 //empty node
     }
 }
Ejemplo n.º 23
0
 internal override void ProcessProperty(int index, LineTypes.Property line, IParentObject obj, System.Collections.Generic.Stack<GameObject> objectStack, ParserContext context)
 {
     Floor tempObj = (Floor)obj;
     switch (index) {
         case 0:
             tempObj.name = line.argumentsData[0].ToString();
             break;
         case 1:
             tempObj.diffuse = (Texture2D)line.argumentsData[0];
             break;
         case 2:
             tempObj.normal = (Texture2D)line.argumentsData[0];
             break;
     }
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LineShape"/> class.
        /// </summary>
        /// <param name="bounds">The line boundaries.</param>
        /// <param name="width">The line width, in pixels.</param>
        /// <param name="types">The line types.</param>
        /// <exception cref="ArgumentOutOfRangeException">
        /// The <paramref name="width"/> is zero or less.
        /// </exception>
        public LineShape(Rectangle bounds, int width, LineTypes types)
            : base(bounds)
        {
            if (width <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(width), width, "The line width is invalid.");
            }

            Point center = bounds.CenterPoint;

            this.Begin = types.HasFlag(LineTypes.Vertical) ? new Point(center.X, bounds.Top) : new Point(bounds.Left, center.Y);
            this.End   = types.HasFlag(LineTypes.Vertical) ? new Point(center.X, bounds.Bottom) : new Point(bounds.Right, center.Y);
            this.Width = width;
            this.Types = types;
        }
Ejemplo n.º 25
0
        public string DrawLine(LineTypes lineType)
        {
            switch (lineType)
            {
                case LineTypes.Stars:
                    return "***********************************************";
                case LineTypes.Equals:
                    return "===============================================";
                case LineTypes.UnderScore:
                    return "_______________________________________________";
                case LineTypes.Fishy:
                    return " <º)))><¸.·´¯`·.¸.·´¯`·.´¯`·.¸¸.·´¯`·.¸><(((º> ";
                default:

                    return "ERRORDAMMIT!";
            }
        }
Ejemplo n.º 26
0
        private void AddDefaultObjects()
        {
            // collections
            this.vports        = new VPorts(this);
            this.views         = new Views(this);
            this.appRegistries = new ApplicationRegistries(this);
            this.layers        = new Layers(this);
            this.lineTypes     = new LineTypes(this);
            this.textStyles    = new TextStyles(this);
            this.dimStyles     = new DimensionStyles(this);
            this.mlineStyles   = new MLineStyles(this);
            this.ucss          = new UCSs(this);
            this.blocks        = new BlockRecords(this);
            this.imageDefs     = new ImageDefinitions(this);
            this.groups        = new Groups(this);
            this.layouts       = new Layouts(this);

            //add default viewport
            this.vports.Add(VPort.Active);

            //add default layer
            this.layers.Add(Layer.Default);

            // add default line types
            this.lineTypes.Add(LineType.ByLayer);
            this.lineTypes.Add(LineType.ByBlock);
            this.lineTypes.Add(LineType.Continuous);

            // add default text style
            this.textStyles.Add(TextStyle.Default);

            // add default application registry
            this.appRegistries.Add(ApplicationRegistry.Default);

            // add default dimension style
            this.dimStyles.Add(DimensionStyle.Default);

            // add default MLine style
            this.mlineStyles.Add(MLineStyle.Default);

            // add ModelSpace layout
            this.layouts.Add(Layout.ModelSpace);

            // raster variables
            this.RasterVariables = new RasterVariables();
        }
        public GeodeticCurveType DeriveCurveType(LineTypes type)
        {
            GeodeticCurveType curveType = GeodeticCurveType.Geodesic;

            if (type == LineTypes.Geodesic)
            {
                curveType = GeodeticCurveType.Geodesic;
            }
            else if (type == LineTypes.GreatElliptic)
            {
                curveType = GeodeticCurveType.GreatElliptic;
            }
            else if (type == LineTypes.Loxodrome)
            {
                curveType = GeodeticCurveType.Loxodrome;
            }
            return(curveType);
        }
Ejemplo n.º 28
0
        public Mat ImageWithText(out int correctNumber)
        {
            Scalar       color     = new Scalar(255);
            HersheyFonts font      = HersheyFonts.HersheyPlain;
            double       fontScale = 1.0;
            int          thickness = 1;
            LineTypes    lineType  = LineTypes.Link4;
            string       text      = "Mizu?";

            Size textSize = GraphicsHelper.GetTextSize("Mizu?", font, fontScale);
            Mat  result   = new Mat(textSize.Height + 10, textSize.Width + 20, MatType.CV_8UC1, new Scalar(0));

            GraphicsHelper.PutTextWithCenter(result, new Point(result.Cols / 2, result.Rows / 2),
                                             text, color, font, fontScale, thickness, lineType);

            correctNumber = 8;
            return(result);
        }
Ejemplo n.º 29
0
        public static void WriteLine(this RichTextBox textBox, string text, LineTypes type = LineTypes.Text)
        {
            Color color;

            switch (type)
            {
            case LineTypes.Text:
                color = Color.WhiteSmoke;
                break;

            case LineTypes.Warning:
                color = Color.Orange;
                break;

            case LineTypes.Error:
                color = Color.Red;
                break;

            case LineTypes.Success:
                color = Color.Green;
                break;

            case LineTypes.CtWin:
                color = Color.Aqua;
                break;

            case LineTypes.TerroristWin:
                color = Color.DarkOrange;
                break;

            default:
                color = Color.WhiteSmoke;
                break;
            }

            textBox.SelectionStart  = textBox.TextLength;
            textBox.SelectionLength = 0;
            textBox.SelectionColor  = color;
            textBox.AppendText(DateTime.Now.ToString(CultureInfo.InvariantCulture) + " " + text + Environment.NewLine);
            textBox.SelectionColor = textBox.ForeColor;
        }
Ejemplo n.º 30
0
    // Use this for initialization
    void Start()
    {
        lineTypes = GetComponent <LineTypes>();

        lineThickness = startThickness;
        scrollSpeed   = startSpeed;

        Vector3 lowerLeft  = mainCamera.ScreenToWorldPoint(new Vector3(0, 0, 0));
        Vector3 upperRight = mainCamera.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));

        screenLeft   = lowerLeft.x;
        screenRight  = upperRight.x;
        screenTop    = upperRight.y;
        screenBottom = lowerLeft.y;
        screenWidth  = Mathf.Abs(screenRight - screenLeft);
        screenHeight = Mathf.Abs(screenTop - screenBottom);

        createLine(lineTypes.straightLine(new Vector3(0, screenBottom, 0), new Vector3(0, screenBottom + screenHeight * 2, 0)), lineThickness);

        coinGenerator = coinGen.GetComponent <coinScript>();
    }
Ejemplo n.º 31
0
 public unsafe static extern void cvFillConvexPoly(IplImage *img, [In] Point[] pts, int npts,
                                                   CvScalar color,
                                                   LineTypes lineType, int shift);
Ejemplo n.º 32
0
        /// <summary>
        /// 輪郭線,または内側が塗りつぶされた輪郭を描きます.
        /// </summary>
        /// <param name="image">出力画像</param>
        /// <param name="contours"> 入力される全輪郭.各輪郭は,点のベクトルとして格納されています.</param>
        /// <param name="contourIdx">描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます.</param>
        /// <param name="color">輪郭の色.</param>
        /// <param name="thickness">輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます.</param>
        /// <param name="lineType">線の連結性</param>
        /// <param name="hierarchy">階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります.</param>
        /// <param name="maxLevel">描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます.
        /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と,
        /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, 
        /// hierarchy が有効な場合のみ考慮されます.</param>
        /// <param name="offset">輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます.</param>
#else
        /// <summary>
        /// draws contours in the image
        /// </summary>
        /// <param name="image">Destination image.</param>
        /// <param name="contours">All the input contours. Each contour is stored as a point vector.</param>
        /// <param name="contourIdx">Parameter indicating a contour to draw. If it is negative, all the contours are drawn.</param>
        /// <param name="color">Color of the contours.</param>
        /// <param name="thickness">Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), 
        /// the contour interiors are drawn.</param>
        /// <param name="lineType">Line connectivity. </param>
        /// <param name="hierarchy">Optional information about hierarchy. It is only needed if you want to draw only some of the contours</param>
        /// <param name="maxLevel">Maximal level for drawn contours. If it is 0, only the specified contour is drawn. 
        /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, 
        /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account 
        /// when there is hierarchy available.</param>
        /// <param name="offset">Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)</param>
#endif
        public static void DrawContours(
            InputOutputArray image,
            IEnumerable<IEnumerable<Point>> contours,
            int contourIdx,
            Scalar color,
            int thickness = 1,
            LineTypes lineType = LineTypes.Link8,
            IEnumerable<HierarchyIndex> hierarchy = null,
            int maxLevel = Int32.MaxValue,
            Point? offset = null)
        {
            if (image == null)
                throw new ArgumentNullException(nameof(image));
            if (contours == null)
                throw new ArgumentNullException(nameof(contours));
            image.ThrowIfNotReady();

            Point offset0 = offset.GetValueOrDefault(new Point());
            Point[][] contoursArray = EnumerableEx.SelectToArray(contours, EnumerableEx.ToArray);
            int[] contourSize2 = EnumerableEx.SelectToArray(contoursArray, pts => pts.Length);
            using (var contoursPtr = new ArrayAddress2<Point>(contoursArray))
            {
                if (hierarchy == null)
                {
                    NativeMethods.imgproc_drawContours_vector(image.CvPtr, contoursPtr.Pointer, contoursArray.Length, contourSize2,
                        contourIdx, color, thickness, (int)lineType, IntPtr.Zero, 0, maxLevel, offset0);
                }
                else
                {
                    Vec4i[] hiearchyVecs = EnumerableEx.SelectToArray(hierarchy, hi => hi.ToVec4i());
                    NativeMethods.imgproc_drawContours_vector(image.CvPtr, contoursPtr.Pointer, contoursArray.Length, contourSize2,
                        contourIdx, color, thickness, (int)lineType, hiearchyVecs, hiearchyVecs.Length, maxLevel, offset0);
                }
            }

            image.Fix();
        }
Ejemplo n.º 33
0
        /// <summary>
        /// draws one or more polygonal curves
        /// </summary>
        /// <param name="img"></param>
        /// <param name="pts"></param>
        /// <param name="isClosed"></param>
        /// <param name="color"></param>
        /// <param name="thickness"></param>
        /// <param name="lineType"></param>
        /// <param name="shift"></param>
        public static void Polylines(
            InputOutputArray img, InputArray pts, bool isClosed, Scalar color,
            int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            if (pts == null)
                throw new ArgumentNullException(nameof(pts));
            img.ThrowIfDisposed();
            pts.ThrowIfDisposed();

            NativeMethods.imgproc_polylines_InputOutputArray(
                img.CvPtr, pts.CvPtr, isClosed ? 1 : 0, color, thickness, (int)lineType, shift);

            img.Fix();
            GC.KeepAlive(pts);
        }
Ejemplo n.º 34
0
        public int GetTotalLineCount(LineTypes lineType, FileTypes fileType, bool scale)
        {
            var sloc = from v in Sloc.ToDictionary()[fileType]
                                 from x in v.Lines
                                 where x.LineType == lineType
                                 select x;

            return sloc.Count();
        }
Ejemplo n.º 35
0
        /// <summary>
        /// 円を描画する
        /// </summary>
        /// <param name="img">画像</param>
        /// <param name="centerX">円の中心のx座標</param>
        /// <param name="centerY">円の中心のy座標</param>
        /// <param name="radius">円の半径</param>
        /// <param name="color">円の色</param>
        /// <param name="thickness">線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1]</param>
        /// <param name="lineType">線の種類. [既定値はLineType.Link8]</param>
        /// <param name="shift">中心座標と半径の小数点以下の桁を表すビット数. [既定値は0]</param>
#else
        /// <summary>
        /// Draws a circle
        /// </summary>
        /// <param name="img">Image where the circle is drawn. </param>
        /// <param name="centerX">X-coordinate of the center of the circle. </param>
        /// <param name="centerY">Y-coordinate of the center of the circle. </param>
        /// <param name="radius">Radius of the circle. </param>
        /// <param name="color">Circle color. </param>
        /// <param name="thickness">Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1]</param>
        /// <param name="lineType">Type of the circle boundary. [By default this is LineType.Link8]</param>
        /// <param name="shift">Number of fractional bits in the center coordinates and radius value. [By default this is 0]</param>
#endif
        public static void Circle(InputOutputArray img, int centerX, int centerY, int radius, Scalar color,
            int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            Circle(img, new Point(centerX, centerY), radius, color, thickness, lineType, shift);
        }
Ejemplo n.º 36
0
        /// <summary>
        /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします.
        /// </summary>
        /// <param name="img">画像</param>
        /// <param name="pts">ポリゴンの配列.各要素は,点の配列で表現されます.</param>
        /// <param name="color">ポリゴンの色.</param>
        /// <param name="lineType">ポリゴンの枠線の種類,</param>
        /// <param name="shift">ポリゴンの頂点座標において,小数点以下の桁を表すビット数.</param>
        /// <param name="offset"></param>
#else
        /// <summary>
        /// Fills the area bounded by one or more polygons
        /// </summary>
        /// <param name="img">Image</param>
        /// <param name="pts">Array of polygons, each represented as an array of points</param>
        /// <param name="color">Polygon color</param>
        /// <param name="lineType">Type of the polygon boundaries</param>
        /// <param name="shift">The number of fractional bits in the vertex coordinates</param>
        /// <param name="offset"></param>
#endif
        public static void FillPoly(
            InputOutputArray img, InputArray pts, Scalar color,
            LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            if (pts == null) 
                throw new ArgumentNullException(nameof(pts));
            img.ThrowIfDisposed();
            pts.ThrowIfDisposed();
            Point offset0 = offset.GetValueOrDefault(new Point());

            NativeMethods.imgproc_fillPoly_InputOutputArray(
                img.CvPtr, pts.CvPtr, color, (int)lineType, shift, offset0);

            GC.KeepAlive(pts);
            img.Fix();
        }
Ejemplo n.º 37
0
		//*******************************************************************************************
		/// <summary>
		///
		/// </summary>
		//*******************************************************************************************
		public void Draw(int x1, int y1, int x2, int y2, LineTypes lineType)
		{
			CheckDisposed();

			g_LineType = lineType;
			Draw(x1, y1, x2, y2);
		}
Ejemplo n.º 38
0
 /// <summary>
 /// renders text string in the image
 /// </summary>
 /// <param name="img"></param>
 /// <param name="text"></param>
 /// <param name="org"></param>
 /// <param name="fontFace"></param>
 /// <param name="fontScale"></param>
 /// <param name="color"></param>
 /// <param name="thickness"></param>
 /// <param name="lineType"></param>
 /// <param name="bottomLeftOrigin"></param>
 public static void PutText(InputOutputArray img, string text, Point org,
     HersheyFonts fontFace, double fontScale, Scalar color,
     int thickness = 1, LineTypes lineType = LineTypes.Link8, bool bottomLeftOrigin = false)
 {
     if (img == null)
         throw new ArgumentNullException(nameof(img));
     if (String.IsNullOrEmpty(text))
         throw new ArgumentNullException(text);
     img.ThrowIfDisposed();
     NativeMethods.core_putText(img.CvPtr, text, org, (int)fontFace, fontScale, color,
         thickness, (int)lineType, bottomLeftOrigin ? 1 : 0);
     img.Fix();
 }
Ejemplo n.º 39
0
 private void AddMissingLineTypes(HashSet <string> existingLineTypes, IEnumerable <string> lineTypesToAdd)
 {
     AddMissingTableItems <DxfLineType>(existingLineTypes, lineTypesToAdd, name => new DxfLineType(name), lt => LineTypes.Add(lt));
 }
Ejemplo n.º 40
0
 //*******************************************************************************************
 /// <summary>
 /// Constructor 3
 /// </summary>
 //*******************************************************************************************
 public LineDrawing(Graphics g, LineTypes lineType)
 {
     g_graphics = g;
     g_LineType = lineType;
 }
Ejemplo n.º 41
0
 //*******************************************************************************************
 /// <summary>
 /// Constructor 6
 /// </summary>
 //*******************************************************************************************
 public LineDrawing(Graphics g, int x1, int y1, int x2, int y2, LineTypes lineType)
 {
     Draw(g, x1, y1, x2, y2, lineType);
 }
Ejemplo n.º 42
0
		//*******************************************************************************************
		/// <summary>
		///
		/// </summary>
		//*******************************************************************************************
		public void Draw(int x1, int y1, int x2, int y2, Color solidLineColor)
		{
			CheckDisposed();

			g_StartLocation = new Point(x1, y1);
			g_EndLocation = new Point(x2, y2);
			g_penSolidLine.Color = solidLineColor;
			g_LineType = LineTypes.Solid;
			Draw();
		}
Ejemplo n.º 43
0
		//*******************************************************************************************
		/// <summary>
		/// Constructor 3
		/// </summary>
		//*******************************************************************************************
		public LineDrawing(Graphics g, LineTypes lineType)
		{
			g_graphics = g;
			g_LineType = lineType;
		}
Ejemplo n.º 44
0
		//*******************************************************************************************
		/// <summary>
		///
		/// </summary>
		//*******************************************************************************************
		static public void Draw(Graphics g, int x1, int y1, int x2, int y2, LineTypes lineType)
		{
			g_LineType = lineType;
			Draw(g, x1, y1, x2, y2);
		}
Ejemplo n.º 45
0
 public unsafe static extern void cvInitFont(ref Font font, FontTypes fontFace, double hscale, double vscale, double shear,
                                             int thickness, LineTypes lineType);
Ejemplo n.º 46
0
        /// <summary>
        /// 1つ,または複数のポリゴンで区切られた領域を塗りつぶします.
        /// </summary>
        /// <param name="img">画像</param>
        /// <param name="pts">ポリゴンの配列.各要素は,点の配列で表現されます.</param>
        /// <param name="color">ポリゴンの色.</param>
        /// <param name="lineType">ポリゴンの枠線の種類,</param>
        /// <param name="shift">ポリゴンの頂点座標において,小数点以下の桁を表すビット数.</param>
        /// <param name="offset"></param>
#else
        /// <summary>
        /// Fills the area bounded by one or more polygons
        /// </summary>
        /// <param name="img">Image</param>
        /// <param name="pts">Array of polygons, each represented as an array of points</param>
        /// <param name="color">Polygon color</param>
        /// <param name="lineType">Type of the polygon boundaries</param>
        /// <param name="shift">The number of fractional bits in the vertex coordinates</param>
        /// <param name="offset"></param>
#endif
        public static void FillPoly(
            Mat img, IEnumerable<IEnumerable<Point>> pts, Scalar color,
            LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            img.ThrowIfDisposed();
            Point offset0 = offset.GetValueOrDefault(new Point());

            List<Point[]> ptsList = new List<Point[]>();
            List<int> nptsList = new List<int>();
            foreach (IEnumerable<Point> pts1 in pts)
            {
                Point[] pts1Arr = EnumerableEx.ToArray(pts1);
                ptsList.Add(pts1Arr);
                nptsList.Add(pts1Arr.Length);
            }
            Point[][] ptsArr = ptsList.ToArray();
            int[] npts = nptsList.ToArray();
            int ncontours = ptsArr.Length;
            using (var ptsPtr = new ArrayAddress2<Point>(ptsArr))
            {
                NativeMethods.imgproc_fillPoly_Mat(
                    img.CvPtr, ptsPtr.Pointer, npts, ncontours, color, (int)lineType, shift, offset0);
            }
        }
Ejemplo n.º 47
0
        /// <summary>
        /// draws one or more polygonal curves
        /// </summary>
        /// <param name="img"></param>
        /// <param name="pts"></param>
        /// <param name="isClosed"></param>
        /// <param name="color"></param>
        /// <param name="thickness"></param>
        /// <param name="lineType"></param>
        /// <param name="shift"></param>
        public static void Polylines(
            Mat img, IEnumerable<IEnumerable<Point>> pts, bool isClosed, Scalar color,
            int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            img.ThrowIfDisposed();

            List<Point[]> ptsList = new List<Point[]>();
            List<int> nptsList = new List<int>();
            foreach (IEnumerable<Point> pts1 in pts)
            {
                Point[] pts1Arr = EnumerableEx.ToArray(pts1);
                ptsList.Add(pts1Arr);
                nptsList.Add(pts1Arr.Length);
            }
            Point[][] ptsArr = ptsList.ToArray();
            int[] npts = nptsList.ToArray();
            int ncontours = ptsArr.Length;
            using (ArrayAddress2<Point> ptsPtr = new ArrayAddress2<Point>(ptsArr))
            {
                NativeMethods.imgproc_polylines_Mat(
                    img.CvPtr, ptsPtr.Pointer, npts, ncontours, isClosed ? 1 : 0, color, thickness, (int)lineType, shift);
            }
        }
Ejemplo n.º 48
0
        /// <summary>
        /// 輪郭線,または内側が塗りつぶされた輪郭を描きます.
        /// </summary>
        /// <param name="image">出力画像</param>
        /// <param name="contours"> 入力される全輪郭.各輪郭は,点のベクトルとして格納されています.</param>
        /// <param name="contourIdx">描かれる輪郭を示します.これが負値の場合,すべての輪郭が描画されます.</param>
        /// <param name="color">輪郭の色.</param>
        /// <param name="thickness">輪郭線の太さ.これが負値の場合(例えば thickness=CV_FILLED ),輪郭の内側が塗りつぶされます.</param>
        /// <param name="lineType">線の連結性</param>
        /// <param name="hierarchy">階層に関するオプションの情報.これは,特定の輪郭だけを描画したい場合にのみ必要になります.</param>
        /// <param name="maxLevel">描画される輪郭の最大レベル.0ならば,指定された輪郭のみが描画されます.
        /// 1ならば,指定された輪郭と,それに入れ子になったすべての輪郭が描画されます.2ならば,指定された輪郭と,
        /// それに入れ子になったすべての輪郭,さらにそれに入れ子になったすべての輪郭が描画されます.このパラメータは, 
        /// hierarchy が有効な場合のみ考慮されます.</param>
        /// <param name="offset">輪郭をシフトするオプションパラメータ.指定された offset = (dx,dy) だけ,すべての描画輪郭がシフトされます.</param>
#else
        /// <summary>
        /// draws contours in the image
        /// </summary>
        /// <param name="image">Destination image.</param>
        /// <param name="contours">All the input contours. Each contour is stored as a point vector.</param>
        /// <param name="contourIdx">Parameter indicating a contour to draw. If it is negative, all the contours are drawn.</param>
        /// <param name="color">Color of the contours.</param>
        /// <param name="thickness">Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), 
        /// the contour interiors are drawn.</param>
        /// <param name="lineType">Line connectivity. </param>
        /// <param name="hierarchy">Optional information about hierarchy. It is only needed if you want to draw only some of the contours</param>
        /// <param name="maxLevel">Maximal level for drawn contours. If it is 0, only the specified contour is drawn. 
        /// If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, 
        /// all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account 
        /// when there is hierarchy available.</param>
        /// <param name="offset">Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)</param>
#endif
        public static void DrawContours(
            InputOutputArray image,
            IEnumerable<Mat> contours,
            int contourIdx,
            Scalar color,
            int thickness = 1,
            LineTypes lineType = LineTypes.Link8,
            Mat hierarchy = null,
            int maxLevel = Int32.MaxValue,
            Point? offset = null)
        {
            if (image == null)
                throw new ArgumentNullException(nameof(image));
            if (contours == null)
                throw new ArgumentNullException(nameof(contours));
            image.ThrowIfNotReady();

            Point offset0 = offset.GetValueOrDefault(new Point());
            IntPtr[] contoursPtr = EnumerableEx.SelectPtrs(contours);
            NativeMethods.imgproc_drawContours_InputArray(image.CvPtr, contoursPtr, contoursPtr.Length,
                        contourIdx, color, thickness, (int)lineType, ToPtr(hierarchy), maxLevel, offset0);
            image.Fix();
        }
Ejemplo n.º 49
0
		//*******************************************************************************************
		/// <summary>
		/// Constructor 4
		/// </summary>
		//*******************************************************************************************
		public LineDrawing(Graphics g, int x, int y, int dxpLength, LineTypes lineType)
		{
			Draw(g, x, y, dxpLength, lineType);
		}
Ejemplo n.º 50
0
        /// <summary>
        /// 塗りつぶされた凸ポリゴンを描きます.
        /// </summary>
        /// <param name="img">画像</param>
        /// <param name="pts">ポリゴンの頂点.</param>
        /// <param name="color">ポリゴンの色.</param>
        /// <param name="lineType">ポリゴンの枠線の種類,</param>
        /// <param name="shift">ポリゴンの頂点座標において,小数点以下の桁を表すビット数.</param>
#else
        /// <summary>
        /// Fills a convex polygon.
        /// </summary>
        /// <param name="img">Image</param>
        /// <param name="pts">The polygon vertices</param>
        /// <param name="color">Polygon color</param>
        /// <param name="lineType">Type of the polygon boundaries</param>
        /// <param name="shift">The number of fractional bits in the vertex coordinates</param>
#endif
        public static void FillConvexPoly(Mat img, IEnumerable<Point> pts, Scalar color,
            LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            img.ThrowIfDisposed();

            Point[] ptsArray = EnumerableEx.ToArray(pts);
            NativeMethods.imgproc_fillConvexPoly_Mat(img.CvPtr, ptsArray, ptsArray.Length, color, (int)lineType, shift);
            GC.KeepAlive(img);
        }
Ejemplo n.º 51
0
 //*******************************************************************************************
 /// <summary>
 ///
 /// </summary>
 //*******************************************************************************************
 static public void Draw(Graphics g, int x1, int y1, int x2, int y2, LineTypes lineType)
 {
     g_LineType = lineType;
     Draw(g, x1, y1, x2, y2);
 }
Ejemplo n.º 52
0
		//*******************************************************************************************
		/// <summary>
		/// Constructor 6
		/// </summary>
		//*******************************************************************************************
		public LineDrawing(Graphics g, int x1, int y1, int x2, int y2, LineTypes lineType)
		{
			Draw(g, x1, y1, x2, y2, lineType);
		}
Ejemplo n.º 53
0
 //*******************************************************************************************
 /// <summary>
 /// Constructor 4
 /// </summary>
 //*******************************************************************************************
 public LineDrawing(Graphics g, int x, int y, int dxpLength, LineTypes lineType)
 {
     Draw(g, x, y, dxpLength, lineType);
 }
Ejemplo n.º 54
0
		//*******************************************************************************************
		/// <summary>
		///
		/// </summary>
		//*******************************************************************************************
		static public void Draw(int x, int y, int dxpLength, LineTypes lineType)
		{
			g_LineType = lineType;
			Draw(g_graphics, x, y, dxpLength);
		}
Ejemplo n.º 55
0
 //*******************************************************************************************
 /// <summary>
 ///
 /// </summary>
 //*******************************************************************************************
 static public void Draw(int x, int y, int dxpLength, LineTypes lineType)
 {
     g_LineType = lineType;
     Draw(g_graphics, x, y, dxpLength);
 }
Ejemplo n.º 56
0
        /// <summary>
        /// 枠だけの楕円,もしくは塗りつぶされた楕円を描画する
        /// </summary>
        /// <param name="img">楕円が描かれる画像.</param>
        /// <param name="box">描画したい楕円を囲む矩形領域.</param>
        /// <param name="color">楕円の色.</param>
        /// <param name="thickness">楕円境界線の幅.[既定値は1]</param>
        /// <param name="lineType">楕円境界線の種類.[既定値はLineType.Link8]</param>
#else
        /// <summary>
        /// Draws simple or thick elliptic arc or fills ellipse sector
        /// </summary>
        /// <param name="img">Image. </param>
        /// <param name="box">The enclosing box of the ellipse drawn </param>
        /// <param name="color">Ellipse color. </param>
        /// <param name="thickness">Thickness of the ellipse boundary. [By default this is 1]</param>
        /// <param name="lineType">Type of the ellipse boundary. [By default this is LineType.Link8]</param>
#endif
        public static void Ellipse(InputOutputArray img, RotatedRect box, Scalar color,
            int thickness = 1, LineTypes lineType = LineTypes.Link8)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            img.ThrowIfDisposed();
            NativeMethods.imgproc_ellipse2(img.CvPtr, box, color, thickness, (int)lineType);
            img.Fix();
        }
Ejemplo n.º 57
0
        /// <summary>
        /// 枠だけの楕円,楕円弧,もしくは塗りつぶされた扇形の楕円を描画する
        /// </summary>
        /// <param name="img">楕円が描画される画像</param>
        /// <param name="center">楕円の中心</param>
        /// <param name="axes">楕円の軸の長さ</param>
        /// <param name="angle">回転角度</param>
        /// <param name="startAngle">楕円弧の開始角度</param>
        /// <param name="endAngle">楕円弧の終了角度</param>
        /// <param name="color">楕円の色</param>
        /// <param name="thickness">楕円弧の線の幅 [既定値は1]</param>
        /// <param name="lineType">楕円弧の線の種類 [既定値はLineType.Link8]</param>
        /// <param name="shift">中心座標と軸の長さの小数点以下の桁を表すビット数 [既定値は0]</param>
#else
        /// <summary>
        /// Draws simple or thick elliptic arc or fills ellipse sector
        /// </summary>
        /// <param name="img">Image. </param>
        /// <param name="center">Center of the ellipse. </param>
        /// <param name="axes">Length of the ellipse axes. </param>
        /// <param name="angle">Rotation angle. </param>
        /// <param name="startAngle">Starting angle of the elliptic arc. </param>
        /// <param name="endAngle">Ending angle of the elliptic arc. </param>
        /// <param name="color">Ellipse color. </param>
        /// <param name="thickness">Thickness of the ellipse arc. [By default this is 1]</param>
        /// <param name="lineType">Type of the ellipse boundary. [By default this is LineType.Link8]</param>
        /// <param name="shift">Number of fractional bits in the center coordinates and axes' values. [By default this is 0]</param>
#endif
        public static void Ellipse(
            InputOutputArray img, Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color,
            int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            img.ThrowIfNotReady();
            NativeMethods.imgproc_ellipse1(img.CvPtr, center, axes, angle, startAngle, endAngle, color, thickness, (int)lineType, shift);
            img.Fix();
        }
Ejemplo n.º 58
0
        /// <summary>
        /// 円を描画する
        /// </summary>
        /// <param name="img">画像</param>
        /// <param name="center">円の中心</param>
        /// <param name="radius">円の半径</param>
        /// <param name="color">円の色</param>
        /// <param name="thickness">線の幅.負の値を指定した場合は塗りつぶされる.[既定値は1]</param>
        /// <param name="lineType">線の種類. [既定値はLineType.Link8]</param>
        /// <param name="shift">中心座標と半径の小数点以下の桁を表すビット数. [既定値は0]</param>
#else
        /// <summary>
        /// Draws a circle
        /// </summary>
        /// <param name="img">Image where the circle is drawn. </param>
        /// <param name="center">Center of the circle. </param>
        /// <param name="radius">Radius of the circle. </param>
        /// <param name="color">Circle color. </param>
        /// <param name="thickness">Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1]</param>
        /// <param name="lineType">Type of the circle boundary. [By default this is LineType.Link8]</param>
        /// <param name="shift">Number of fractional bits in the center coordinates and radius value. [By default this is 0]</param>
#endif
        public static void Circle(InputOutputArray img, Point center, int radius, Scalar color,
            int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            img.ThrowIfDisposed();
            NativeMethods.imgproc_circle(img.CvPtr, center, radius, color, thickness, (int)lineType, shift);
            img.Fix();
        }
Ejemplo n.º 59
0
		//*******************************************************************************************
		/// <summary>
		///
		/// </summary>
		//*******************************************************************************************
		static public void Draw(Graphics g, int x1, int y1, int x2, int y2, Color solidLineColor)
		{
			g_graphics = g;
			g_StartLocation = new Point(x1, y1);
			g_EndLocation = new Point(x2, y2);
			g_penSolidLine.Color = solidLineColor;
			g_LineType = LineTypes.Solid;
			Draw();
		}
Ejemplo n.º 60
0
        /// <summary>
        /// 塗りつぶされた凸ポリゴンを描きます.
        /// </summary>
        /// <param name="img">画像</param>
        /// <param name="pts">ポリゴンの頂点.</param>
        /// <param name="color">ポリゴンの色.</param>
        /// <param name="lineType">ポリゴンの枠線の種類,</param>
        /// <param name="shift">ポリゴンの頂点座標において,小数点以下の桁を表すビット数.</param>
#else
        /// <summary>
        /// Fills a convex polygon.
        /// </summary>
        /// <param name="img">Image</param>
        /// <param name="pts">The polygon vertices</param>
        /// <param name="color">Polygon color</param>
        /// <param name="lineType">Type of the polygon boundaries</param>
        /// <param name="shift">The number of fractional bits in the vertex coordinates</param>
#endif
        public static void FillConvexPoly(InputOutputArray img, InputArray pts, Scalar color,
            LineTypes lineType = LineTypes.Link8, int shift = 0)
        {
            if (img == null)
                throw new ArgumentNullException(nameof(img));
            if (pts == null) 
                throw new ArgumentNullException(nameof(pts));
            img.ThrowIfDisposed();
            pts.ThrowIfDisposed();

            NativeMethods.imgproc_fillConvexPoly_InputOutputArray(
                img.CvPtr, pts.CvPtr, color, (int)lineType, shift);
            GC.KeepAlive(img);
            GC.KeepAlive(pts);
        }