示例#1
0
        private void DrawFixture(Fixture fixture)
        {
            var color = Color.FromArgb(242, 242, 153);
            var xf    = fixture.Body.GetTransform();

            switch (fixture.Shape)
            {
            case CircleShape circle:
            {
                var center = MathUtils.Mul(xf, circle.Position);
                var radius = circle.Radius + 0.01f;

                _drawer.DrawCircle(center, radius, color);
            }
            break;

            case PolygonShape polygonShape:
            {
                var vertexCount = polygonShape.Count;
                Debug.Assert(vertexCount <= Settings.MaxPolygonVertices);
                var vertices = new Vector2[Settings.MaxPolygonVertices];

                for (var i = 0; i < vertexCount; ++i)
                {
                    var v = MathUtils.Mul(xf, polygonShape.Vertices[i]);
                    v.X        += 0.01f;
                    v.Y        += 0.01f;
                    vertices[i] = v;
                }

                _drawer.DrawPolygon(vertices, vertexCount, color);
            }
            break;
            }
        }
示例#2
0
        void DrawLion()
        {
            //set gamma settings
            drawer.GammaCorrected = chkUseGamma.Checked;
            drawer.SetGamma(gammaFactorRed, gammaFactorGreen, gammaFactorBlue);

            //clear background
            drawer.Clear(Colors.White);

            //get coordinates and colors
            double[][] polygons = LionPathHelper.GetLionPolygons();
            Color[]    colors   = LionPathHelper.GetLionColors();

            //iterate all polygons and draw them
            double[] coordinates = null;
            for (int i = 0; i < polygons.Length; i++)
            {
                coordinates = polygons[i];
                Fill fill = new Fill(colors[i]);
                drawer.DrawPolygon(fill, coordinates);
            }

            //show to screen
            DisplayBuffer(buffer);
        }
示例#3
0
        void DrawLion()
        {
            //get coordinates and colors
            double[][] polygons = LionPathHelper.GetLionPolygons();
            Color[]    colors   = LionPathHelper.GetLionColors();

            drawer.GammaCorrected = false;//DEBUG - ColorRasterizer is not yet finished

            //iterate all polygons and draw them
            double[] coordinates = null;
            for (int i = 0; i < polygons.Length; i++)
            {
                coordinates = polygons[i];
                Fill fill = new Fill(colors[i]);
                fill.FillingRule = FillingRule.EvenOdd;//DEBUG - ColorRasterizer is not yet finished

                drawer.DrawPolygon(fill, coordinates);
            }
        }
示例#4
0
        private void Draw()
        {
            //clear background
            drawer.Clear(Colors.White);

            //draw test
            coordinates = GetPath();
            Fill fill = GetFill();

            drawer.DrawPolygon(fill, coordinates);

            //show to form
            DisplayBuffer(buffer);
        }
        void DrawShape()
        {
            Fill fill = Fills.YellowGreen;

            fill.Opacity = 0.5;

            double[] poly = new double[]
            {
                50, 50
                , 80, 50
                , 100, 20
                , 120, 50
                , 150, 50
                , 150, 150
                , 50, 150
                , 50, 50
            };

            drawer.DrawPolygon(fill, poly);
        }