示例#1
0
		public image_resample()
		{
			m_gamma_lut = new GammaLookUpTable(2.0);
			m_quad = new MatterHackers.Agg.UI.PolygonEditWidget(4, 5.0);
			m_trans_type = new MatterHackers.Agg.UI.RadioButtonGroup(new Vector2(400, 5.0), new Vector2(30 + 170.0, 95));
			m_gamma = new MatterHackers.Agg.UI.Slider(5.0, 5.0 + 15 * 0, 400 - 5, 10.0 + 15 * 0);
			m_blur = new MatterHackers.Agg.UI.Slider(5.0, 5.0 + 15 * 1, 400 - 5, 10.0 + 15 * 1);
			m_blur.ValueChanged += new EventHandler(NeedRedraw);
			m_gamma.ValueChanged += new EventHandler(NeedRedraw);
			m_old_gamma = 2.0;

			g_rasterizer = new ScanlineRasterizer();
			g_scanline = new scanline_unpacked_8();

			m_trans_type.AddRadioButton("Affine No Resample");
			m_trans_type.AddRadioButton("Affine Resample");
			m_trans_type.AddRadioButton("Perspective No Resample LERP");
			m_trans_type.AddRadioButton("Perspective No Resample Exact");
			m_trans_type.AddRadioButton("Perspective Resample LERP");
			m_trans_type.AddRadioButton("Perspective Resample Exact");
			m_trans_type.SelectedIndex = 4;
			AddChild(m_trans_type);

			m_gamma.SetRange(0.5, 3.0);
			m_gamma.Value = 2.0;
			m_gamma.Text = "Gamma={0:F3}";
			AddChild(m_gamma);

			m_blur.SetRange(0.5, 5.0);
			m_blur.Value = 1.0;
			m_blur.Text = "Blur={0:F3}";
			AddChild(m_blur);
		}
示例#2
0
        public image_resample()
        {
            m_gamma_lut           = new GammaLookUpTable(2.0);
            m_quad                = new MatterHackers.Agg.UI.PolygonEditWidget(4, 5.0);
            m_trans_type          = new MatterHackers.Agg.UI.RadioButtonGroup(new Vector2(400, 5.0), new Vector2(30 + 170.0, 95));
            m_gamma               = new MatterHackers.Agg.UI.Slider(5.0, 5.0 + 15 * 0, 400 - 5, 10.0 + 15 * 0);
            m_blur                = new MatterHackers.Agg.UI.Slider(5.0, 5.0 + 15 * 1, 400 - 5, 10.0 + 15 * 1);
            m_blur.ValueChanged  += new EventHandler(NeedRedraw);
            m_gamma.ValueChanged += new EventHandler(NeedRedraw);
            m_old_gamma           = 2.0;

            g_rasterizer = new ScanlineRasterizer();
            g_scanline   = new scanline_unpacked_8();

            m_trans_type.AddRadioButton("Affine No Resample");
            m_trans_type.AddRadioButton("Affine Resample");
            m_trans_type.AddRadioButton("Perspective No Resample LERP");
            m_trans_type.AddRadioButton("Perspective No Resample Exact");
            m_trans_type.AddRadioButton("Perspective Resample LERP");
            m_trans_type.AddRadioButton("Perspective Resample Exact");
            m_trans_type.SelectedIndex = 4;
            AddChild(m_trans_type);

            m_gamma.SetRange(0.5, 3.0);
            m_gamma.Value = 2.0;
            m_gamma.Text  = "Gamma={0:F3}";
            AddChild(m_gamma);

            m_blur.SetRange(0.5, 5.0);
            m_blur.Value = 1.0;
            m_blur.Text  = "Blur={0:F3}";
            AddChild(m_blur);
        }
示例#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 RGBA_Floats(0, 0.3, 0.5, 0.3));
		}
示例#4
0
        public perspective_application()
        {
            AnchorAll();
            quadPolygonControl            = new MatterHackers.Agg.UI.PolygonEditWidget(4, 5.0);
            transformationTypeRadioButton = new MatterHackers.Agg.UI.RadioButtonGroup(new Vector2(420, 5.0), new Vector2(130.0, 50.0));
            transformationTypeRadioButton.SelectionChanged += new EventHandler(NeedsRedraw);
            quadPolygonControl.SetXN(0, lionShape.Bounds.Left);
            quadPolygonControl.SetYN(0, lionShape.Bounds.Top);
            quadPolygonControl.SetXN(1, lionShape.Bounds.Right);
            quadPolygonControl.SetYN(1, lionShape.Bounds.Top);
            quadPolygonControl.SetXN(2, lionShape.Bounds.Right);
            quadPolygonControl.SetYN(2, lionShape.Bounds.Bottom);
            quadPolygonControl.SetXN(3, lionShape.Bounds.Left);
            quadPolygonControl.SetYN(3, lionShape.Bounds.Bottom);

            transformationTypeRadioButton.AddRadioButton("Bilinear");
            transformationTypeRadioButton.AddRadioButton("Perspective");
            transformationTypeRadioButton.SelectedIndex = 0;
            AddChild(transformationTypeRadioButton);
        }
示例#5
0
		public perspective_application()
		{
			AnchorAll();
			quadPolygonControl = new MatterHackers.Agg.UI.PolygonEditWidget(4, 5.0);
			transformationTypeRadioButton = new MatterHackers.Agg.UI.RadioButtonGroup(new Vector2(420, 5.0), new Vector2(130.0, 50.0));
			transformationTypeRadioButton.SelectionChanged += new EventHandler(NeedsRedraw);
			quadPolygonControl.SetXN(0, lionShape.Bounds.Left);
			quadPolygonControl.SetYN(0, lionShape.Bounds.Top);
			quadPolygonControl.SetXN(1, lionShape.Bounds.Right);
			quadPolygonControl.SetYN(1, lionShape.Bounds.Top);
			quadPolygonControl.SetXN(2, lionShape.Bounds.Right);
			quadPolygonControl.SetYN(2, lionShape.Bounds.Bottom);
			quadPolygonControl.SetXN(3, lionShape.Bounds.Left);
			quadPolygonControl.SetYN(3, lionShape.Bounds.Bottom);

			transformationTypeRadioButton.AddRadioButton("Bilinear");
			transformationTypeRadioButton.AddRadioButton("Perspective");
			transformationTypeRadioButton.SelectedIndex = 0;
			AddChild(transformationTypeRadioButton);
		}
示例#6
0
		public Gradients()
		{
			AnchorAll();
			//m_profile = new gamma_ctrl(new Vector2(10.0, 10.0), new Vector2(190, 155.0));
			//m_spline_r = new spline_ctrl(new Vector2(210, 10), new Vector2(250, 5 + 30), 6);
			//m_spline_g = new spline_ctrl(new Vector2(210, 10 + 40), new Vector2(250, 5 + 30), 6);
			//m_spline_b = new spline_ctrl(new Vector2(210, 10 + 80), new Vector2(250, 5 + 30), 6);
			//m_spline_a = new spline_ctrl(new Vector2(210, 10 + 120), new Vector2(250, 5 + 30), 6);
			m_profile = new gamma_ctrl(new Vector2(10.0, 10.0), new Vector2(190, 155.0));
			m_spline_r = new spline_ctrl(new Vector2(210, 10), new Vector2(250, 5 + 30), 6);
			m_spline_g = new spline_ctrl(new Vector2(210, 10 + 40), new Vector2(250, 5 + 30), 6);
			m_spline_b = new spline_ctrl(new Vector2(210, 10 + 80), new Vector2(250, 5 + 30), 6);
			m_spline_a = new spline_ctrl(new Vector2(210, 10 + 120), new Vector2(250, 5 + 30), 6);
			m_profile.MouseMove += new MouseEventHandler(NeedRedraw);
			m_spline_r.MouseMove += new MouseEventHandler(NeedRedraw);
			m_spline_g.MouseMove += new MouseEventHandler(NeedRedraw);
			m_spline_b.MouseMove += new MouseEventHandler(NeedRedraw);
			m_spline_a.MouseMove += new MouseEventHandler(NeedRedraw);
			m_GradTypeRBox = new RadioButtonGroup(new Vector2(10.0, 180.0), new Vector2(190.0, 120.0));
			m_GradWrapRBox = new RadioButtonGroup(new Vector2(10, 310), new Vector2(190, 65));

			m_pdx = (0.0);
			m_pdy = (0.0);
			m_SaveData.m_center_x = (center_x);
			m_SaveData.m_center_y = (center_y);
			m_SaveData.m_scale = (1.0);
			m_prev_scale = (1.0);
			m_SaveData.m_angle = (0.0);
			m_prev_angle = (0.0);
			m_scale_x = (1.0);
			m_prev_scale_x = (1.0);
			m_scale_y = (1.0);
			m_prev_scale_y = (1.0);
			m_mouse_move = (false);

			AddChild(m_profile);
			AddChild(m_spline_r);
			AddChild(m_spline_g);
			AddChild(m_spline_b);
			AddChild(m_spline_a);
			AddChild(m_GradTypeRBox);
			AddChild(m_GradWrapRBox);

			m_profile.border_width(2.0, 2.0);

			m_spline_r.background_color(new RGBA_Bytes(1.0, 0.8, 0.8));
			m_spline_g.background_color(new RGBA_Bytes(0.8, 1.0, 0.8));
			m_spline_b.background_color(new RGBA_Bytes(0.8, 0.8, 1.0));
			m_spline_a.background_color(new RGBA_Bytes(1.0, 1.0, 1.0));

			m_spline_r.border_width(1.0, 2.0);
			m_spline_g.border_width(1.0, 2.0);
			m_spline_b.border_width(1.0, 2.0);
			m_spline_a.border_width(1.0, 2.0);

			m_spline_r.point(0, 0.0, 1.0);
			m_spline_r.point(1, 1.0 / 5.0, 1.0 - 1.0 / 5.0);
			m_spline_r.point(2, 2.0 / 5.0, 1.0 - 2.0 / 5.0);
			m_spline_r.point(3, 3.0 / 5.0, 1.0 - 3.0 / 5.0);
			m_spline_r.point(4, 4.0 / 5.0, 1.0 - 4.0 / 5.0);
			m_spline_r.point(5, 1.0, 0.0);
			m_spline_r.update_spline();

			m_spline_g.point(0, 0.0, 1.0);
			m_spline_g.point(1, 1.0 / 5.0, 1.0 - 1.0 / 5.0);
			m_spline_g.point(2, 2.0 / 5.0, 1.0 - 2.0 / 5.0);
			m_spline_g.point(3, 3.0 / 5.0, 1.0 - 3.0 / 5.0);
			m_spline_g.point(4, 4.0 / 5.0, 1.0 - 4.0 / 5.0);
			m_spline_g.point(5, 1.0, 0.0);
			m_spline_g.update_spline();

			m_spline_b.point(0, 0.0, 1.0);
			m_spline_b.point(1, 1.0 / 5.0, 1.0 - 1.0 / 5.0);
			m_spline_b.point(2, 2.0 / 5.0, 1.0 - 2.0 / 5.0);
			m_spline_b.point(3, 3.0 / 5.0, 1.0 - 3.0 / 5.0);
			m_spline_b.point(4, 4.0 / 5.0, 1.0 - 4.0 / 5.0);
			m_spline_b.point(5, 1.0, 0.0);
			m_spline_b.update_spline();

			m_spline_a.point(0, 0.0, 1.0);
			m_spline_a.point(1, 1.0 / 5.0, 1.0);
			m_spline_a.point(2, 2.0 / 5.0, 1.0);
			m_spline_a.point(3, 3.0 / 5.0, 1.0);
			m_spline_a.point(4, 4.0 / 5.0, 1.0);
			m_spline_a.point(5, 1.0, 1.0);
			m_spline_a.update_spline();

			m_GradTypeRBox.AddRadioButton("Circular");
			m_GradTypeRBox.AddRadioButton("Diamond");
			m_GradTypeRBox.AddRadioButton("Linear");
			m_GradTypeRBox.AddRadioButton("XY");
			m_GradTypeRBox.AddRadioButton("sqrt(XY)");
			m_GradTypeRBox.AddRadioButton("Conic");
			m_GradTypeRBox.SelectedIndex = 0;

			m_GradWrapRBox.AddRadioButton("Reflect");
			m_GradWrapRBox.AddRadioButton("Repeat");
			m_GradWrapRBox.AddRadioButton("Clamp");
			m_GradWrapRBox.SelectedIndex = 0;
		}
示例#7
0
        public Gradients()
        {
            AnchorAll();
            //m_profile = new gamma_ctrl(new Vector2(10.0, 10.0), new Vector2(190, 155.0));
            //m_spline_r = new spline_ctrl(new Vector2(210, 10), new Vector2(250, 5 + 30), 6);
            //m_spline_g = new spline_ctrl(new Vector2(210, 10 + 40), new Vector2(250, 5 + 30), 6);
            //m_spline_b = new spline_ctrl(new Vector2(210, 10 + 80), new Vector2(250, 5 + 30), 6);
            //m_spline_a = new spline_ctrl(new Vector2(210, 10 + 120), new Vector2(250, 5 + 30), 6);
            m_profile             = new gamma_ctrl(new Vector2(10.0, 10.0), new Vector2(190, 155.0));
            m_spline_r            = new spline_ctrl(new Vector2(210, 10), new Vector2(250, 5 + 30), 6);
            m_spline_g            = new spline_ctrl(new Vector2(210, 10 + 40), new Vector2(250, 5 + 30), 6);
            m_spline_b            = new spline_ctrl(new Vector2(210, 10 + 80), new Vector2(250, 5 + 30), 6);
            m_spline_a            = new spline_ctrl(new Vector2(210, 10 + 120), new Vector2(250, 5 + 30), 6);
            m_profile.MouseMove  += new MouseEventHandler(NeedRedraw);
            m_spline_r.MouseMove += new MouseEventHandler(NeedRedraw);
            m_spline_g.MouseMove += new MouseEventHandler(NeedRedraw);
            m_spline_b.MouseMove += new MouseEventHandler(NeedRedraw);
            m_spline_a.MouseMove += new MouseEventHandler(NeedRedraw);
            m_GradTypeRBox        = new RadioButtonGroup(new Vector2(10.0, 180.0), new Vector2(190.0, 120.0));
            m_GradWrapRBox        = new RadioButtonGroup(new Vector2(10, 310), new Vector2(190, 65));

            m_pdx = (0.0);
            m_pdy = (0.0);
            m_SaveData.m_center_x = (center_x);
            m_SaveData.m_center_y = (center_y);
            m_SaveData.m_scale    = (1.0);
            m_prev_scale          = (1.0);
            m_SaveData.m_angle    = (0.0);
            m_prev_angle          = (0.0);
            m_scale_x             = (1.0);
            m_prev_scale_x        = (1.0);
            m_scale_y             = (1.0);
            m_prev_scale_y        = (1.0);
            m_mouse_move          = (false);


            AddChild(m_profile);
            AddChild(m_spline_r);
            AddChild(m_spline_g);
            AddChild(m_spline_b);
            AddChild(m_spline_a);
            AddChild(m_GradTypeRBox);
            AddChild(m_GradWrapRBox);

            m_profile.border_width(2.0, 2.0);

            m_spline_r.background_color(new RGBA_Bytes(1.0, 0.8, 0.8));
            m_spline_g.background_color(new RGBA_Bytes(0.8, 1.0, 0.8));
            m_spline_b.background_color(new RGBA_Bytes(0.8, 0.8, 1.0));
            m_spline_a.background_color(new RGBA_Bytes(1.0, 1.0, 1.0));

            m_spline_r.border_width(1.0, 2.0);
            m_spline_g.border_width(1.0, 2.0);
            m_spline_b.border_width(1.0, 2.0);
            m_spline_a.border_width(1.0, 2.0);

            m_spline_r.point(0, 0.0, 1.0);
            m_spline_r.point(1, 1.0 / 5.0, 1.0 - 1.0 / 5.0);
            m_spline_r.point(2, 2.0 / 5.0, 1.0 - 2.0 / 5.0);
            m_spline_r.point(3, 3.0 / 5.0, 1.0 - 3.0 / 5.0);
            m_spline_r.point(4, 4.0 / 5.0, 1.0 - 4.0 / 5.0);
            m_spline_r.point(5, 1.0, 0.0);
            m_spline_r.update_spline();

            m_spline_g.point(0, 0.0, 1.0);
            m_spline_g.point(1, 1.0 / 5.0, 1.0 - 1.0 / 5.0);
            m_spline_g.point(2, 2.0 / 5.0, 1.0 - 2.0 / 5.0);
            m_spline_g.point(3, 3.0 / 5.0, 1.0 - 3.0 / 5.0);
            m_spline_g.point(4, 4.0 / 5.0, 1.0 - 4.0 / 5.0);
            m_spline_g.point(5, 1.0, 0.0);
            m_spline_g.update_spline();

            m_spline_b.point(0, 0.0, 1.0);
            m_spline_b.point(1, 1.0 / 5.0, 1.0 - 1.0 / 5.0);
            m_spline_b.point(2, 2.0 / 5.0, 1.0 - 2.0 / 5.0);
            m_spline_b.point(3, 3.0 / 5.0, 1.0 - 3.0 / 5.0);
            m_spline_b.point(4, 4.0 / 5.0, 1.0 - 4.0 / 5.0);
            m_spline_b.point(5, 1.0, 0.0);
            m_spline_b.update_spline();

            m_spline_a.point(0, 0.0, 1.0);
            m_spline_a.point(1, 1.0 / 5.0, 1.0);
            m_spline_a.point(2, 2.0 / 5.0, 1.0);
            m_spline_a.point(3, 3.0 / 5.0, 1.0);
            m_spline_a.point(4, 4.0 / 5.0, 1.0);
            m_spline_a.point(5, 1.0, 1.0);
            m_spline_a.update_spline();

            m_GradTypeRBox.AddRadioButton("Circular");
            m_GradTypeRBox.AddRadioButton("Diamond");
            m_GradTypeRBox.AddRadioButton("Linear");
            m_GradTypeRBox.AddRadioButton("XY");
            m_GradTypeRBox.AddRadioButton("sqrt(XY)");
            m_GradTypeRBox.AddRadioButton("Conic");
            m_GradTypeRBox.SelectedIndex = 0;

            m_GradWrapRBox.AddRadioButton("Reflect");
            m_GradWrapRBox.AddRadioButton("Repeat");
            m_GradWrapRBox.AddRadioButton("Clamp");
            m_GradWrapRBox.SelectedIndex = 0;
        }