コード例 #1
0
        public void SetToDefaults()
        {
            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();
        }
コード例 #2
0
 public Brush CreateBrush(bool swapColors)
 {
     if (!swapColors)
     {
         return(BrushInfo.CreateBrush(PrimaryColor.ToColor(), SecondaryColor.ToColor()));
     }
     else
     {
         return(BrushInfo.CreateBrush(SecondaryColor.ToColor(), PrimaryColor.ToColor()));
     }
 }
コード例 #3
0
        public Pen CreatePen(BrushInfo brushInfo, Color foreColor, Color backColor)
        {
            Pen pen;

            if (brushInfo.BrushType == BrushType.None)
            {
                pen = new Pen(foreColor, width);
            }
            else
            {
                pen = new Pen(brushInfo.CreateBrush(foreColor, backColor), width);
            }

            LineCap       startLineCap;
            CustomLineCap startCustomLineCap;

            LineCapToLineCap2(this.startCap, out startLineCap, out startCustomLineCap);

            if (startCustomLineCap != null)
            {
                pen.CustomStartCap = startCustomLineCap;
            }
            else
            {
                pen.StartCap = startLineCap;
            }

            LineCap       endLineCap;
            CustomLineCap endCustomLineCap;

            LineCapToLineCap2(this.endCap, out endLineCap, out endCustomLineCap);

            if (endCustomLineCap != null)
            {
                pen.CustomEndCap = endCustomLineCap;
            }
            else
            {
                pen.EndCap = endLineCap;
            }

            pen.DashStyle = this.dashStyle;

            return(pen);
        }
コード例 #4
0
 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.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();
 }