Esempio n. 1
0
        public trans_curve1_application()
        {
            m_poly = new PolygonEditWidget(6, 5);
            on_init();
            m_poly.Changed += NeedsRedraw;
            this.NumPoints  = 200;


            //m_num_points = new MatterHackers.Agg.UI.Slider(5, 5, 340, 12);

            //m_num_points.ValueChanged += new EventHandler(NeedsRedraw);

            //AddChild(m_num_points);

            //m_num_points.Text = "Number of intermediate Points = {0:F3}";
            //m_num_points.SetRange(10, 400);
            //m_num_points.Value = 200;

            //m_close = new CheckBox(350, 5.0, "Close");
            //m_close.CheckedStateChanged += NeedsRedraw;
            //AddChild(m_close);

            //m_preserve_x_scale = new CheckBox(460, 5, "Preserve X scale");
            //m_preserve_x_scale.CheckedStateChanged += NeedsRedraw;
            //AddChild(m_preserve_x_scale);

            //m_fixed_len = new CheckBox(350, 25, "Fixed Length");
            //m_fixed_len.CheckedStateChanged += NeedsRedraw;
            //AddChild(m_fixed_len);

            //m_animate = new CheckBox(460, 25, "Animate");
            //m_animate.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(m_animate_CheckedStateChanged);
            //AddChild(m_animate);
        }
Esempio n. 2
0
        public BlurWithPainter()
        {
            //m_rbuf2 = new ReferenceImage();
            m_shape_bounds           = new RectD();
            m_shadow_ctrl            = new PolygonEditWidget(4);
            this.FlattenCurveChecked = true;
            this.BlurMethod          = BlurMethod.RecursiveBlur;
            this.BlurRadius          = 15;
            Font svgFont = SvgFontStore.LoadFont("svg-LiberationSansFont", 300);

            m_pathVxs = svgFont.GetGlyph('a').originalVxs;// typeFaceForLargeA.GetGlyphForCharacter('a');
            Affine shape_mtx = Affine.NewMatix(AffinePlan.Translate(150, 100));

            m_pathVxs = shape_mtx.TransformToVxs(m_pathVxs);
            var curveFlattener = new CurveFlattener();

            m_path_2 = new VertexStoreSnap(curveFlattener.MakeVxs(m_pathVxs));
            BoundingRect.GetBoundingRect(m_path_2, ref m_shape_bounds);
            m_shadow_ctrl.SetXN(0, m_shape_bounds.Left);
            m_shadow_ctrl.SetYN(0, m_shape_bounds.Bottom);
            m_shadow_ctrl.SetXN(1, m_shape_bounds.Right);
            m_shadow_ctrl.SetYN(1, m_shape_bounds.Bottom);
            m_shadow_ctrl.SetXN(2, m_shape_bounds.Right);
            m_shadow_ctrl.SetYN(2, m_shape_bounds.Top);
            m_shadow_ctrl.SetXN(3, m_shape_bounds.Left);
            m_shadow_ctrl.SetYN(3, m_shape_bounds.Top);
            m_shadow_ctrl.LineColor = ColorRGBAf.MakeColorRGBA(0f, 0.3f, 0.5f, 0.3f);
        }
Esempio n. 3
0
        public blur()
        {
            m_rbuf2                 = new ImageBuffer();
            m_shape_bounds          = new RectangleDouble();
            m_method                = new RadioButtonGroup(new Vector2(10.0, 10.0), new Vector2(130.0, 60.0));
            m_radius                = new Slider(new Vector2(130 + 10.0, 10.0 + 4.0), new Vector2(290, 8.0));
            m_shadow_ctrl           = new PolygonEditWidget(4);
            m_channel_r             = new CheckBox(10.0, 80.0, "Red");
            m_channel_g             = new CheckBox(10.0, 95.0, "Green");
            m_channel_b             = new CheckBox(10.0, 110.0, "Blue");
            m_FlattenCurves         = new CheckBox(10, 315, "Convert And Flatten Curves");
            m_FlattenCurves.Checked = true;

            AddChild(m_method);
            m_method.AddRadioButton("Stack Blur");
            m_method.AddRadioButton("Recursive Blur");
            m_method.AddRadioButton("Channels");
            m_method.SelectedIndex = 1;

            AddChild(m_radius);
            m_radius.SetRange(0.0, 40.0);
            m_radius.Value = 15.0;
            m_radius.Text  = "Blur Radius={0:F2}";

            AddChild(m_shadow_ctrl);

            AddChild(m_channel_r);
            AddChild(m_channel_g);
            AddChild(m_channel_b);
            AddChild(m_FlattenCurves);
            m_channel_g.Checked = true;

            m_sl = new ScanlineCachePacked8();

            StyledTypeFace typeFaceForLargeA = new StyledTypeFace(LiberationSansFont.Instance, 300, flatenCurves: false);

            m_path = typeFaceForLargeA.GetGlyphForCharacter('a');

            Affine shape_mtx = Affine.NewIdentity();

            shape_mtx *= Affine.NewTranslation(150, 100);
            m_path     = new VertexSourceApplyTransform(m_path, shape_mtx);
            m_shape    = new FlattenCurves(m_path);

            bounding_rect.bounding_rect_single(m_shape, 0, ref m_shape_bounds);

            m_shadow_ctrl.SetXN(0, m_shape_bounds.Left);
            m_shadow_ctrl.SetYN(0, m_shape_bounds.Bottom);
            m_shadow_ctrl.SetXN(1, m_shape_bounds.Right);
            m_shadow_ctrl.SetYN(1, m_shape_bounds.Bottom);
            m_shadow_ctrl.SetXN(2, m_shape_bounds.Right);
            m_shadow_ctrl.SetYN(2, m_shape_bounds.Top);
            m_shadow_ctrl.SetXN(3, m_shape_bounds.Left);
            m_shadow_ctrl.SetYN(3, m_shape_bounds.Top);
            m_shadow_ctrl.line_color(new ColorF(0, 0.3, 0.5, 0.3));
        }
Esempio n. 4
0
        public FilterFxDemo()
        {
            VgVisualElement renderVx    = VgVisualDocHelper.CreateVgVisualDocFromFile(@"Samples\lion.svg").VgRootElem;
            var             spriteShape = new SpriteShape(renderVx);

            _testSprite = new MyTestSprite(spriteShape);
            //--------------

            //m_rbuf2 = new ReferenceImage();
            _shape_bounds            = new RectD();
            _shadow_ctrl             = new PolygonEditWidget(4);
            this.FlattenCurveChecked = true;
            this.FilterMethod        = FilterMethod.None;
            this.BlurRadius          = 15;
            //
        }
Esempio n. 5
0
        public BlurWithPainter()
        {
            //m_rbuf2 = new ReferenceImage();
            m_shape_bounds           = new RectD();
            m_shadow_ctrl            = new PolygonEditWidget(4);
            this.FlattenCurveChecked = true;
            this.BlurMethod          = BlurMethod.RecursiveBlur;
            this.BlurRadius          = 15;

            //ActualFont svgFont = svgFontStore.LoadFont("svg-LiberationSansFont", 300);
            ////PathWriter p01 = new PathWriter();
            ////p01.MoveTo(0, 0);
            ////p01.LineTo(50, 100);
            ////p01.LineTo(100, 0);
            //////-
            ////p01.MoveTo(220, 10);
            ////p01.LineTo(50, 75);
            ////p01.LineTo(25, 15);
            ////p01.CloseFigure();
            ////p01.Stop();
            ////m_pathVxs = p01.Vxs;
            //var winFontGlyph = svgFont.GetGlyph('a');
            //m_pathVxs = winFontGlyph.originalVxs;// typeFaceForLargeA.GetGlyphForCharacter('a');
            //Affine shape_mtx = Affine.NewMatix(AffinePlan.Translate(150, 100));
            //m_pathVxs = shape_mtx.TransformToVxs(m_pathVxs);
            //var curveFlattener = new CurveFlattener();
            //m_pathVxs2 = curveFlattener.MakeVxs(m_pathVxs);
            //m_path_2 = new VertexStoreSnap(m_pathVxs2);
            //BoundingRect.GetBoundingRect(m_path_2, ref m_shape_bounds);
            //m_shadow_ctrl.SetXN(0, m_shape_bounds.Left);
            //m_shadow_ctrl.SetYN(0, m_shape_bounds.Bottom);
            //m_shadow_ctrl.SetXN(1, m_shape_bounds.Right);
            //m_shadow_ctrl.SetYN(1, m_shape_bounds.Bottom);
            //m_shadow_ctrl.SetXN(2, m_shape_bounds.Right);
            //m_shadow_ctrl.SetYN(2, m_shape_bounds.Top);
            //m_shadow_ctrl.SetXN(3, m_shape_bounds.Left);
            //m_shadow_ctrl.SetYN(3, m_shape_bounds.Top);
            //m_shadow_ctrl.LineColor = PixelFarm.Drawing.Color.FromArgb(0.3f, 0f, 0.3f, 0.5f);
        }