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); }
public gouraud_application() { AnchorAll(); m_idx = (-1); m_dilation = new MatterHackers.Agg.UI.Slider(5, 5, 400 - 5, 11); m_dilation.ValueChanged += new EventHandler(SliderValueChanged); m_gamma = new MatterHackers.Agg.UI.Slider(5, 5 + 15, 400 - 5, 11 + 15); m_gamma.ValueChanged += new EventHandler(SliderValueChanged); m_alpha = new MatterHackers.Agg.UI.Slider(5, 5 + 30, 400 - 5, 11 + 30); m_alpha.ValueChanged += new EventHandler(SliderValueChanged); m_x[0] = 57; m_y[0] = 60; m_x[1] = 369; m_y[1] = 170; m_x[2] = 143; m_y[2] = 310; AddChild(m_dilation); AddChild(m_gamma); AddChild(m_alpha); m_dilation.Text = "Dilation={0:F2}"; m_gamma.Text = "Linear gamma={0:F2}"; m_alpha.Text = "Opacity={0:F2}"; m_dilation.Value = 0.175; m_gamma.Value = 0.809; m_alpha.Value = 1.0; }
public image1Widget() { AnchorAll(); string img_name = "spheres.bmp"; if (!ImageIO.LoadImageData(img_name, sourceImage)) { string buf; buf = "File not found: " + img_name + ".bmp" + ". Download http://www.antigrain.com/" + img_name + ".bmp" + "\n" + "or copy it from another directory if available."; MessageBox.ShowMessageBox(buf, "Missing Files"); } else { WindowSize.x = sourceImage.Width + 20; WindowSize.y = sourceImage.Height + 40 + 20; } drawAngle = new MatterHackers.Agg.UI.Slider(new Vector2(5, 5 + 15), new Vector2(295, 7)); drawScale = new MatterHackers.Agg.UI.Slider(new Vector2(5, 5 + 55), new Vector2(295, 7)); drawAngle.ValueChanged += new EventHandler(NeedsRedraw); drawScale.ValueChanged += new EventHandler(NeedsRedraw); AddChild(drawAngle); AddChild(drawScale); //drawAngle.Text = "Angle={0:F2}"; //drawScale.Text = "Scale={0:F2}"; drawAngle.SetRange(-180.0, 180.0); drawAngle.Value = 0.0; drawScale.SetRange(0.1, 5.0); drawScale.Value = 1.0; }
public image1Widget() { AnchorAll(); string img_name = "spheres.bmp"; if (!ImageIO.LoadImageData(img_name, sourceImage)) { string buf; buf = "File not found: " + img_name + ".bmp" + ". Download http://www.antigrain.com/" + img_name + ".bmp" + "\n" + "or copy it from another directory if available."; MessageBox.ShowMessageBox(buf, "Missing Files"); } else { WindowSize.x = sourceImage.Width + 20; WindowSize.y = sourceImage.Height + 40 + 20; } drawAngle = new MatterHackers.Agg.UI.Slider(new Vector2(5, 5 + 15), new Vector2(295, 7)); drawScale = new MatterHackers.Agg.UI.Slider(new Vector2(5, 5 + 55), new Vector2(295, 7)); drawAngle.ValueChanged += new EventHandler(NeedsRedraw); drawScale.ValueChanged += new EventHandler(NeedsRedraw); AddChild(drawAngle); AddChild(drawScale); //drawAngle.Text = "Angle={0:F2}"; //drawScale.Text = "Scale={0:F2}"; drawAngle.SetRange(-180.0, 180.0); drawAngle.Value = 0.0; drawScale.SetRange(0.1, 5.0); drawScale.Value = 1.0; }
public gouraud_application() { AnchorAll(); m_idx = (-1); m_dilation = new MatterHackers.Agg.UI.Slider(5, 5, 400 - 5, 11); m_dilation.ValueChanged += new EventHandler(SliderValueChanged); m_gamma = new MatterHackers.Agg.UI.Slider(5, 5 + 15, 400 - 5, 11 + 15); m_gamma.ValueChanged += new EventHandler(SliderValueChanged); m_alpha = new MatterHackers.Agg.UI.Slider(5, 5 + 30, 400 - 5, 11 + 30); m_alpha.ValueChanged += new EventHandler(SliderValueChanged); m_x[0] = 57; m_y[0] = 60; m_x[1] = 369; m_y[1] = 170; m_x[2] = 143; m_y[2] = 310; AddChild(m_dilation); AddChild(m_gamma); AddChild(m_alpha); m_dilation.Text = "Dilation={0:F2}"; m_gamma.Text = "Linear gamma={0:F2}"; m_alpha.Text = "Opacity={0:F2}"; m_dilation.Value = 0.175; m_gamma.Value = 0.809; m_alpha.Value = 1.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); }
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); }
public Lion() { BackgroundColor = RGBA_Bytes.White; alphaSlider = new Slider(new MatterHackers.VectorMath.Vector2(7, 27), 498); AddChild(alphaSlider); alphaSlider.ValueChanged += new EventHandler(alphaSlider_ValueChanged); alphaSlider.Text = "Alpha {0:F3}"; alphaSlider.Value = 0.1; }
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)); }
public aa_test() { AnchorAll(); m_idx = (-1); m_gamma = new MatterHackers.Agg.UI.Slider(3, 3, 480 - 3, 8); m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; AddChild(m_gamma); m_gamma.Text = "gamma={0:F3}"; m_gamma.SetRange(0.0, 3.0); m_gamma.Value = 1.8; }
public aa_test() { AnchorAll(); m_idx = (-1); m_gamma = new MatterHackers.Agg.UI.Slider(3, 3, 480 - 3, 8); m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; AddChild(m_gamma); m_gamma.Text = "gamma={0:F3}"; m_gamma.SetRange(0.0, 3.0); m_gamma.Value = 1.8; }
public ComponentRendering() : base(320, 320) { alphaSlider = new Slider(new Vector2(5, 30), 310, 0, 255); alphaSlider.ValueChanged += new EventHandler(NeedInvalidate); alphaSlider.Text = "Alpha={0:F0}"; alphaSlider.Value = 255; alphaSlider.View.TextColor = new RGBA_Bytes(127, 127, 127); AddChild(alphaSlider); useBlackBackgroundCheckbox = new UI.CheckBox(5, 30 + 12, "Draw Black Background"); useBlackBackgroundCheckbox.CheckedStateChanged += NeedInvalidate; useBlackBackgroundCheckbox.TextColor = new RGBA_Bytes(127, 127, 127); AddChild(useBlackBackgroundCheckbox); }
public SlideView(Slider sliderWidget) { sliderAttachedTo = sliderWidget; TrackHeight = 3; TextColor = RGBA_Bytes.Black; TrackColor = new RGBA_Bytes(220, 220, 220); ThumbColor = DefaultViewFactory.DefaultBlue; sliderWidget.ValueChanged += new EventHandler(sliderWidget_ValueChanged); sliderWidget.TextChanged += new EventHandler(sliderWidget_TextChanged); SetFormatStringForText(); }
public SliderControlsPage() : base("Slider Widget") { horizontalSlider = new Slider(new Vector2(20, 60), 100); AddChild(horizontalSlider); horizontalSlider.Text = "{0:0.0}"; changeSliderText = new CheckBox(10, 200, "Show Text"); changeSliderText.Checked = true; AddChild(changeSliderText); changeSliderText.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(changeSliderText_CheckedStateChanged); verticalSlider = new Slider(new Vector2(320, 60), 100, orientation: Orientation.Vertical); AddChild(verticalSlider); verticalSlider.Text = "{0:0.0}"; }
public alpha_mask2_application() { AnchorAll(); alphaMaskImageBuffer = new ImageBuffer(); #if USE_CLIPPING_ALPHA_MASK alphaMask = new AlphaMaskByteClipped(alphaMaskImageBuffer, 1, 0); #else alphaMask = new AlphaMaskByteUnclipped(alphaMaskImageBuffer, 1, 0); #endif numMasksSlider = new UI.Slider(5, 5, 150, 12); sliderValue = 0.0; AddChild(numMasksSlider); numMasksSlider.SetRange(5, 100); numMasksSlider.Value = 10; numMasksSlider.Text = "N={0:F3}"; numMasksSlider.OriginRelativeParent = Vector2.Zero; }
public alpha_mask2_application() { AnchorAll(); alphaMaskImageBuffer = new ImageBuffer(); #if USE_CLIPPING_ALPHA_MASK alphaMask = new AlphaMaskByteClipped(alphaMaskImageBuffer, 1, 0); #else alphaMask = new AlphaMaskByteUnclipped(alphaMaskImageBuffer, 1, 0); #endif numMasksSlider = new UI.Slider(5, 5, 150, 12); sliderValue = 0.0; AddChild(numMasksSlider); numMasksSlider.SetRange(5, 100); numMasksSlider.Value = 10; numMasksSlider.Text = "N={0:F3}"; numMasksSlider.OriginRelativeParent = Vector2.Zero; }
public lion_outline() { widthSlider = new MatterHackers.Agg.UI.Slider(new Vector2(5, 5), 498); renderAsScanlineCheckBox = new MatterHackers.Agg.UI.CheckBox(160, 5, "Use Scanline Rasterizer"); renderAsScanlineCheckBox.Checked = false; widthSlider.ValueChanged += new EventHandler(NeedsRedraw); renderAsScanlineCheckBox.CheckedStateChanged += NeedsRedraw; AddChild(widthSlider); widthSlider.OriginRelativeParent = Vector2.Zero; widthSlider.SetRange(0.0, 4.0); widthSlider.Value = 1.0; widthSlider.Text = "Width {0:F2}"; AddChild(renderAsScanlineCheckBox); //renderAsScanlineCheckBox.Transform = Affine.NewIdentity(); renderAccurateJoinsCheckBox = new CheckBox(200 + 10.0, 10.0 + 4.0 + 16.0, "Accurate Joins"); AddChild(renderAccurateJoinsCheckBox); }
public lion_outline() { widthSlider = new MatterHackers.Agg.UI.Slider(new Vector2(5, 5), 498); renderAsScanlineCheckBox = new MatterHackers.Agg.UI.CheckBox(160, 5, "Use Scanline Rasterizer"); renderAsScanlineCheckBox.Checked = false; widthSlider.ValueChanged += new EventHandler(NeedsRedraw); renderAsScanlineCheckBox.CheckedStateChanged += NeedsRedraw; AddChild(widthSlider); widthSlider.OriginRelativeParent = Vector2.Zero; widthSlider.SetRange(0.0, 4.0); widthSlider.Value = 1.0; widthSlider.Text = "Width {0:F2}"; AddChild(renderAsScanlineCheckBox); //renderAsScanlineCheckBox.Transform = Affine.NewIdentity(); renderAccurateJoinsCheckBox = new CheckBox(200 + 10.0, 10.0 + 4.0 + 16.0, "Accurate Joins"); AddChild(renderAccurateJoinsCheckBox); }
public rounded_rect_application() { AnchorAll(); m_idx = (-1); m_radius = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10), new Vector2(580, 9)); m_gamma = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 40), new Vector2(580, 9)); m_offset = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 80), new Vector2(580, 9)); m_white_on_black = new CheckBox(10, 10+60, "White on black"); m_DrawAsOutlineCheckBox = new CheckBox(10 + 180, 10 + 60, "Fill Rounded Rect"); m_radius.ValueChanged += new EventHandler(NeedsRedraw); m_gamma.ValueChanged += new EventHandler(NeedsRedraw); m_offset.ValueChanged += new EventHandler(NeedsRedraw); m_white_on_black.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(NeedsRedraw); m_DrawAsOutlineCheckBox.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(NeedsRedraw); m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; AddChild(m_radius); AddChild(m_gamma); AddChild(m_offset); AddChild(m_white_on_black); AddChild(m_DrawAsOutlineCheckBox); m_gamma.Text = "gamma={0:F3}"; m_gamma.SetRange(0.0, 3.0); m_gamma.Value = 1.8; m_radius.Text = "radius={0:F3}"; m_radius.SetRange(0.0, 50.0); m_radius.Value = 25.0; m_offset.Text = "subpixel offset={0:F3}"; m_offset.SetRange(-2.0, 3.0); m_white_on_black.TextColor = new RGBA_Bytes(127, 127, 127); //m_white_on_black.inactive_color(new RGBA_Bytes(127, 127, 127)); m_DrawAsOutlineCheckBox.TextColor = new RGBA_Floats(.5, .5, .5).GetAsRGBA_Bytes(); //m_DrawAsOutlineCheckBox.inactive_color(new RGBA_Bytes(127, 127, 127)); }
public rounded_rect_application() { AnchorAll(); m_idx = (-1); m_radius = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10), new Vector2(580, 9)); m_gamma = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 40), new Vector2(580, 9)); m_offset = new MatterHackers.Agg.UI.Slider(new Vector2(10, 10 + 80), new Vector2(580, 9)); m_white_on_black = new CheckBox(10, 10 + 60, "White on black"); m_DrawAsOutlineCheckBox = new CheckBox(10 + 180, 10 + 60, "Fill Rounded Rect"); m_radius.ValueChanged += new EventHandler(NeedsRedraw); m_gamma.ValueChanged += new EventHandler(NeedsRedraw); m_offset.ValueChanged += new EventHandler(NeedsRedraw); m_white_on_black.CheckedStateChanged += NeedsRedraw; m_DrawAsOutlineCheckBox.CheckedStateChanged += NeedsRedraw; m_x[0] = 100; m_y[0] = 100; m_x[1] = 500; m_y[1] = 350; AddChild(m_radius); AddChild(m_gamma); AddChild(m_offset); AddChild(m_white_on_black); AddChild(m_DrawAsOutlineCheckBox); m_gamma.Text = "gamma={0:F3}"; m_gamma.SetRange(0.0, 3.0); m_gamma.Value = 1.8; m_radius.Text = "radius={0:F3}"; m_radius.SetRange(0.0, 50.0); m_radius.Value = 25.0; m_offset.Text = "subpixel offset={0:F3}"; m_offset.SetRange(-2.0, 3.0); m_white_on_black.TextColor = new Color(127, 127, 127); //m_white_on_black.inactive_color(new RGBA_Bytes(127, 127, 127)); m_DrawAsOutlineCheckBox.TextColor = new ColorF(.5, .5, .5).ToColor(); //m_DrawAsOutlineCheckBox.inactive_color(new RGBA_Bytes(127, 127, 127)); }
public FloodFillDemo() { BackgroundColor = RGBA_Bytes.White; imageToFillOn = new ImageBuffer(400, 300, 32, new BlenderBGRA()); Graphics2D imageToFillGraphics = imageToFillOn.NewGraphics2D(); imageToFillGraphics.Clear(RGBA_Bytes.White); imageToFillGraphics.DrawString("Click to fill", 20, 30); imageToFillGraphics.Circle(new Vector2(200, 150), 35, RGBA_Bytes.Black); imageToFillGraphics.Circle(new Vector2(200, 150), 30, RGBA_Bytes.Green); imageToFillGraphics.Rectangle(20, 50, 210, 280, RGBA_Bytes.Black); imageToFillGraphics.Rectangle(imageToFillOn.GetBounds(), RGBA_Bytes.Blue); Random rand = new Random(); for (int i = 0; i < 20; i++) { Ellipse elipse = new Ellipse(rand.Next(imageToFillOn.Width), rand.Next(imageToFillOn.Height), rand.Next(10, 60), rand.Next(10, 60)); Stroke outline = new Stroke(elipse); imageToFillGraphics.Render(outline, RGBA_Bytes.Black); } m_slider1 = new Slider(new Vector2(80, 10), 510); m_slider2 = new Slider(new Vector2(80, 10 + 20), 510); m_slider1.ValueChanged += new EventHandler(NeedsRedraw); m_slider2.ValueChanged += new EventHandler(NeedsRedraw); AddChild(m_slider1); AddChild(m_slider2); m_slider1.Text = "Pixel size={0:F3}"; m_slider1.SetRange(8, 100); m_slider1.NumTicks = 23; m_slider1.Value = 32; m_slider2.Text = "gamma={0:F3}"; m_slider2.SetRange(0.0, 3.0); m_slider2.Value = 1.0; }
public FontHinter() { AnchorAll(); FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); pixelSizeSlider = new Slider(new Vector2(30, 30), 600 - 60); gammaSlider = new Slider(new Vector2(30, 70), 600 - 60); pixelSizeSlider.Text = "Pixel size={0:F3}"; pixelSizeSlider.SetRange(2, 20); pixelSizeSlider.NumTicks = 23; pixelSizeSlider.Value = 6; gammaSlider.Text = "Gamma={0:F3}"; gammaSlider.SetRange(0.0, 3.0); gammaSlider.Value = 1.0; topToBottom.AddChild(pixelSizeSlider); topToBottom.AddChild(gammaSlider); AddChild(topToBottom); }
void DoneLoadingGCode(object sender, EventArgs e) { gcodeProcessingStateInfoText.Text = ""; if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode != null && gcodeViewWidget.LoadedGCode.GCodeCommandQueue.Count > 0 && gcodeViewWidget.LoadedGCode.GCodeCommandQueue[0].secondsToEndFromHere > 0) { CreateOptionsContent(); SetLayerWidget setLayerWidget = new SetLayerWidget(gcodeViewWidget); setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop; layerSelectionButtonsPannel.AddChild(setLayerWidget); LayerNavigationWidget navigationWidget = new LayerNavigationWidget(gcodeViewWidget); navigationWidget.Margin = new BorderDouble(0, 0, 20, 0); layerSelectionButtonsPannel.AddChild(navigationWidget); selectLayerSlider = new Slider(new Vector2(), 10, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical); selectLayerSlider.ValueChanged += new EventHandler(selectLayerSlider_ValueChanged); gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged); AddChild(selectLayerSlider); SetSliderSize(); // let's change the active layer so that it is set to the first layer with data gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex + 1; gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex - 1; BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged); } }
private FlowLayoutWidget CreateRightButtonPanel(double buildHeight) { FlowLayoutWidget buttonRightPanel = new FlowLayoutWidget(FlowDirection.TopToBottom); buttonRightPanel.Width = 200; { BorderDouble buttonMargin = new BorderDouble(top: 3); // put in the word editing menu { CheckBox expandWordOptions = expandMenuOptionFactory.GenerateCheckBoxButton("Word Edit", "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandWordOptions.Margin = new BorderDouble(bottom: 2); buttonRightPanel.AddChild(expandWordOptions); FlowLayoutWidget wordOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); wordOptionContainer.HAnchor = HAnchor.ParentLeftRight; wordOptionContainer.Visible = false; buttonRightPanel.AddChild(wordOptionContainer); spacingScrollBar = InseretUiForSlider(wordOptionContainer, "Spacing:", .5, 1); { spacingScrollBar.ValueChanged += (sender, e) => { SetWordSpacing(Meshes, MeshTransforms, MeshPlatingData); RebuildUnderlineIfRequired(); }; } sizeScrollBar = InseretUiForSlider(wordOptionContainer, "Size:", .3, 2); { sizeScrollBar.ValueChanged += (sender, e) => { SetWordSize(Meshes, MeshTransforms); SetWordSpacing(Meshes, MeshTransforms, MeshPlatingData); RebuildUnderlineIfRequired(); }; } heightScrollBar = InseretUiForSlider(wordOptionContainer, "Height:", .05, 1); { heightScrollBar.ValueChanged += (sender, e) => { SetWordHeight(Meshes, MeshTransforms); RebuildUnderlineIfRequired(); }; } createUnderline = new CheckBox(new CheckBoxViewText("Underline", textColor: ActiveTheme.Instance.PrimaryTextColor)); createUnderline.Checked = true; createUnderline.Margin = new BorderDouble(10, 5); createUnderline.HAnchor = HAnchor.ParentLeft; wordOptionContainer.AddChild(createUnderline); createUnderline.CheckedStateChanged += (sender, e) => { int oldIndex = SelectedMeshIndex; if (!createUnderline.Checked) { // we need to remove the underline if (Meshes.Count > 1) { SelectedMeshIndex = Meshes.Count - 1; DeleteSelectedMesh(); } } else if (Meshes.Count > 0) { // we need to add the underline CreateUnderline(Meshes, MeshTransforms, MeshPlatingData); } SelectedMeshIndex = oldIndex; }; expandWordOptions.CheckedStateChanged += (sender, e) => { wordOptionContainer.Visible = expandWordOptions.Checked; }; expandWordOptions.Checked = true; } // put in the letter editing menu { CheckBox expandLetterOptions = expandMenuOptionFactory.GenerateCheckBoxButton("Letter", "icon_arrow_right_no_border_32x32.png", "icon_arrow_down_no_border_32x32.png"); expandLetterOptions.Margin = new BorderDouble(bottom: 2); //buttonRightPanel.AddChild(expandLetterOptions); FlowLayoutWidget letterOptionContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); letterOptionContainer.HAnchor = HAnchor.ParentLeftRight; letterOptionContainer.Visible = false; buttonRightPanel.AddChild(letterOptionContainer); Slider sizeScrollBar = InseretUiForSlider(letterOptionContainer, "Size:"); Slider heightScrollBar = InseretUiForSlider(letterOptionContainer, "Height:"); Slider rotationScrollBar = InseretUiForSlider(letterOptionContainer, "Rotation:"); expandLetterOptions.CheckedStateChanged += (sender, e) => { letterOptionContainer.Visible = expandLetterOptions.Checked; }; } GuiWidget verticalSpacer = new GuiWidget(); verticalSpacer.VAnchor = VAnchor.ParentBottomTop; buttonRightPanel.AddChild(verticalSpacer); saveButton = whiteButtonFactory.Generate("Save", centerText: true); saveButton.Visible = false; saveButton.Cursor = Cursors.Hand; saveAndExitButton = whiteButtonFactory.Generate("Save & Exit", centerText: true); saveAndExitButton.Visible = false; saveAndExitButton.Cursor = Cursors.Hand; //buttonRightPanel.AddChild(saveButton); buttonRightPanel.AddChild(saveAndExitButton); } buttonRightPanel.Padding = new BorderDouble(6, 6); buttonRightPanel.Margin = new BorderDouble(0, 1); buttonRightPanel.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRightPanel.VAnchor = VAnchor.ParentBottomTop; return buttonRightPanel; }
public aa_demo() { m_idx = -1; m_x[0] = 57; m_y[0] = 100; m_x[1] = 369; m_y[1] = 170; m_x[2] = 143; m_y[2] = 310; pixelSizeSlider = new Slider(new Vector2(30, 30), 600 - 60); gammaSlider = new Slider(new Vector2(30, 70), 600 - 60); pixelSizeSlider.ValueChanged += new EventHandler(NeedsRedraw); gammaSlider.ValueChanged += new EventHandler(NeedsRedraw); AddChild(pixelSizeSlider); AddChild(gammaSlider); pixelSizeSlider.Text = "Pixel size={0:F3}"; pixelSizeSlider.SetRange(8, 100); pixelSizeSlider.NumTicks = 23; pixelSizeSlider.Value = 32; gammaSlider.Text = "Gamma={0:F3}"; gammaSlider.SetRange(0.0, 3.0); gammaSlider.Value = 1.0; }
void DoneLoadingGCode(object sender, EventArgs e) { SetProcessingMessage(""); if (gcodeViewWidget != null && gcodeViewWidget.LoadedGCode != null && gcodeViewWidget.LoadedGCode.Count > 0) { CreateOptionsContent(); setLayerWidget = new SetLayerWidget(gcodeViewWidget); setLayerWidget.VAnchor = Agg.UI.VAnchor.ParentTop; layerSelectionButtonsPanel.AddChild(setLayerWidget); navigationWidget = new LayerNavigationWidget(gcodeViewWidget); navigationWidget.Margin = new BorderDouble(0, 0, 20, 0); layerSelectionButtonsPanel.AddChild(navigationWidget); selectLayerSlider = new Slider(new Vector2(), 10, 0, gcodeViewWidget.LoadedGCode.NumChangesInZ - 1, Orientation.Vertical); selectLayerSlider.ValueChanged += new EventHandler(selectLayerSlider_ValueChanged); gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged); AddChild(selectLayerSlider); layerStartRenderRatioTitle = new TextWidget(LocalizedString.Get("start:"), 50, 77, 10, Agg.Font.Justification.Right); AddChild(layerStartRenderRatioTitle); layerStartRenderRatioSlider = new Slider(new Vector2(), 10); layerStartRenderRatioSlider.ValueChanged += new EventHandler(layerStartRenderRatioSlider_ValueChanged); AddChild(layerStartRenderRatioSlider); layerEndRenderRationTitle = new TextWidget(LocalizedString.Get("end:"), 50, 57, 10, Agg.Font.Justification.Right); AddChild(layerEndRenderRationTitle); layerEndRenderRatioSlider = new Slider(new Vector2(), 10); layerEndRenderRatioSlider.Value = 1; layerEndRenderRatioSlider.ValueChanged += new EventHandler(layerEndRenderRatioSlider_ValueChanged); AddChild(layerEndRenderRatioSlider); SetSliderSizes(); // let's change the active layer so that it is set to the first layer with data gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex + 1; gcodeViewWidget.ActiveLayerIndex = gcodeViewWidget.ActiveLayerIndex - 1; BoundsChanged += new EventHandler(PartPreviewGCode_BoundsChanged); meshViewerWidget.partProcessingInfo.Visible = false; } }
protected static Slider InseretUiForSlider(FlowLayoutWidget wordOptionContainer, string header, double min = 0, double max = .5) { double scrollBarWidth = 100; TextWidget spacingText = new TextWidget(header, textColor: ActiveTheme.Instance.PrimaryTextColor); spacingText.Margin = new BorderDouble(10, 3, 3, 5); spacingText.HAnchor = HAnchor.ParentLeft; wordOptionContainer.AddChild(spacingText); Slider namedSlider = new Slider(new Vector2(), scrollBarWidth, 0, 1); namedSlider.Minimum = min; namedSlider.Maximum = max; namedSlider.Margin = new BorderDouble(3, 5, 3, 3); namedSlider.HAnchor = HAnchor.ParentCenter; namedSlider.View.BackgroundColor = new RGBA_Bytes(); wordOptionContainer.AddChild(namedSlider); return namedSlider; }
public line_patterns_application() { AnchorAll(); m_ctrl_color = new RGBA_Bytes(0, 0.3, 0.5, 0.3); m_scale_x = new Slider(5.0, 5.0, 240.0, 12.0); m_start_x = new Slider(250.0, 5.0, 495.0, 12.0); m_approximation_method = new CheckBox(10, 30, "Approximation Method = curve_div"); m_curve1.line_color(m_ctrl_color); m_curve2.line_color(m_ctrl_color); m_curve3.line_color(m_ctrl_color); m_curve4.line_color(m_ctrl_color); m_curve5.line_color(m_ctrl_color); m_curve6.line_color(m_ctrl_color); m_curve7.line_color(m_ctrl_color); m_curve8.line_color(m_ctrl_color); m_curve9.line_color(m_ctrl_color); m_curve1.curve(64, 19, 14, 126, 118, 266, 19, 265); m_curve2.curve(112, 113, 178, 32, 200, 132, 125, 438); m_curve3.curve(401, 24, 326, 149, 285, 11, 177, 77); m_curve4.curve(188, 427, 129, 295, 19, 283, 25, 410); m_curve5.curve(451, 346, 302, 218, 265, 441, 459, 400); m_curve6.curve(454, 198, 14, 13, 220, 291, 483, 283); m_curve7.curve(301, 398, 355, 231, 209, 211, 170, 353); m_curve8.curve(484, 101, 222, 33, 486, 435, 487, 138); m_curve9.curve(143, 147, 11, 45, 83, 427, 132, 197); AddChild(m_curve1); AddChild(m_curve2); AddChild(m_curve3); AddChild(m_curve4); AddChild(m_curve5); AddChild(m_curve6); AddChild(m_curve7); AddChild(m_curve8); AddChild(m_curve9); AddChild(m_approximation_method); m_scale_x.Text = "Scale X=%.2f"; m_scale_x.SetRange(0.2, 3.0); m_scale_x.Value = 1.0; AddChild(m_scale_x); m_start_x.Text = "Start X=%.2f"; m_start_x.SetRange(0.0, 10.0); m_start_x.Value = 0.0; AddChild(m_start_x); m_approximation_method.CheckedStateChanged += m_approximation_method_CheckedStateChanged; }
private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox adjustmentControlsGroupBox = new GroupBox(new LocalizedString("Tuning Adjustment (while printing)").Translated); adjustmentControlsGroupBox.Margin = new BorderDouble(0); adjustmentControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; adjustmentControlsGroupBox.Height = 93; { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 6); tuningRatiosLayout.AnchorAll(); tuningRatiosLayout.Padding = new BorderDouble(3, 5, 3, 0); TextWidget feedRateDescription; { FlowLayoutWidget feedRateLeftToRight; { feedRateValue = new NumberEdit(1, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40); feedRateLeftToRight = new FlowLayoutWidget(); feedRateDescription = new TextWidget(new LocalizedString("Speed Multiplier").Translated); feedRateDescription.TextColor = RGBA_Bytes.White; feedRateLeftToRight.AddChild(feedRateDescription); feedRateRatioSlider = new Slider(new Vector2(), 300, minFeedRateRatio, maxFeedRateRatio); feedRateRatioSlider.Margin = new BorderDouble(5, 0); feedRateRatioSlider.Value = PrinterCommunication.Instance.FeedRateRatio; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value; }; PrinterCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents); feedRateValue.EditComplete += (sender, e) => { feedRateRatioSlider.Value = feedRateValue.Value; }; feedRateLeftToRight.AddChild(feedRateRatioSlider); tuningRatiosLayout.AddChild(feedRateLeftToRight); feedRateLeftToRight.AddChild(feedRateValue); feedRateValue.Margin = new BorderDouble(0, 0, 5, 0); textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; feedRateLeftToRight.AddChild(textImageButtonFactory.Generate(new LocalizedString("Set").Translated)); } TextWidget extrusionDescription; { extrusionValue = new NumberEdit(1, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40); FlowLayoutWidget leftToRight = new FlowLayoutWidget(); extrusionDescription = new TextWidget(new LocalizedString("Extrusion Multiplier").Translated); extrusionDescription.TextColor = RGBA_Bytes.White; leftToRight.AddChild(extrusionDescription); extrusionRatioSlider = new Slider(new Vector2(), 300, minExtrutionRatio, maxExtrusionRatio); extrusionRatioSlider.Margin = new BorderDouble(5, 0); extrusionRatioSlider.Value = PrinterCommunication.Instance.ExtrusionRatio; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value; }; PrinterCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents); extrusionValue.EditComplete += (sender, e) => { extrusionRatioSlider.Value = extrusionValue.Value; }; leftToRight.AddChild(extrusionRatioSlider); tuningRatiosLayout.AddChild(leftToRight); leftToRight.AddChild(extrusionValue); extrusionValue.Margin = new BorderDouble(0, 0, 5, 0); textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; leftToRight.AddChild(textImageButtonFactory.Generate(new LocalizedString("Set").Translated)); } feedRateDescription.Width = extrusionDescription.Width; feedRateDescription.MinimumSize = new Vector2(extrusionDescription.Width, feedRateDescription.MinimumSize.y); feedRateLeftToRight.HAnchor = HAnchor.FitToChildren; feedRateLeftToRight.VAnchor = VAnchor.FitToChildren; } adjustmentControlsGroupBox.AddChild(tuningRatiosLayout); } tuningAdjustmentControlsContainer = new DisableableWidget(); tuningAdjustmentControlsContainer.AddChild(adjustmentControlsGroupBox); controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer); }
public TextEditPage() : base("Text Edit Widget") { FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); BackgroundColor = new RGBA_Bytes(210, 210, 255); topToBottom.Padding = new BorderDouble(20); topToBottom.AddChild(new TextWidget("testing underline jpqy", underline: true)); topToBottom.AddChild(new TextWidget("testing1\ntest2\ntest3")); topToBottom.AddChild(new TextWidget("this is some multiline\ntext\nwith centering", justification: Justification.Center)); int tabIndex = 0; #if true InternalTextEditWidget internalMultiLine = new InternalTextEditWidget("line1\nline2\nline3", 12, true, tabIndex++); //InternalTextEditWidget internalMultiLine = new InternalTextEditWidget("Line 1 - Multi Line Text Control\nLine 2 - Multi Line Text Control\nLine 3 - Multi Line Text Control\n", 12, true); topToBottom.AddChild(internalMultiLine); #endif // show some masking for passwords { FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.Margin = new BorderDouble(3); TextEditWidget passwordeTextEdit = new TextEditWidget("Password", tabIndex: tabIndex++); //passwordeTextEdit.InternalTextEditWidget.MaskCharacter = '*'; passwordeTextEdit.Margin = new BorderDouble(4, 0); leftToRight.AddChild(passwordeTextEdit); TextWidget description = new TextWidget("Content:"); leftToRight.AddChild(description); TextWidget passwordContent = new TextWidget("Password"); leftToRight.AddChild(passwordContent); passwordeTextEdit.TextChanged += (sender, e) => { passwordContent.Text = passwordeTextEdit.Text; }; topToBottom.AddChild(leftToRight); } TextEditWidget singleLineTextEdit = new TextEditWidget("Single Line Edit Text Control", tabIndex: tabIndex++); topToBottom.AddChild(singleLineTextEdit); TextEditWidget multiLineTextConrol = new TextEditWidget("Line 1 - Multi Line Text Control\nLine 2 - Multi Line Text Control\nLine 3 - Multi Line Text Control\n", tabIndex: tabIndex++); multiLineTextConrol.Multiline = true; topToBottom.AddChild(multiLineTextConrol); TextEditWidget longTextWidget = new TextEditWidget("This is some really long text.", pixelWidth: 100, tabIndex: tabIndex++); topToBottom.AddChild(longTextWidget); topToBottom.AddChild(new TextWidget("Integer Text Control:")); topToBottom.AddChild(new NumberEdit(512102416, tabIndex: tabIndex++)); topToBottom.AddChild(new TextWidget("Floating Point Text Control:")); topToBottom.AddChild(new NumberEdit(512102416, allowNegatives: true, allowDecimals: true, tabIndex: tabIndex++)); TextWidget paddingAdjustText = new TextWidget("Padding: 0"); paddingAdjustText.AutoExpandBoundsToText = true; topToBottom.AddChild(paddingAdjustText); TextEditWidget paddingAdjustTextEdit = new TextEditWidget("Edit With Padding", tabIndex: tabIndex++); GuiWidget paddingAroundTextEdit = new GuiWidget(100, 16); topToBottom.AddChild(paddingAroundTextEdit); paddingAroundTextEdit.AddChild(paddingAdjustTextEdit); paddingAdjustText.SetBoundsToEncloseChildren(); //AddChild(new TextEditWidget("Multiline Edit Text Widget line 1\nline 2\nline 3", 200, 400, 200, 80, multiLine: true)); AddChild(topToBottom); foreach (GuiWidget child in topToBottom.Children) { //child.Padding = new BorderDouble(4); child.HAnchor = UI.HAnchor.ParentCenter; child.BackgroundColor = RGBA_Bytes.White; //child.Margin = new BorderDouble(3); if (child is TextWidget) { child.BackgroundColor = new RGBA_Bytes(255, 200, 200); } } Slider textPaddingSlider = new Slider(new Vector2(), 200, 0, 10); topToBottom.AddChild(textPaddingSlider); textPaddingSlider.ValueChanged += (sender, e) => { double padding = ((Slider)sender).Value; paddingAdjustText.Padding = new BorderDouble(padding); paddingAroundTextEdit.Padding = new BorderDouble(padding); paddingAroundTextEdit.SetBoundsToEncloseChildren(); ((Slider)sender).Parent.SetBoundsToEncloseChildren(); }; topToBottom.HAnchor = UI.HAnchor.ParentCenter; topToBottom.VAnchor = UI.VAnchor.ParentCenter; }