public override void OnInitialize()
        {
            base.OnInitialize();

            int whichHeight   = 112;
            int whichWidth    = 300;
            int windingHeight = 140;
            int windingWidth  = 300;

            m_WhichShape = new rbox_ctrl(0.0, Height - whichHeight, whichWidth, Height);
            AddChild(m_WhichShape);
            m_WhichShape.add_item("Nested Rects All CCW");
            m_WhichShape.add_item("Nested Rects CCW, CW, CW");
            m_WhichShape.add_item("Rects And Triangle");
            m_WhichShape.add_item("Complex Path");
            m_WhichShape.cur_item(0);

            m_WhichShape.background_color(new RGBA_Doubles(0.0, 0.0, 0.0, 0.1));
            m_WhichShape.text_size(12.0);
            m_WhichShape.text_thickness(2);

            m_WindingRule = new rbox_ctrl(whichWidth + 100, Height - windingHeight, whichWidth + 100 + windingWidth, Height);
            AddChild(m_WindingRule);
            m_WindingRule.add_item("Winding ODD");
            m_WindingRule.add_item("Winding NON-ZERO");
            m_WindingRule.add_item("Winding POSITIVE");
            m_WindingRule.add_item("Winding NEGATIVE");
            m_WindingRule.add_item("Winding ABS >= 2");
            m_WindingRule.cur_item(0);

            m_WindingRule.background_color(new RGBA_Doubles(0.0, 0.0, 0.0, 0.1));
            m_WindingRule.text_size(12.0);
            m_WindingRule.text_thickness(2);

            m_EdgeFlag = new cbox_ctrl(10, Height - whichHeight - 40, "Turn on Edge Flag");
            m_EdgeFlag.status(true);
            AddChild(m_EdgeFlag);

            m_BoundryOnly = new cbox_ctrl(10, Height - whichHeight - 20, "Render Only Boundary");
            AddChild(m_BoundryOnly);

            Tesselate_Tests test = new Tesselate_Tests();

            test.MatchesGLUTesselator();
        }
        public override void OnInitialize()
        {
            base.OnInitialize();

            int whichHeight = 112;
            int whichWidth = 300;
            int windingHeight = 140;
            int windingWidth = 300;
            m_WhichShape = new rbox_ctrl(0.0, Height - whichHeight, whichWidth, Height);
            AddChild(m_WhichShape);
            m_WhichShape.add_item("Nested Rects All CCW");
            m_WhichShape.add_item("Nested Rects CCW, CW, CW");
            m_WhichShape.add_item("Rects And Triangle");
            m_WhichShape.add_item("Complex Path");
            m_WhichShape.cur_item(0);

            m_WhichShape.background_color(new RGBA_Doubles(0.0, 0.0, 0.0, 0.1));
            m_WhichShape.text_size(12.0);
            m_WhichShape.text_thickness(2);

            m_WindingRule = new rbox_ctrl(whichWidth + 100, Height - windingHeight, whichWidth + 100 + windingWidth, Height);
            AddChild(m_WindingRule);
            m_WindingRule.add_item("Winding ODD");
            m_WindingRule.add_item("Winding NON-ZERO");
            m_WindingRule.add_item("Winding POSITIVE");
            m_WindingRule.add_item("Winding NEGATIVE");
            m_WindingRule.add_item("Winding ABS >= 2");
            m_WindingRule.cur_item(0);

            m_WindingRule.background_color(new RGBA_Doubles(0.0, 0.0, 0.0, 0.1));
            m_WindingRule.text_size(12.0);
            m_WindingRule.text_thickness(2);

            m_EdgeFlag = new cbox_ctrl(10, Height - whichHeight - 40, "Turn on Edge Flag");
            m_EdgeFlag.status(true);
            AddChild(m_EdgeFlag);

            m_BoundryOnly = new cbox_ctrl(10, Height - whichHeight - 20, "Render Only Boundary");
            AddChild(m_BoundryOnly);

            Tesselate_Tests test = new Tesselate_Tests();
            test.MatchesGLUTesselator();
        }
        image_filters_application(PixelFormats format, ERenderOrigin RenderOrigin)
            : base(format, RenderOrigin)
        {
            m_step      = new SliderWidget <T>(115, 5, 400, 11);
            m_radius    = new SliderWidget <T>(115, 5 + 15, 400, 11 + 15);
            m_filters   = new rbox_ctrl <T>(0.0, 0.0, 110.0, 210.0);
            m_normalize = new cbox_ctrl <T>(8.0, 215.0, "Normalize Filter");

            m_refresh              = new ButtonWidget <T>(8.0, 273.0, "Refresh", 8, 1, 1, 3);
            m_refresh.ButtonClick += RefreshImage;
            m_run                      = new ButtonWidget <T>(8.0, 253.0, "RUN Test!", 8, 1, 1, 3);
            m_run.ButtonClick         += RunTest;
            m_single_step              = new ButtonWidget <T>(8.0, 233.0, "Single Step", 8, 1, 1, 3);
            m_single_step.ButtonClick += SingleStep;

            m_cur_angle        = (0.0);
            m_cur_filter       = (1);
            m_num_steps        = (0);
            m_num_pix          = (0.0);
            m_time1            = (0);
            m_time2            = (0);
            m_ScanlinePacked   = new ScanlinePacked8();
            m_Rasterizer       = new RasterizerScanlineAA <T>();
            m_ScanlineUnpacked = new ScanlineUnpacked8();
            m_SpanAllocator    = new SpanAllocator();

            AddChild(m_radius);
            AddChild(m_step);
            AddChild(m_filters);
            AddChild(m_run);
            AddChild(m_single_step);
            AddChild(m_normalize);
            AddChild(m_refresh);
            //m_single_step.text_size(7.5);
            m_normalize.SetFontSize(7.5);
            m_normalize.status(true);

            m_radius.label("Filter Radius={0:F2}");
            m_step.label("Step={0:F2}");
            m_radius.range(2.0, 8.0);
            m_radius.value(4.0);
            m_step.range(1.0, 10.0);
            m_step.value(5.0);

            m_filters.add_item("simple (NN)");
            m_filters.add_item("bilinear");
            m_filters.add_item("bicubic");
            m_filters.add_item("spline16");
            m_filters.add_item("spline36");
            m_filters.add_item("hanning");
            m_filters.add_item("hamming");
            m_filters.add_item("hermite");
            m_filters.add_item("kaiser");
            m_filters.add_item("quadric");
            m_filters.add_item("catrom");
            m_filters.add_item("gaussian");
            m_filters.add_item("bessel");
            m_filters.add_item("mitchell");
            m_filters.add_item("sinc");
            m_filters.add_item("lanczos");
            m_filters.add_item("blackman");
            m_filters.cur_item(1);

            m_filters.border_width(0, 0);
            m_filters.background_color(new RGBA_Doubles(0.0, 0.0, 0.0, 0.1));
            m_filters.text_size(6.0);
            m_filters.text_thickness(0.85);
        }
Exemple #4
0
        public blur_application(PixelFormats format, ERenderOrigin RenderOrigin)
            : base(format, RenderOrigin)
        {
            m_rbuf2         = new RasterBuffer();
            m_shape_bounds  = new RectDouble <T>();
            m_method        = new rbox_ctrl <T>(10.0, 10.0, 130.0, 70.0);
            m_radius        = new SliderWidget <T>(130 + 10.0, 10.0 + 4.0, 130 + 300.0, 10.0 + 8.0 + 4.0);
            m_shadow_ctrl   = new polygon_ctrl <T>(4);
            m_channel_r     = new cbox_ctrl <T>(10.0, 80.0, "Red");
            m_channel_g     = new cbox_ctrl <T>(10.0, 95.0, "Green");
            m_channel_b     = new cbox_ctrl <T>(10.0, 110.0, "Blue");
            m_FlattenCurves = new cbox_ctrl <T>(10, 315, "Convert And Flatten Curves");
            m_FlattenCurves.status(true);

            AddChild(m_method);
            m_method.text_size(8);
            m_method.add_item("Stack Blur");
            m_method.add_item("Recursive Blur");
            m_method.add_item("Channels");
            m_method.cur_item(1);

            AddChild(m_radius);
            m_radius.range(0.0, 40.0);
            m_radius.value(15.0);
            m_radius.label("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.status(true);

            m_sl    = new ScanlinePacked8();
            m_path  = new PathStorage <T>();
            m_shape = new ConvCurve <T>(m_path);

            m_path.RemoveAll();
            m_path.MoveTo(28.47, 6.45);
            m_path.Curve3(21.58, 1.12, 19.82, 0.29);
            m_path.Curve3(17.19, -0.93, 14.21, -0.93);
            m_path.Curve3(9.57, -0.93, 6.57, 2.25);
            m_path.Curve3(3.56, 5.42, 3.56, 10.60);
            m_path.Curve3(3.56, 13.87, 5.03, 16.26);
            m_path.Curve3(7.03, 19.58, 11.99, 22.51);
            m_path.Curve3(16.94, 25.44, 28.47, 29.64);
            m_path.LineTo(28.47, 31.40);
            m_path.Curve3(28.47, 38.09, 26.34, 40.58);
            m_path.Curve3(24.22, 43.07, 20.17, 43.07);
            m_path.Curve3(17.09, 43.07, 15.28, 41.41);
            m_path.Curve3(13.43, 39.75, 13.43, 37.60);
            m_path.LineTo(13.53, 34.77);
            m_path.Curve3(13.53, 32.52, 12.38, 31.30);
            m_path.Curve3(11.23, 30.08, 9.38, 30.08);
            m_path.Curve3(7.57, 30.08, 6.42, 31.35);
            m_path.Curve3(5.27, 32.62, 5.27, 34.81);
            m_path.Curve3(5.27, 39.01, 9.57, 42.53);
            m_path.Curve3(13.87, 46.04, 21.63, 46.04);
            m_path.Curve3(27.59, 46.04, 31.40, 44.04);
            m_path.Curve3(34.28, 42.53, 35.64, 39.31);
            m_path.Curve3(36.52, 37.21, 36.52, 30.71);
            m_path.LineTo(36.52, 15.53);
            m_path.Curve3(36.52, 9.13, 36.77, 7.69);
            m_path.Curve3(37.01, 6.25, 37.57, 5.76);
            m_path.Curve3(38.13, 5.27, 38.87, 5.27);
            m_path.Curve3(39.65, 5.27, 40.23, 5.62);
            m_path.Curve3(41.26, 6.25, 44.19, 9.18);
            m_path.LineTo(44.19, 6.45);
            m_path.Curve3(38.72, -0.88, 33.74, -0.88);
            m_path.Curve3(31.35, -0.88, 29.93, 0.78);
            m_path.Curve3(28.52, 2.44, 28.47, 6.45);
            m_path.ClosePolygon();

            m_path.MoveTo(28.47, 9.62);
            m_path.LineTo(28.47, 26.66);
            m_path.Curve3(21.09, 23.73, 18.95, 22.51);
            m_path.Curve3(15.09, 20.36, 13.43, 18.02);
            m_path.Curve3(11.77, 15.67, 11.77, 12.89);
            m_path.Curve3(11.77, 9.38, 13.87, 7.06);
            m_path.Curve3(15.97, 4.74, 18.70, 4.74);
            m_path.Curve3(22.41, 4.74, 28.47, 9.62);
            m_path.ClosePolygon();

            IAffineTransformMatrix <T> shape_mtx = MatrixFactory <T> .NewIdentity(VectorDimension.Two);

            shape_mtx.Scale(M.New <T>(4.0));
            shape_mtx.Translate(MatrixFactory <T> .CreateVector2D(150, 100));
            m_path.Transform(shape_mtx);

            BoundingRect <T> .BoundingRectSingle(m_shape, 0, ref m_shape_bounds);

            m_shadow_ctrl.SetXN(0, m_shape_bounds.x1);
            m_shadow_ctrl.SetYN(0, m_shape_bounds.y1);
            m_shadow_ctrl.SetXN(1, m_shape_bounds.x2);
            m_shadow_ctrl.SetYN(1, m_shape_bounds.y1);
            m_shadow_ctrl.SetXN(2, m_shape_bounds.x2);
            m_shadow_ctrl.SetYN(2, m_shape_bounds.y2);
            m_shadow_ctrl.SetXN(3, m_shape_bounds.x1);
            m_shadow_ctrl.SetYN(3, m_shape_bounds.y2);
            m_shadow_ctrl.line_color(new RGBA_Doubles(0, 0.3, 0.5, 0.3));
        }