public void SetToDefaults() { this.antiAliasing = true; this.fontSmoothing = FontSmoothing.Smooth; this.primaryColor = ColorBgra.FromBgra(0, 0, 0, 255); this.secondaryColor = ColorBgra.FromBgra(255, 255, 255, 255); this.gradientInfo = new GradientInfo(GradientType.LinearClamped, false); this.penInfo = new PenInfo(PenInfo.DefaultDashStyle, 2.0f, PenInfo.DefaultLineCap, PenInfo.DefaultLineCap, PenInfo.DefaultCapScale); this.brushInfo = new BrushInfo(BrushType.Solid, HatchStyle.BackwardDiagonal); try { this.fontInfo = new FontInfo(new FontFamily("Arial"), 12, FontStyle.Regular); } catch (Exception) { this.fontInfo = new FontInfo(new FontFamily(GenericFontFamilies.SansSerif), 12, FontStyle.Regular); } this.textAlignment = TextAlignment.Left; this.shapeDrawType = ShapeDrawType.Outline; this.alphaBlending = true; this.tolerance = 0.5f; this.colorPickerClickBehavior = ColorPickerClickBehavior.NoToolSwitch; this.resamplingAlgorithm = ResamplingAlgorithm.Bilinear; this.selectionCombineMode = CombineMode.Replace; this.floodMode = FloodMode.Local; this.selectionDrawModeInfo = SelectionDrawModeInfo.CreateDefault(); }
protected override Geometry OnCreateInteriorFillGeometry(RectDouble bounds, IDictionary <string, object> settingValues) { float num = (float)settingValues[ToolSettings.Null.Radius.Path]; ShapeDrawType type = (ShapeDrawType)settingValues[ToolSettings.Null.Shapes.DrawType.Path]; if ((type & ShapeDrawType.Outline) != ShapeDrawType.Outline) { return(this.GetFlattenedRoundedRectangleGeometry(bounds, (double)num, (double)num)); } return(this.OnCreateOutlineDrawGeometry(bounds, settingValues)); }
public void LoadFrom(AppEnvironment appEnvironment) { this.textAlignment = appEnvironment.textAlignment; this.gradientInfo = appEnvironment.gradientInfo.Clone(); this.fontSmoothing = appEnvironment.fontSmoothing; this.fontInfo = appEnvironment.fontInfo.Clone(); this.penInfo = appEnvironment.penInfo.Clone(); this.brushInfo = appEnvironment.brushInfo.Clone(); this.primaryColor = appEnvironment.primaryColor; this.secondaryColor = appEnvironment.secondaryColor; this.alphaBlending = appEnvironment.alphaBlending; this.shapeDrawType = appEnvironment.shapeDrawType; this.antiAliasing = appEnvironment.antiAliasing; this.colorPickerClickBehavior = appEnvironment.colorPickerClickBehavior; this.resamplingAlgorithm = appEnvironment.resamplingAlgorithm; this.tolerance = appEnvironment.tolerance; PerformAllChanged(); }
protected sealed override ShapeRenderData OnCreateRenderData(ShapeRenderParameters renderParams) { ShapeDrawType type = (ShapeDrawType)renderParams.SettingValues[ToolSettings.Null.Shapes.DrawType.Path]; RectDouble bounds = RectDouble.FromCorners(renderParams.StartPoint, renderParams.EndPoint); Geometry guideGeometry = this.OnCreateGuideGeometry(bounds, renderParams.SettingValues); Geometry interiorFillGeometry = null; if ((type & ShapeDrawType.Interior) == ShapeDrawType.Interior) { interiorFillGeometry = this.OnCreateInteriorFillGeometry(bounds, renderParams.SettingValues); } Geometry outlineDrawGeometry = null; Geometry outlineFillGeometry = null; if ((type & ShapeDrawType.Outline) == ShapeDrawType.Outline) { outlineDrawGeometry = this.OnCreateOutlineDrawGeometry(bounds, renderParams.SettingValues); outlineFillGeometry = this.OnCreateOutlineFillGeometry(bounds, renderParams.SettingValues); } return(new ShapeRenderData(guideGeometry, interiorFillGeometry, outlineDrawGeometry, outlineFillGeometry)); }
protected override Geometry OnCreateInteriorFillGeometry(RectDouble bounds, IDictionary <string, object> settingValues) { RectDouble? nullable; ShapeDrawType type = (ShapeDrawType)settingValues[ToolSettings.Null.Shapes.DrawType.Path]; if ((type & ShapeDrawType.Outline) == ShapeDrawType.Outline) { float num = (float)settingValues[ToolSettings.Null.Pen.Width.Path]; double penWidth = num; nullable = RectangleShapeBase.TryGetInsetInteriorFillBounds(bounds, penWidth); } else { nullable = new RectDouble?(bounds); } if (!nullable.HasValue) { return(null); } return(new RectangleGeometry(nullable.Value).EnsureFrozen <RectangleGeometry>()); }
public void LoadFrom(ToolEnvironment toolEnvironment) { this.textAlignment = toolEnvironment.textAlignment; this.gradientInfo = toolEnvironment.gradientInfo.Clone(); this.fontSmoothing = toolEnvironment.fontSmoothing; this.fontInfo = toolEnvironment.fontInfo.Clone(); this.penInfo = toolEnvironment.penInfo.Clone(); this.brushInfo = toolEnvironment.brushInfo.Clone(); this.primaryColor = toolEnvironment.primaryColor; this.secondaryColor = toolEnvironment.secondaryColor; this.alphaBlending = toolEnvironment.alphaBlending; this.shapeDrawType = toolEnvironment.shapeDrawType; this.antiAliasing = toolEnvironment.antiAliasing; this.colorPickerClickBehavior = toolEnvironment.colorPickerClickBehavior; this.resamplingAlgorithm = toolEnvironment.resamplingAlgorithm; this.tolerance = toolEnvironment.tolerance; this.selectionCombineMode = toolEnvironment.selectionCombineMode; this.floodMode = toolEnvironment.floodMode; this.selectionDrawModeInfo = toolEnvironment.selectionDrawModeInfo.Clone(); PerformAllChanged(); }
public ToolConfigStrip() { SuspendLayout(); InitializeComponent(); this.solidBrushText = PdnResources.GetString("BrushConfigWidget.SolidBrush.Text"); // "Solid Brush" this.brushStyleComboBox.Items.Add(this.solidBrushText); string[] styleNames = this.hatchStyleNames.GetLocalizedNames(); Array.Sort(styleNames); foreach (string styleName in styleNames) { brushStyleComboBox.Items.Add(styleName); } brushStyleComboBox.SelectedIndex = 0; this.brushStyleLabel.Text = PdnResources.GetString("BrushConfigWidget.FillStyleLabel.Text"); this.shapeDrawType = ShapeDrawType.Outline; this.shapeButton.Image = this.shapeOutlineImage.Reference; this.penSizeLabel.Text = PdnResources.GetString("PenConfigWidget.BrushWidthLabel"); this.penSizeComboBox.ComboBox.SuspendLayout(); for (int i = 0; i < this.brushSizes.Length; ++i) { this.penSizeComboBox.Items.Add(this.brushSizes[i].ToString()); } this.penSizeComboBox.ComboBox.ResumeLayout(false); this.penSizeComboBox.SelectedIndex = 1; // default to brush size of 2 this.penSizeDecButton.ToolTipText = PdnResources.GetString("ToolConfigStrip.PenSizeDecButton.ToolTipText"); this.penSizeDecButton.Image = ImageResource.Get("Icons.MinusButtonIcon.png").Reference; this.penSizeIncButton.ToolTipText = PdnResources.GetString("ToolConfigStrip.PenSizeIncButton.ToolTipText"); this.penSizeIncButton.Image = ImageResource.Get("Icons.PlusButtonIcon.png").Reference; this.gradientLinearClampedButton.ToolTipText = this.gradientTypeNames.EnumValueToLocalizedName(GradientType.LinearClamped); this.gradientLinearClampedButton.Image = ImageResource.Get("Icons.LinearClampedGradientIcon.png").Reference; this.gradientLinearReflectedButton.ToolTipText = this.gradientTypeNames.EnumValueToLocalizedName(GradientType.LinearReflected); this.gradientLinearReflectedButton.Image = ImageResource.Get("Icons.LinearReflectedGradientIcon.png").Reference; this.gradientLinearDiamondButton.ToolTipText = this.gradientTypeNames.EnumValueToLocalizedName(GradientType.LinearDiamond); this.gradientLinearDiamondButton.Image = ImageResource.Get("Icons.LinearDiamondGradientIcon.png").Reference; this.gradientRadialButton.ToolTipText = this.gradientTypeNames.EnumValueToLocalizedName(GradientType.Radial); this.gradientRadialButton.Image = ImageResource.Get("Icons.RadialGradientIcon.png").Reference; this.gradientConicalButton.ToolTipText = this.gradientTypeNames.EnumValueToLocalizedName(GradientType.Conical); this.gradientConicalButton.Image = ImageResource.Get("Icons.ConicalGradientIcon.png").Reference; this.gradientAllColorChannelsImage = ImageResource.Get("Icons.AllColorChannelsIcon.png"); this.gradientAlphaChannelOnlyImage = ImageResource.Get("Icons.AlphaChannelOnlyIcon.png"); this.gradientChannelsSplitButton.Image = this.gradientAllColorChannelsImage.Reference; this.antiAliasingEnabledImage = ImageResource.Get("Icons.AntiAliasingEnabledIcon.png"); this.antiAliasingDisabledImage = ImageResource.Get("Icons.AntiAliasingDisabledIcon.png"); this.antiAliasingSplitButton.Image = this.antiAliasingEnabledImage.Reference; this.alphaBlendingEnabledImage = ImageResource.Get("Icons.BlendingEnabledIcon.png"); this.alphaBlendingOverwriteImage = ImageResource.Get("Icons.BlendingOverwriteIcon.png"); this.alphaBlendingSplitButton.Image = this.alphaBlendingEnabledImage.Reference; this.penSizeComboBox.Size = new Size(UI.ScaleWidth(this.penSizeComboBox.Width), penSizeComboBox.Height); this.brushStyleComboBox.Size = new Size(UI.ScaleWidth(this.brushStyleComboBox.Width), brushStyleComboBox.Height); this.brushStyleComboBox.DropDownWidth = UI.ScaleWidth(this.brushStyleComboBox.DropDownWidth); this.brushStyleComboBox.DropDownHeight = UI.ScaleHeight(this.brushStyleComboBox.DropDownHeight); this.toleranceLabel.Text = PdnResources.GetString("ToleranceConfig.ToleranceLabel.Text"); this.toleranceSlider.Tolerance = 0.5f; this.fontSizeComboBox.ComboBox.SuspendLayout(); for (int i = 0; i < this.defaultFontSizes.Length; ++i) { this.fontSizeComboBox.Items.Add(this.defaultFontSizes[i].ToString()); } this.fontSizeComboBox.ComboBox.ResumeLayout(false); this.fontSmoothingComboBox.Items.AddRange( new object[] { this.fontSmoothingLocalizer.EnumValueToLocalizedName(FontSmoothing.Smooth), this.fontSmoothingLocalizer.EnumValueToLocalizedName(FontSmoothing.Sharp) }); this.fontSmoothingComboBox.SelectedIndex = 0; this.fontLabel.Text = PdnResources.GetString("TextConfigWidget.FontLabel.Text"); try { this.arialFontFamily = new FontFamily(arialName); } catch (Exception) { this.arialFontFamily = new FontFamily(System.Drawing.Text.GenericFontFamilies.SansSerif); } try { this.arialFontBase = new Font(arialFontFamily, initialFontSize, FontStyle.Regular); } catch (Exception) { this.arialFontBase = new Font(FontFamily.GenericSansSerif, initialFontSize, FontStyle.Regular); } this.fontFamilyComboBox.ComboBox.DropDownHeight = 600; this.alignment = TextAlignment.Left; this.fontAlignLeftButton.Checked = true; this.oldSizeValue = initialFontSize; this.highlightBrush = new SolidBrush(SystemColors.Highlight); this.highlightTextBrush = new SolidBrush(SystemColors.HighlightText); this.windowBrush = new SolidBrush(SystemColors.Window); this.windowTextBrush = new SolidBrush(SystemColors.WindowText); // These buttons need a color key to maintain consistency with v2.5 language packs this.fontBoldButton.ImageTransparentColor = Utility.TransparentKey; this.fontItalicsButton.ImageTransparentColor = Utility.TransparentKey; this.fontUnderlineButton.ImageTransparentColor = Utility.TransparentKey; this.fontBoldButton.Image = PdnResources.GetImageBmpOrPng("Icons.FontBoldIcon"); this.fontItalicsButton.Image = PdnResources.GetImageBmpOrPng("Icons.FontItalicIcon"); this.fontUnderlineButton.Image = PdnResources.GetImageBmpOrPng("Icons.FontUnderlineIcon"); this.fontAlignLeftButton.Image = PdnResources.GetImage("Icons.TextAlignLeftIcon.png"); this.fontAlignCenterButton.Image = PdnResources.GetImage("Icons.TextAlignCenterIcon.png"); this.fontAlignRightButton.Image = PdnResources.GetImage("Icons.TextAlignRightIcon.png"); this.fontBoldButton.ToolTipText = PdnResources.GetString("TextConfigWidget.BoldButton.ToolTipText"); this.fontItalicsButton.ToolTipText = PdnResources.GetString("TextConfigWidget.ItalicButton.ToolTipText"); this.fontUnderlineButton.ToolTipText = PdnResources.GetString("TextConfigWidget.UnderlineButton.ToolTipText"); this.fontAlignLeftButton.ToolTipText = PdnResources.GetString("TextConfigWidget.AlignLeftButton.ToolTipText"); this.fontAlignCenterButton.ToolTipText = PdnResources.GetString("TextConfigWidget.AlignCenterButton.ToolTipText"); this.fontAlignRightButton.ToolTipText = PdnResources.GetString("TextConfigWidget.AlignRightButton.ToolTipText"); this.fontFamilyComboBox.Size = new Size(UI.ScaleWidth(this.fontFamilyComboBox.Width), fontFamilyComboBox.Height); this.fontFamilyComboBox.DropDownWidth = UI.ScaleWidth(this.fontFamilyComboBox.DropDownWidth); this.fontSizeComboBox.Size = new Size(UI.ScaleWidth(this.fontSizeComboBox.Width), fontSizeComboBox.Height); this.fontSmoothingComboBox.Size = new Size(UI.ScaleWidth(this.fontSmoothingComboBox.Width), fontSmoothingComboBox.Height); this.fontSmoothingComboBox.DropDownWidth = UI.ScaleWidth(this.fontSmoothingComboBox.DropDownWidth); this.resamplingLabel.Text = PdnResources.GetString("ToolConfigStrip.ResamplingLabel.Text"); this.resamplingComboBox.BeginUpdate(); this.resamplingComboBox.Items.Add(this.resamplingAlgorithmNames.EnumValueToLocalizedName(ResamplingAlgorithm.Bilinear)); this.resamplingComboBox.Items.Add(this.resamplingAlgorithmNames.EnumValueToLocalizedName(ResamplingAlgorithm.NearestNeighbor)); this.resamplingComboBox.EndUpdate(); this.resamplingComboBox.SelectedIndex = 0; // bilinear this.resamplingComboBox.Size = new Size(UI.ScaleWidth(this.resamplingComboBox.Width), resamplingComboBox.Height); this.resamplingComboBox.DropDownWidth = UI.ScaleWidth(this.resamplingComboBox.DropDownWidth); this.colorPickerLabel.Text = PdnResources.GetString("ToolConfigStrip.ColorPickerLabel.Text"); string[] colorPickerBehaviorNames = this.colorPickerBehaviorNames.GetLocalizedNames(); // Make sure these items are sorted to be in the order specified by the enumeration Array.Sort<string>( colorPickerBehaviorNames, delegate(string lhs, string rhs) { ColorPickerClickBehavior lhsE = (ColorPickerClickBehavior)this.colorPickerBehaviorNames.LocalizedNameToEnumValue(lhs); ColorPickerClickBehavior rhsE = (ColorPickerClickBehavior)this.colorPickerBehaviorNames.LocalizedNameToEnumValue(rhs); if ((int)lhsE < (int)rhsE) { return -1; } else if ((int)lhsE > (int)rhsE) { return +1; } else { return 0; } }); this.colorPickerComboBox.Items.AddRange(colorPickerBehaviorNames); this.colorPickerComboBox.SelectedIndex = 0; this.colorPickerComboBox.Size = new Size(UI.ScaleWidth(this.colorPickerComboBox.Width), colorPickerComboBox.Height); this.colorPickerComboBox.DropDownWidth = UI.ScaleWidth(this.colorPickerComboBox.DropDownWidth); this.toleranceSlider.Size = UI.ScaleSize(this.toleranceSlider.Size); ToolBarConfigItems = ToolBarConfigItems.None; ResumeLayout(false); }
public void SetToDefaults() { this.antiAliasing = true; this.fontSmoothing = FontSmoothing.Smooth; this.primaryColor = ColorBgra.FromBgra(0, 0, 0, 255); this.secondaryColor = ColorBgra.FromBgra(255, 255, 255, 255); this.gradientInfo = new GradientInfo(GradientType.LinearClamped, false); this.penInfo = new PenInfo(PenInfo.DefaultDashStyle, 2.0f, PenInfo.DefaultLineCap, PenInfo.DefaultLineCap, PenInfo.DefaultCapScale); this.brushInfo = new BrushInfo(BrushType.Solid, HatchStyle.BackwardDiagonal); try { this.fontInfo = new FontInfo(new FontFamily("Arial"), 12, FontStyle.Regular); } catch (Exception) { this.fontInfo = new FontInfo(new FontFamily(GenericFontFamilies.SansSerif), 12, FontStyle.Regular); } this.textAlignment = TextAlignment.Left; this.shapeDrawType = ShapeDrawType.Outline; this.alphaBlending = true; this.tolerance = 0.5f; this.colorPickerClickBehavior = ColorPickerClickBehavior.NoToolSwitch; this.resamplingAlgorithm = ResamplingAlgorithm.Bilinear; this.selectionCombineMode = CombineMode.Replace; this.floodMode = FloodMode.Local; this.selectionDrawModeInfo = SelectionDrawModeInfo.CreateDefault(); }
public void LoadFrom(AppEnvironment appEnvironment) { this.textAlignment = appEnvironment.textAlignment; this.gradientInfo = appEnvironment.gradientInfo.Clone(); this.fontSmoothing = appEnvironment.fontSmoothing; this.fontInfo = appEnvironment.fontInfo.Clone(); this.penInfo = appEnvironment.penInfo.Clone(); this.brushInfo = appEnvironment.brushInfo.Clone(); this.primaryColor = appEnvironment.primaryColor; this.secondaryColor = appEnvironment.secondaryColor; this.alphaBlending = appEnvironment.alphaBlending; this.shapeDrawType = appEnvironment.shapeDrawType; this.antiAliasing = appEnvironment.antiAliasing; this.colorPickerClickBehavior = appEnvironment.colorPickerClickBehavior; this.resamplingAlgorithm = appEnvironment.resamplingAlgorithm; this.tolerance = appEnvironment.tolerance; this.selectionCombineMode = appEnvironment.selectionCombineMode; this.floodMode = appEnvironment.floodMode; this.selectionDrawModeInfo = appEnvironment.selectionDrawModeInfo.Clone(); PerformAllChanged(); }