Пример #1
0
        public void OnInitialize()
        {
            g_x1 = 0.0;
            g_y1 = 0.0;
            g_x2 = m_SourceImage.Width;
            g_y2 = m_SourceImage.Height;

            double x1 = g_x1;            // * 100.0;
            double y1 = g_y1;            // * 100.0;
            double x2 = g_x2;            // * 100.0;
            double y2 = g_y2;            // * 100.0;

            double dx = Width / 2.0 - (x2 - x1) / 2.0;
            double dy = Height / 2.0 - (y2 - y1) / 2.0;

            m_quad.SetXN(0, Math.Floor(x1 + dx));
            m_quad.SetYN(0, Math.Floor(y1 + dy));            // - 150;
            m_quad.SetXN(1, Math.Floor(x2 + dx));
            m_quad.SetYN(1, Math.Floor(y1 + dy));            // - 110;
            m_quad.SetXN(2, Math.Floor(x2 + dx));
            m_quad.SetYN(2, Math.Floor(y2 + dy));            // - 300;
            m_quad.SetXN(3, Math.Floor(x1 + dx));
            m_quad.SetYN(3, Math.Floor(y2 + dy));            // - 200;

            //m_SourceImage.apply_gamma_dir(m_gamma_lut);
        }
Пример #2
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));
		}
Пример #3
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);
        }
Пример #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);
		}