Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
		public trans_curve1_application()
		{
			AnchorAll();

			m_poly = new PolygonEditWidget(6, 5);
			on_init();
			m_poly.Changed += NeedsRedraw;
			AddChild(m_poly);

			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 += m_animate_CheckedStateChanged;
			AddChild(m_animate);
		}
Ejemplo n.º 3
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);
		}
Ejemplo n.º 4
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));
		}
Ejemplo n.º 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);
        }
Ejemplo n.º 6
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);
		}