Esempio n. 1
0
 public virtual string GraphicBox(int width,
                                  int height,
                                  int thickness,
                                  LineColor lineColor)
 {
     return($"^GB{width},{height},{thickness},{(char) lineColor}^FS");
 }
Esempio n. 2
0
        /// <summary>
        /// Graphic Box
        /// </summary>
        /// <param name="boxWidth">Box width (borderThickness or 1 to 32000)</param>
        /// <param name="boxHeight">Box height (borderThickness or 1 to 32000)</param>
        /// <param name="borderThickness">Border thickness (1 to 32000)</param>
        /// <param name="lineColor">Line color</param>
        /// <param name="degreeOfCornerrounding">Degree of cornerrounding (0 to 8)</param>
        public GraphicBoxCommand(
            int?boxWidth               = null,
            int?boxHeight              = null,
            int?borderThickness        = null,
            LineColor lineColor        = LineColor.Black,
            int?degreeOfCornerrounding = null)
            : this()
        {
            if (this.ValidateIntParameter(nameof(borderThickness), borderThickness, 1, 32000))
            {
                this.BorderThickness = borderThickness.Value;
                this.BoxWidth        = this.BorderThickness;
                this.BoxHeight       = this.BorderThickness;
            }

            if (this.ValidateIntParameter(nameof(boxWidth), boxWidth, this.BorderThickness, 32000))
            {
                this.BoxWidth = boxWidth.Value;
            }

            if (this.ValidateIntParameter(nameof(boxHeight), boxHeight, this.BorderThickness, 32000))
            {
                this.BoxHeight = boxHeight.Value;
            }

            this.LineColor = lineColor;

            if (this.ValidateIntParameter(nameof(degreeOfCornerrounding), degreeOfCornerrounding, 0, 8))
            {
                this.DegreeOfCornerrounding = degreeOfCornerrounding.Value;
            }
        }
Esempio n. 3
0
        public Move TryJailOut(LineColor color, int val)
        {
            int jailOutPlace;

            if (color == LineColor.Black)
            {
                jailOutPlace = 24 + 1 - val;
                if (Lines[jailOutPlace].LineColor == LineColor.Black ||
                    Lines[jailOutPlace].LineColor == LineColor.None ||
                    (Lines[jailOutPlace].LineColor == LineColor.White && Lines[jailOutPlace].PiecesNumber == 1))
                {
                    return(new Move(26, jailOutPlace));
                }
            }
            if (color == LineColor.White)
            {
                jailOutPlace = val;
                if (Lines[jailOutPlace].LineColor == LineColor.White ||
                    Lines[jailOutPlace].LineColor == LineColor.None ||
                    (Lines[jailOutPlace].LineColor == LineColor.Black && Lines[jailOutPlace].PiecesNumber == 1))
                {
                    return(new Move(27, jailOutPlace));
                }
            }
            return(null);
        }
        public override string GenerateNameBySettings()
        {
            string colorStr;

            GetKnownColor(LineColor.ToArgb(), out colorStr);
            return(string.Format("Узкий диапазон [{0}]", colorStr));
        }
Esempio n. 5
0
        public void RenderUnfilledElements(PlotRendererD2D canvas, System.Windows.Rect chartArea, System.Windows.Media.MatrixTransform PrimitiveTransform)
        {
            var storedTransform = canvas.RenderTarget.Transform;

            //canvas.RenderTarget.Transform = PrimitiveTransform.ToD2D();

            //for(int segmentIndex = 0; segmentIndex < _lineColors.Count; ++segmentIndex) {
            //  var brush = canvas.RenderTarget.CreateSolidColorBrush(_lineColors[segmentIndex].ToD2D());
            //  canvas.RenderTarget.DrawLine(Points[segmentIndex * 2].ToD2D(), Points[segmentIndex * 2 + 1].ToD2D(), brush, (float)LineThickness);
            //}
            //canvas.RenderTarget.Transform = storedTransform;


            if (this.LineColor != System.Windows.Media.Colors.Transparent && LineThickness > 0)
            {
                GeometryAndFlag gnf = null;
                if (!_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf) || gnf.RecalcGeometry)
                {
                    CalculateGeometry(canvas.D2DFactory, chartArea);
                }
                if (_geometryByFactory.TryGetValue(canvas.D2DFactory.NativePointer, out gnf))
                {
                    var transformedGeometry = new TransformedGeometry(canvas.D2DFactory, gnf.UnfilledGeometry, PrimitiveTransform.ToD2D());

                    var brush = new SolidColorBrush(canvas.RenderTarget, LineColor.ToD2D());

                    canvas.RenderTarget.DrawGeometry(transformedGeometry, brush, (float)LineThickness);
                }
            }
        }
Esempio n. 6
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageNum = pageArrayBin.pageCount;
            UInt32 lineNum = pageArrayBin.pageArray[pageNum].lineNum++;

            if (pageArrayBin.pageArray[pageNum].m_line == null)
            {
                pageArrayBin.pageArray[pageNum].m_line = new LineBin[SVLimit.PAGE_LINE_MAXNUM];
            }

            LineBin lineBtn = pageArrayBin.pageArray[pageNum].m_line[lineNum];

            lineBtn.id    = ID;
            lineBtn.color = (UInt32)LineColor.ToArgb();
            lineBtn.width = LineWidth;

            ///起始坐标
            lineBtn.x1 = (UInt16)_startPos.X;
            lineBtn.y1 = (UInt16)_startPos.Y;

            ///结束坐标
            if (ShowType)
            {
                lineBtn.x2 = (UInt16)(lineBtn.x1 + LineLength - 1);
                lineBtn.y2 = lineBtn.y1;
            }
            else
            {
                lineBtn.x2 = lineBtn.x1;
                lineBtn.y2 = (UInt16)(lineBtn.y1 + LineLength - 1);
            }

            pageArrayBin.pageArray[pageNum].m_line[lineNum] = lineBtn;
        }
Esempio n. 7
0
        /// <summary>
        /// Helper to load Settings and populate the form elements
        /// <see cref="Settings"/>
        /// </summary>
        public void LoadSettings()
        {
            // line
            LineThickness                   = Settings.LineThickness;
            tB_LineThickness.Text           = LineThickness.ToString();
            LineMaxLength                   = Settings.LineMaxLength;
            tB_LineMaxLength.Text           = LineMaxLength.ToString();
            LineDividerLengthFactor         = Settings.LineSubdividerLengthFactor;
            tB_LineDividerLengthFactor.Text = LineDividerLengthFactor.ToString();
            ScaleStyle = Settings.Style;
            lB_ScaleStyle.DataStore = Enum.GetNames(typeof(ScaleOverlay.ScaleStyle));

            // text
            TextHeight         = Settings.TextHeight;
            tB_TextHeight.Text = TextHeight.ToString();
            TextFont           = Settings.TextFont;
            fP_TextFont.Value  = TextFont.ToEtoFont();

            // position
            OffsetX         = Settings.OffsetX;
            tB_OffsetX.Text = OffsetX.ToString();
            OffsetY         = Settings.OffsetY;
            tB_OffsetY.Text = OffsetY.ToString();
            TextGap         = Settings.TextGap;
            tB_TextGap.Text = TextGap.ToString();

            // color
            LineColor = Settings.LineColor;
            btn_LineColor.BackgroundColor = LineColor.ToEto();
            TextColor = Settings.TextColor;
            btn_TextColor.BackgroundColor = TextColor.ToEto();
        }
Esempio n. 8
0
        /// <summary>
        /// Set drawing color for the robot with code.
        /// </summary>
        /// <param name="color">Parameter for LineColor object to save the color as hexcode.</param>
        public void SetDrawingColor(LineColor color)
        {
            switch (color)
            {
            case LineColor.Black:
                lineColor = "#FF000000";
                break;

            case LineColor.Red:
                lineColor = "#FFFF0000";
                break;

            case LineColor.Blue:
                lineColor = "#FFFF0000";
                break;

            case LineColor.Green:
                lineColor = "#FF008000";
                break;

            case LineColor.Yellow:
                lineColor = "#FFFFFF00";
                break;

            case LineColor.Orange:
                lineColor = "#FFFFA500";
                break;

            default:     // Gray
                lineColor = "#FF808080";
                break;
            }
        }
Esempio n. 9
0
        private void Canvas_PaintSurface(object sender, SKPaintSurfaceEventArgs args)
        {
            SKImageInfo info    = args.Info;
            SKSurface   surface = args.Surface;
            SKCanvas    canvas  = surface.Canvas;

            canvas.Clear();

            SKPaint paint = new SKPaint
            {
                Style       = SKPaintStyle.Stroke,
                Color       = LineColor.ToSKColor(),
                StrokeWidth = HeightRequest > 0 ? (float)HeightRequest : (float)WidthRequest,
                StrokeCap   = SKStrokeCap.Butt,
                PathEffect  = SKPathEffect.CreateDash(new float[] { DashSize, WhiteSize }, Phase)
            };

            SKPath path = new SKPath();

            if (HeightRequest > 0)
            {
                // Horizontal
                path.MoveTo(0, 0);
                path.LineTo(info.Width, 0);
            }
            else
            {
                // Vertikal
                path.MoveTo(0, 0);
                path.LineTo(0, info.Height);
            }

            canvas.DrawPath(path, paint);
        }
Esempio n. 10
0
 public void addOne(LineColor color)
 {
     if (LineColor == LineColor.None)
     {
         LineColor = color;
     }
     PiecesNumber += 1;
 }
Esempio n. 11
0
 public Preferences(bool useStandardSet)
 {
     if (useStandardSet)
     {
         LineColor.Add(DrawClass.Colors.Black);
         LineColor.Add(DrawClass.Colors.Black);
         LineColor.Add(DrawClass.Colors.Gray);
     }
 }
 private RenderPreferences GetPreferences()
 {
     return(new RenderPreferences(
                DefaultFillColor.ToDrawingColor(),
                LineColor.ToDrawingColor(),
                SelectedFillColor.ToDrawingColor(),
                ShowCountyLines,
                ShowCountyNames));
 }
        protected override void OnAttached()
        {
            IntPtr IntPtrtextViewClass        = JNIEnv.FindClass(typeof(TextView));
            IntPtr mCursorDrawableResProperty = JNIEnv.GetFieldID(IntPtrtextViewClass, "mCursorDrawableRes", "I");

            JNIEnv.SetField(Control.Handle, mCursorDrawableResProperty, ColorResourceId);

            Control.Background.Mutate().SetColorFilter(LineColor.ToAndroid(), Graphics.PorterDuff.Mode.SrcAtop);
        }
Esempio n. 14
0
 void OnSerializingMethod(StreamingContext sc)
 {
     Images      = new string[] { Image };
     sLabelColor = LabelColor.ToString();
     sLineColor  = LineColor.ToString();
     FontFamily  = TextFormat.FontFamily.ToString();
     FontStyle   = TextFormat.FontStyle.ToString();
     FontWeight  = TextFormat.FontWeight.ToString();
 }
Esempio n. 15
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (Item != null)
         {
             hashCode = hashCode * 59 + Item.GetHashCode();
         }
         if (Axis != null)
         {
             hashCode = hashCode * 59 + Axis.GetHashCode();
         }
         if (Label != null)
         {
             hashCode = hashCode * 59 + Label.GetHashCode();
         }
         if (Chart != null)
         {
             hashCode = hashCode * 59 + Chart.GetHashCode();
         }
         if (Legend != null)
         {
             hashCode = hashCode * 59 + Legend.GetHashCode();
         }
         if (Fill != null)
         {
             hashCode = hashCode * 59 + Fill.GetHashCode();
         }
         if (LineColor != null)
         {
             hashCode = hashCode * 59 + LineColor.GetHashCode();
         }
         if (LineWidth != null)
         {
             hashCode = hashCode * 59 + LineWidth.GetHashCode();
         }
         if (LineStyle != null)
         {
             hashCode = hashCode * 59 + LineStyle.GetHashCode();
         }
         if (MarkerColor != null)
         {
             hashCode = hashCode * 59 + MarkerColor.GetHashCode();
         }
         if (MarkerSymbol != null)
         {
             hashCode = hashCode * 59 + MarkerSymbol.GetHashCode();
         }
         if (RepeatTime != null)
         {
             hashCode = hashCode * 59 + RepeatTime.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Changes the color of the line permanantly
 /// </summary>
 /// <param name="color"> The color to change to </param>
 public void changeColorPerm(LineColor color)
 {
     if (mCurrActive == mYellowLine)
     {
         return;
     }
     mCurrActive.SetActive(false);
     switchCurrActive(color);
     mCurrActive.SetActive(true);
 }
Esempio n. 17
0
        public override void Draw(Graphics g)
        {
            if (X2 == X1 || Y2 == Y1)
            {
                return;
            }

            g.DrawLine(new Pen(Color.FromArgb(LineAlpha, LineColor.ToColor()), LineThickness),
                       new PointF(X1, Y1), new PointF(X2, Y2));
        }
Esempio n. 18
0
 public ZplGraphicEllipse(
     int positionX,
     int positionY,
     int width,
     int height,
     int borderThickness = 1,
     LineColor lineColor = LineColor.Black)
     : base(positionX, positionY, width, height, borderThickness, lineColor, 0)
 {
 }
Esempio n. 19
0
 public ZplGraphicCircle(
     int positionX,
     int positionY,
     int diameter,
     int borderThickness = 1,
     LineColor lineColor = LineColor.Black,
     bool bottomToTop    = false)
     : base(positionX, positionY, borderThickness, lineColor, bottomToTop: bottomToTop)
 {
     Diameter = diameter;
 }
Esempio n. 20
0
        private void btn_LineColor_Clicked(object sender, EventArgs e)
        {
            ColorDialog dialog = new ColorDialog {
                Color = LineColor.ToEto()
            };

            if (dialog.ShowDialog(this) == DialogResult.Ok)
            {
                btn_LineColor.BackgroundColor = dialog.Color;
                LineColor = System.Drawing.Color.FromArgb(dialog.Color.ToArgb());
            }
        }
 public ZplGraphicDiagonalLine(
     int positionX,
     int positionY,
     int width,
     int height,
     int borderThickness       = 1,
     bool rightLeaningDiagonal = false,
     LineColor lineColor       = LineColor.Black)
     : base(positionX, positionY, width, height, borderThickness, lineColor, 0)
 {
     RightLeaningDiagonal = rightLeaningDiagonal;
 }
Esempio n. 22
0
 private static IEnumerable <RouteData> GetElements(
     b.Panel gridLines,
     b.Panel gridButtons,
     LineColor color) =>
 gridLines.Children.OfType <p.Path>()
 .Zip(gridButtons.Children.OfType <b.Button>(),
      (path, btn) =>
      new RouteData
 {
     Pair  = Tuple.Create(path, btn),
     Color = color
 });
Esempio n. 23
0
		internal bool			recalc;			// Line changed
		#endregion	// Local Variables

		#region Constructors
		internal Line (Document document, LineEnding ending)
		{
			this.document = document; 
			color = LineColor.Red;
			left = null;
			right = null;
			parent = null;
			text = null;
			recalc = true;
			alignment = document.alignment;

			this.ending = ending;
		}
Esempio n. 24
0
        /// <summary>
        /// Get Zpl char for line color
        /// </summary>
        /// <param name="lineColor"></param>
        /// <returns></returns>
        protected string RenderLineColor(LineColor lineColor)
        {
            switch (lineColor)
            {
            case LineColor.Black:
                return("B");

            case LineColor.White:
                return("W");
            }

            throw new NotImplementedException("Unknown Line Color");
        }
Esempio n. 25
0
    /// <summary>
    /// Changes the color of the line to a different color for a period of time
    /// </summary>
    /// <param name="waitTime"> the time to change the line for </param>
    /// <param name="color"> the color to change to </param>
    /// <returns> The WaitForSeconds value </returns>
    public IEnumerator changeColor(float waitTime, LineColor color)
    {
        GameObject returnTo = mCurrActive;

        mCurrActive.SetActive(false);
        switchCurrActive(color);
        mCurrActive.SetActive(true);
        yield return(new WaitForSeconds(waitTime));

        mCurrActive.SetActive(false);
        mCurrActive = returnTo;
        mCurrActive.SetActive(true);
    }
Esempio n. 26
0
 public ZplGraphicElement(
     int positionX,
     int positionY,
     int borderThickness = 1,
     LineColor lineColor = LineColor.Black,
     bool reversePrint   = false,
     bool bottomToTop    = false)
     : base(positionX, positionY, bottomToTop)
 {
     BorderThickness = borderThickness;
     LineColor       = lineColor;
     ReversePrint    = reversePrint;
 }
Esempio n. 27
0
        public TrainViewModel(Train model) : base(model)
        {
            Class       = model.ObserveProperty(m => m.Class).ToReactiveProperty();
            LineColor   = model.ObserveProperty(m => m.LineColor).ToReactiveProperty();
            Seat        = model.ObserveProperty(m => m.Seat).Select(s => new TransportSeatViewModel(s)).ToReactiveProperty();
            HasRestRoom = model.ObserveProperty(m => m.HasRestRoom).ToReactiveProperty();
            MealType    = model.ObserveProperty(m => m.MealType).ToReactiveProperty();

            // ViewModel -> Model
            Class.Subscribe(x => model.Class             = x).AddTo(Disposables);
            LineColor.Subscribe(x => model.LineColor     = x).AddTo(Disposables);
            HasRestRoom.Subscribe(x => model.HasRestRoom = x).AddTo(Disposables);
        }
Esempio n. 28
0
        private static Hashtable kerning_fonts = new Hashtable(); // record which fonts use kerning
        #endregion                                                // Local Variables

        #region Constructors
        internal Line(Document document, LineEnding ending)
        {
            this.document = document;
            color         = LineColor.Red;
            left          = null;
            right         = null;
            parent        = null;
            text          = null;
            recalc        = true;
            alignment     = document.alignment;

            this.ending = ending;
        }
Esempio n. 29
0
        private int CountPieces(LineColor color)
        {
            int count = 0;

            foreach (var line in Lines)
            {
                if (line.LineColor == color)
                {
                    count += line.PiecesNumber;
                }
            }
            return(count);
        }
Esempio n. 30
0
        private void CreateMaterials(Material function, Material plane)
        {
            for (int c = 0; c < LineColor.Count(); c++)
            {
                functionMaterials[c]       = new Material(function);
                functionMaterials[c].color = LineColor.Get(c);
            }

            for (int c = 0; c < PlaneColor.Count(); c++)
            {
                planeMaterials[c]       = new Material(plane);
                planeMaterials[c].color = PlaneColor.Get(c);
            }
        }
Esempio n. 31
0
        public static Color Convert(LineColor color)
        {
            switch (color)
            {
            case LineColor.Red:
                return(Colors.Red);

            case LineColor.Green:
                return(Colors.Green);

            case LineColor.Blue:
                return(Colors.Blue);

            default:
                return(Colors.White);
            }
        }
Esempio n. 32
0
 /// <summary>
 /// Set drawing color for the robot with code.
 /// </summary>
 /// <param name="color">Parameter for LineColor object to save the color as hexcode.</param>
 public void SetDrawingColor(LineColor color)
 {
     switch (color)
         {
         case LineColor.Black:
             lineColor = "#FF000000";
             break;
         case LineColor.Red:
             lineColor = "#FFFF0000";
             break;
         case LineColor.Blue:
             lineColor = "#FFFF0000";
             break;
         case LineColor.Green:
             lineColor = "#FF008000";
             break;
         case LineColor.Yellow:
             lineColor = "#FFFFFF00";
             break;
         case LineColor.Orange:
             lineColor = "#FFFFA500";
             break;
         default: // Gray
             lineColor = "#FF808080";
             break;
     }                
 }
Esempio n. 33
0
	/// <summary>
	/// Draws the line.
	/// </summary>
	/// <param name='direction'>
	/// Direction.
	/// </param>
	/// <param name='color'>
	/// Color.
	/// </param>
	public void DrawLine(LineDirection direction, LineColor color)
	{
		DrawLine(direction, color, -1f);
	}
Esempio n. 34
0
	/// <summary>
	/// Draws the line.
	/// </summary>
	/// <param name='direction'>
	/// Direction.
	/// </param>
	/// <param name='color'>
	/// Color.
	/// </param>
	/// <param name='length'>
	/// Length.
	/// </param>
	public void DrawLine(LineDirection direction, LineColor color, float length)
	{
		m_GUIColor = GUI.color;
		switch (color) {
		case LineColor.Dark:
			GUI.color = darkTextColor;
			break;
		case LineColor.Medium:
			GUI.color = mediumTextColor;
			break;
		case LineColor.Light:
			GUI.color = lightTextColor;
			break;
		case LineColor.Highlighted:
			GUI.color = highlightTextColor;
			break;
		}
		switch (direction) {
		case LineDirection.Horizontal:
			if (length > 0f) {
				GUILayout.Box("", line, GUILayout.Height(lineWeight), GUILayout.Width(length));
			}
			else {
				GUILayout.Box("", line, GUILayout.Height(lineWeight));
			}
			break;
		case LineDirection.Vertical:
			if (length > 0f) {
				GUILayout.Box("", line, GUILayout.Width(lineWeight), GUILayout.Height(length));
			}
			else {
				GUILayout.Box("", line, GUILayout.Width(lineWeight));
			}
			break;
		}
		GUI.color = m_GUIColor;
	}