private void Init(int x, int y) { InitBackground(); mPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, Palette.Red.Value); mImageBg = new Image(this, 12, 40); mImageFg = new Image(this, 12, 40); Text.Label(this, mDescription, 16, 0, 0, Width, 16); Text.Label(this, mPhysical, 18, 0, Height - 50, Width, 18); mActiveArea = new TextArea(this, 0, (int)(Height * 0.4f), Width, 40); mActiveArea.SetAlign(Align.Center, new GfxPoint(0, 5)); mActiveArea.SetFont(Palette.White, 45); AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff)))); Format = "{0:0}"; //MaxValue = 100; //SetValue(100); SetValue(0); mSensor.OnUpdate += sensor => SetValue(sensor.Value / 10.0f); Move(x, y); }
public bool AddColor(byte percent, Color color) { if (color == null) { return(false); } if (percent > 100) { percent = 100; } if (mPercent == 100) { return(false); } if (mPercent < percent || percent == 0) { mPercent = percent; } else { return(false); } mColorRamps.Add(mPercent / 100f); mColorRamps.AddRange(color.Value); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, mColorRamps.Count, mColorRamps.ToArray()); return(true); }
private void Init(int x) { //Width = 16; //Height = mCount * (Width + 5) - 5; //Y = (Application.Screen.Height - Height) / 2 + 10; Resize(16, mCount * (Width + 5) - 5); mPath = VGPath.OpenVGPath(); mActivePaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mActivePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0x2EBF0EFF)).Value); mDefaultPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mDefaultPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0x3B3C3DFF)).Value); mText = new List <TextArea[]>(); for (var i = 0; i < mCount; i++) { mText.Add(Text.Label(this, string.Format("{0}", i + 1), 17, -1, (i * (Width + 5)) - 3, 16, 16)); } SetSpeed(0); mSensor.OnUpdate += sensor => SetSpeed((byte)sensor.Value); Move(x, (Application.Screen.Height - Height) / 2 + 10); }
private void Init(int x, int y) { InitBackground(); Text.Label(this, "Напряжение\\nв сети", 14, 0, 0, Width, 14); mPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value); mRollArea = new TextArea(this, 0, 45, Width, 30) { Text = "" }; mRollArea.SetAlign(Align.Center, new GfxPoint(0, 5)); mRollArea.SetFont(Palette.White, 22); mRollArea.Text = string.Format("{0:0} В", mSensor.Value); mSensor.OnUpdate += sensor => { mRollArea.Text = string.Format("{0:0} В", sensor.Value); }; AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff)))); Move(x, y); }
public void SetBorder(int width, Color color) { mBorderWidth = width; VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, color == null ? Palette.Black.Value : color.Value); Invalidate(); }
protected override void Draw() { //VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, new[] { 0.0f, 1.0f, 0.0f, 0.5f }); //VG.vgClear(0, 0, Width, Height); //VG.vgFinish(); VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); #region draw text if (Text == null) { return; } VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, FontColor.Value); VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); float[] glyphOrigin = { 0.0f, 0.0f }; // set glyph matrices VG.vgSetfv(VGParamType.VG_GLYPH_ORIGIN, 2, glyphOrigin); VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE); VG.vgLoadIdentity(); var widthText = (TextWidth > Width) ? Width : TextWidth; switch (TextAlign) { case Align.Left: VG.vgTranslate(TextOffset.X, TextOffset.Y); break; case Align.Center: VG.vgTranslate((Width - widthText + TextOffset.X) / 2f, TextOffset.Y); break; case Align.Right: VG.vgTranslate((Width - widthText - TextOffset.X), TextOffset.Y); break; } VG.vgTranslate(RotateCenter.X, RotateCenter.Y); VG.vgRotate(mRotate); VG.vgTranslate(-RotateCenter.X, -RotateCenter.Y); VG.vgScale(FontSize, FontSize); mFontRender.RenderText(Text); VG.vgFinish(); #endregion }
private void Init(int x, int y) { InitBackground(); mImage = new Image(this, 10, 35); mImage.Load("./wvga.filter.raw"); Text.Label(this, "Фильтр\\nв системе смазки", 14, 0, 0, Width, 14); mPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value); mRollArea = new TextArea(this, Width - 50, 45, 49, 30) { Text = "" }; mRollArea.SetAlign(Align.Center, new GfxPoint(0, 5)); mRollArea.SetFont(Palette.White, 16); const int kLimit = 10; mRollArea.Text = string.Format("{0}", "Отключен"); VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x2EC90Eff).Value); mSensor.OnUpdate += sensor => { if (mStatus.ValueAsInt == 0) { mRollArea.Text = string.Format("{0}", "Отключен"); VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x2EC90Eff).Value); } else { mRollArea.Text = string.Format("{0}", sensor.Value / 10.0f); //mRollArea.Text = string.Format("{0}", sensor.Value > kLimit ? "Норма" : "Авария"); VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, sensor.Value > kLimit ? (new Color(0x2EC90Eff)).Value : (new Color(0xE3AB1Fff)).Value); } }; AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff)))); Move(x, y); mFilterPath = VGPath.OpenVGPath(); VGU.vguRect(mFilterPath, mImage.ScreenPosition.X + 1, mImage.ScreenPosition.Y + 1, mImage.Width - 2, mImage.Height - 2); mFilterPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mFilterPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value); }
protected override void Draw() { // draw bg if (Background != null) { VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, Background.Value); VG.vgClear(X, Y, Width, Height); } if (Grid != null) { Grid.Update(); } if (Arrows != null) { Arrows.Update(); } // draw line if (mGrapihcs.Count > 0) { foreach (var data in from data in mGrapihcs where data != null where data.Data != null where data.Data.Length > 0 select data) { VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); VG.vgTranslate(X + data.Position.X, Y + data.Position.Y); // (40, 20) VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, data.StrokeWidth); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, data.Color != null ? data.Color.Value : Palette.Black.Value); VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); var size = (data.Data.Length - 1) > (Width - data.Position.X) ? (Width - data.Position.X) : (data.Data.Length - 1); for (var i = 0; i < size; i++) { VGU.vguLine(mPath, i, data.Data[i], i + 1, data.Data[i + 1]); } VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); } } }
public override void Draw() { //base.Update(); { VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); foreach (var rect in mRects) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, rect.Color); VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); VG.vgDrawPath(rect.Path, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); } } //base.Update(); }
public override void Update() { VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); #region fill rect { VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); if (State == ButtonState.Released) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, PressColor.Value); } else { var release = new Color { A = PressColor.A, R = PressColor.R * 0.7f, G = PressColor.G * 0.7f, B = PressColor.B * 0.7f }; VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, release.Value); } VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); } #endregion base.Update(); }
private void Init(int x, int y) { InitBackground(); mImage = new Image(this, 9, 25); mImage.Load("./wvga.roll_tangage.raw"); Text.Label(this, "Тангаж", 14, 0, 0, Width, 14); Text.Label(this, "Крен", 14, 0, Height - 20, Width, 14); mPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value); mPitchArea = new TextArea(this, Width - 25, 80, 24, 30) { Text = "" }; mPitchArea.SetAlign(Align.Right, new GfxPoint(0, 5)); mPitchArea.SetFont(Palette.White, 16); mPitchArea.OnPaint += caller => { ((TextArea)caller).Text = string.Format("{0} ⁰", Pitch); }; mRollArea = new TextArea(this, Width - 25, 5, 24, 30) { Text = "" }; mRollArea.SetAlign(Align.Right, new GfxPoint(0, 5)); mRollArea.SetFont(Palette.White, 16); mRollArea.OnPaint += caller => { ((TextArea)caller).Text = string.Format("{0} ⁰", Roll); }; AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff)))); Move(x, y); }
private void Init(int x, int y) { InitBackground(); Text.Label(this, mDescription, 14, 0, 0, Width, 14); //Text.Label(this, "100%", 14, 0, 0, Width, 14); //Text.Label(this, "0%", 14, 0, 0, Width, 14); mPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value); Format = "{0:0}"; mActiveArea = new TextArea(this, Width - 40, (int)(Height * 0.45f), 40, 30);// SetValue(0); mActiveArea.SetAlign(Align.Left, new GfxPoint(0, 5)); mActiveArea.SetFont(Palette.White, 22); AddVGPath(new VGPath(mPath, null, new VGSolidColor(new Color(0x2c2d2eff)))); { var i = VGPath.OpenVGPath(); VGU.vguRect(i, 0, 0, 45, 59); var rv = new VGPath(i, new VGSolidColor(new Color(0x6d6e71ff)), new VGSolidColor(new Color(0x414041ff))) { StrokeWidth = 1.0f }; rv.Move(X + 12, Y + 32); AddVGPath(rv); } mSensor.OnUpdate += sensor => SetValue(sensor.Value / 10.0f); Move(x, y); }
public override void Update() { if (!IsVisible) { return; } if (Width == 0 || Height == 0) { return; } if (!mIsRealUpdate) { // copy image from mCache VG.vgSetPixels(X, Y, mCache, 0, 0, Width, Height); return; } mIsRealUpdate = false; VG.vgLoadIdentity(); VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); #region draw line { VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); float lineSize; if (!mActivated) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, ParentWindow.Background.Value); lineSize = 10.0f; } else { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0xe0 / 255f, 0x8f / 255f, 0x1e / 255f, 1.0f }); lineSize = 2.0f; } VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, lineSize); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); VG.vgFinish(); } #endregion #region fill rect { var colStops = new float[25];// xRGBA VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT); if (!mActivated) { colStops[0] = 0.0f; colStops[1] = 0xb3 / 255f; colStops[2] = 0xb4 / 255f; colStops[3] = 0xb5 / 255f; colStops[4] = 1.0f; colStops[5] = 0.20f; colStops[6] = 0xb3 / 255f; colStops[7] = 0xb4 / 255f; colStops[8] = 0xb5 / 255f; colStops[9] = 1.0f; colStops[10] = 0.80f; colStops[11] = 0x8a / 255f; colStops[12] = 0x8b / 255f; colStops[13] = 0x8c / 255f; colStops[14] = 1.0f; colStops[15] = 1.0f; colStops[16] = 0x8a / 255f; colStops[17] = 0x8b / 255f; colStops[18] = 0x8c / 255f; colStops[19] = 1.0f; } else { colStops[0] = 0.0f; colStops[1] = 0xef / 255f; colStops[2] = 0xf0 / 255f; colStops[3] = 0xf0 / 255f; colStops[4] = 1.0f; colStops[5] = 0.20f; colStops[6] = 0xef / 255f; colStops[7] = 0xf0 / 255f; colStops[8] = 0xf0 / 255f; colStops[9] = 1.0f; colStops[10] = 0.80f; colStops[11] = 0xb6 / 255f; colStops[12] = 0xb6 / 255f; colStops[13] = 0xb6 / 255f; colStops[14] = 1.0f; colStops[15] = 1.0f; colStops[16] = 0xb6 / 255f; colStops[17] = 0xb6 / 255f; colStops[18] = 0xb6 / 255f; colStops[19] = 1.0f; } VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y + Height, X, Y }); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 20, colStops); VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); var lineSize = 10.0f; VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound); //VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); } #endregion base.Update(); // copy render image to cache VG.vgGetPixels(mCache, 0, 0, X, Y, Width, Height); }
public VGSolidColor(Color color) { mPaint = VG.vgCreatePaint(); VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, color.Value); }
public void SetColor(Color color) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, color.Value); }
public void Move(float x0, float y0, float x1, float y1) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new[] { x0, y0, x1, y1 }); }
public void Move(float cx, float cy, float fx, float fy, float radius) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_RADIAL_GRADIENT, 5, new[] { cx, -cy, fx, -fy, radius }); }
public void SetColor(float[] color) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, color); }
public override void Draw() { if (!IsVisible) { return; } // draw bg if (Background != null) { VG.vgSetfv(VGParamType.VG_CLEAR_COLOR, 4, Background.Value); VG.vgClear(X, Y, Width, Height); VG.vgFinish(); } if (Arrows != null) { Arrows.Update(X, Y); } VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f); VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, 0, null); VG.vgSetParameterfv(mStrokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(0x575959FF).Value); VG.vgSetPaint(mStrokePaint, VGPaintMode.VG_STROKE_PATH); switch (Type) { case VisializationType.Realtime: { //mApplication.DebugTimeToConsole("realtime"); #region Realtime if (Grid != null) { Grid.Update(X, Y); } VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); // draw rectangles if (mGrapihcs.Count > 0) { lock (mGrapihcs) foreach (var data in from data in mGrapihcs where data != null where data.Data != null where data.Data.Length > 0 select data) { VG.vgLoadIdentity(); VG.vgTranslate(X + data.Position.X, Y + data.Position.Y); // (40, 20) var size = (data.Data.Length - 1) > (((uint)(kOxWidht)) - data.Position.X) ? (((uint)(kOxWidht)) - data.Position.X) : (data.Data.Length - 1); for (var i = 0; i < size; i++) { VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); var maxY = data.Data[i] < 5 ? 5 : data.Data[i]; // минимальное значение - 5 единиц, чтобы было видно секции maxY = data.Data[i] == ushort.MaxValue ? 5 : maxY; // проверяем флаг на наличие датчика maxY /= 2; VGU.vguRect(mPath, i * (kOxWidht / 177f), 0, (kOxWidht / 177f), maxY); var color = (data.Data[i] == ushort.MaxValue) ? Palette.White : new Color(GetColor(data.Data[i])); VG.vgSetParameterfv(mFillPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, color.Value); VG.vgSetPaint(mFillPaint, VGPaintMode.VG_FILL_PATH); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); } } } #endregion } break; case VisializationType.History: { if (HistoryReports != null) { if (HistoryReports.Length > 0) { //Console.WriteLine("history: {0}", HistoryReports.Length); VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); VG.vgTranslate(X + 40, Y + 20); // (40, 20) foreach (var label in mVHistoryLabels) { label.Text = ""; } var depth = 0; for (var j = 0; j < HistoryReports.Length; j++) { var data = HistoryReports[j].Restore(); if (j % 5 == 0) { //Console.WriteLine("history: {0}", j); var index = j / 5; var date = HistoryReports[j].Time; mVHistoryLabels[2 * index].Text = date.ToString("HH:mm"); mVHistoryLabels[2 * index + 1].Text = date.ToString("dd") + "/" + date.ToString("MM"); } if (data != null) { var size = (data.Length - 1); for (var i = 0; i < size; i++) { if (data[i] == ushort.MaxValue) { continue; } VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); const int kRectHeight = 12; VGU.vguRect(mPath, i * (kOxWidht / 177f), depth * kRectHeight, (kOxWidht / 177f), kRectHeight); VG.vgSetParameterfv(mFillPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new Color(GetColor(data[i])).Value); VG.vgSetPaint(mFillPaint, VGPaintMode.VG_FILL_PATH); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); } } else { Console.WriteLine("oooops"); } depth++; } } } } break; } //base.Update(); }
protected override void Draw() { if (!IsVisible) { return; } VG.vgLoadIdentity(); VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); var position = ScreenPosition; VG.vgTranslate(position.X, position.Y); //VG.vgRotate(mRotate); //Status.Rotate(mRotate); #region draw percent if (mPercent > 0) { VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VGU.vguRoundRect(mPath, 0, 0, Width, Height, mRound, mRound); // draw percent line if (PercentLine != null) { PercentLine.SetPaint(VGPaintMode.VG_FILL_PATH); } VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); } #endregion #region draw background VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, RootWindow.Background.Value); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0.0f, 0.0f, 0.0f, 1.0f }); VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); var percentWidth = (Width * Percent) / 100f; VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VGU.vguRect(mPath, percentWidth, 0, Width - percentWidth, Height); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); #endregion #region draw line { if (Border != null) { Border.SetPaint(VGPaintMode.VG_STROKE_PATH); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, kLineSize); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); //VGU.vguRoundRect(mPath, kLineSize / 2f, kLineSize / 2f, Width - kLineSize, Height - kLineSize, mRound, mRound); VGU.vguRoundRect(mPath, 0, 0, Width, Height, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); VG.vgFinish(); } } #endregion //base.Update(); VG.vgFinish(); }
public override void Update() { VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); #region fill rect { var colStops = new float[25];// xRGBA colStops[0] = 0.0f; colStops[1] = PressColor.R * 0.7f; colStops[2] = PressColor.G * 0.7f; colStops[3] = PressColor.B * 0.7f; colStops[4] = PressColor.A * 1.0f; colStops[5] = 0.2f; colStops[6] = PressColor.R * 1.0f; colStops[7] = PressColor.G * 1.0f; colStops[8] = PressColor.B * 1.0f; colStops[9] = PressColor.A * 1.0f; // Fill with linear gradient paint //VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT); //VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_RADIAL_GRADIENT); if (State == ButtonState.Pressed) { //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, PressColor.Value); colStops[1] = PressColor.R * 0.4f; colStops[2] = PressColor.G * 0.4f; colStops[3] = PressColor.B * 0.4f; colStops[6] = PressColor.R * 0.7f; colStops[7] = PressColor.G * 0.7f; colStops[8] = PressColor.B * 0.7f; VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y, X, Y + Height }); //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_RADIAL_GRADIENT, 5, new float[] { mX + mWidth / 2, mY, // mX + mWidth / 2, mY + mHeight * 2, // mWidth }); } else { //VG.vgTranslate(3,-3); //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, ReleaseColor.Value); colStops[1] = PressColor.R * 0.7f; colStops[2] = PressColor.G * 0.7f; colStops[3] = PressColor.B * 0.7f; colStops[6] = PressColor.R * 1.0f; colStops[7] = PressColor.G * 1.0f; colStops[8] = PressColor.B * 1.0f; VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y, X, Y + Height }); //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_RADIAL_GRADIENT, 5, new float[] { mX + mWidth / 2, mY, // mX + mWidth / 2, mY - mHeight * 2, // mWidth }); } VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 10, colStops); VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); } #endregion #region draw line { VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 1.0f, 1.0f, 1.0f, 1.0f }); VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 3.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); VG.vgFinish(); } #endregion base.Update(); }
public override void Update() { if (Width == 0 || Height == 0) { return; } if (!IsVisible) { return; } VG.vgLoadIdentity(); if (!mIsRealUpdate) { // copy image from mCache VG.vgSetPixels(X - 1, Y - 1, mCache, 0, 0, Width + 2, Height + 2); return; } mIsRealUpdate = false; VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); #region fill rect { var colStops = new float[25];// xRGBA VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT); if (State == ButtonState.Released) { colStops[0] = 0.0f; colStops[1] = 0x2c / 255f; colStops[2] = 0x2d / 255f; colStops[3] = 0x2f / 255f; colStops[4] = 1.0f; colStops[5] = 0.20f; colStops[6] = 0x34 / 255f; colStops[7] = 0x35 / 255f; colStops[8] = 0x37 / 255f; colStops[9] = 1.0f; colStops[10] = 0.80f; colStops[11] = 0x34 / 255f; colStops[12] = 0x35 / 255f; colStops[13] = 0x37 / 255f; colStops[14] = 1.0f; colStops[15] = 1.0f; colStops[16] = 0x43 / 255f; colStops[17] = 0x43 / 255f; colStops[18] = 0x47 / 255f; colStops[19] = 1.0f; } else { colStops[0] = 0.0f; colStops[1] = 0x47 / 255f; colStops[2] = 0x49 / 255f; colStops[3] = 0x4d / 255f; colStops[4] = 1.0f; colStops[5] = 0.20f; colStops[6] = 0x2e / 255f; colStops[7] = 0x30 / 255f; colStops[8] = 0x32 / 255f; colStops[9] = 1.0f; colStops[10] = 0.80f; colStops[11] = 0x2e / 255f; colStops[12] = 0x30 / 255f; colStops[13] = 0x32 / 255f; colStops[14] = 1.0f; colStops[15] = 1.0f; colStops[16] = 0x16 / 255f; colStops[17] = 0x19 / 255f; colStops[18] = 0x19 / 255f; colStops[19] = 1.0f; } VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y, X, Y + Height }); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 20, colStops); VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VGU.vguRoundRect(mPath, X, Y, Width, Height, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); } #endregion #region draw line { VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); var lineSize = 1.0f; if (State == ButtonState.Released) { VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0x6b / 255f, 0x6c / 255f, 0x6c / 255f, 1.0f }); } else { lineSize = 3.0f; VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, IsLock() ? new[] { 0xd9 / 255f, 0x11 / 255f, 0x07 / 255f, 1.0f } // red : new[] { 0x31 / 255f, 0xa3 / 255f, 0x1f / 255f, 1.0f }); // freen } VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, lineSize); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); VG.vgFinish(); } #endregion base.Update(); // copy render image to cache VG.vgGetPixels(mCache, 0, 0, X - 1, Y - 1, Width + 2, Height + 2); }
public override void Update() { if (Width == 0 || Height == 0) { return; } VG.vgLoadIdentity(); VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); #region draw line { VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); //VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0xe0 / 255f, 0x8f / 255f, 0x1e / 255f, 1.0f }); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0xef / 255f, 0xf0 / 255f, 0xf0 / 255f, 1.0f }); var lineSize = 2.0f; VG.vgSetPaint(mPaint, VGPaintMode.VG_STROKE_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, lineSize); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VGU.vguRoundRect(mPath, X + (lineSize / 2f), Y + (lineSize / 2f), Width - lineSize, Height - lineSize, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_STROKE_PATH); VG.vgFinish(); } #endregion #region fill rect { var colStops = new float[25];// xRGBA VG.vgSetParameteri(mPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_LINEAR_GRADIENT); colStops[0] = 0.0f; colStops[1] = 0xe9 / 255f; colStops[2] = 0xae / 255f; colStops[3] = 0x5d / 255f; colStops[4] = 1.0f; colStops[5] = 0.20f; colStops[6] = 0xe9 / 255f; colStops[7] = 0xae / 255f; colStops[8] = 0x5d / 255f; colStops[9] = 1.0f; colStops[10] = 0.80f; colStops[11] = 0xe0 / 255f; colStops[12] = 0x8f / 255f; colStops[13] = 0x1e / 255f; colStops[14] = 1.0f; colStops[15] = 1.0f; colStops[16] = 0xe0 / 255f; colStops[17] = 0x8f / 255f; colStops[18] = 0x1e / 255f; colStops[19] = 1.0f; VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_LINEAR_GRADIENT, 4, new float[] { X, Y + Height, X, Y }); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR_RAMP_STOPS, 20, colStops); VG.vgSetPaint(mPaint, VGPaintMode.VG_FILL_PATH); VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); var lineSize = 10.0f; VGU.vguRoundRect(mPath, X + Width - mParamWidth - lineSize, Y + (lineSize / 2f), mParamWidth + (lineSize / 2f), Height - lineSize, 5.0f, 5.0f); //VGU.vguRoundRect(mPath, X + Width - mParamWidth - lineSize, Y + (lineSize / 2f), mParamWidth + (lineSize / 2f), Height - lineSize, mRound, mRound); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); } #endregion base.Update(); }
public override void Update() { // render table { VG.vgSeti(VGParamType.VG_BLEND_MODE, (int)VGBlendMode.VG_BLEND_SRC_OVER); VG.vgSeti(VGParamType.VG_FILL_RULE, (int)VGFillRule.VG_NON_ZERO); VG.vgSetfv(VGParamType.VG_STROKE_DASH_PATTERN, 0, null); // create some paths var path0 = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); // create and set a paint for fill var fillPaint = VG.vgCreatePaint(); var strokePaint = VG.vgCreatePaint(); // set model view matrix VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); #region draw border if (Border) { VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 5.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); VG.vgSetParameteri(strokePaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); const float kGreyColor = 192f / 256f; VG.vgSetParameterfv(strokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { kGreyColor, kGreyColor, kGreyColor, 1.0f }); VG.vgSetPaint(strokePaint, VGPaintMode.VG_STROKE_PATH); var tableLenght = 0; for (var i = 0; i < mLenghtX.Length; i++) { tableLenght += mLenghtX[i]; } VGU.vguRect(path0, (mX - 2.5f), (mY - 2.5f), tableLenght + 5, GetLenght(mLenghtY.Length, mLenghtY) + 5.0f); VG.vgDrawPath(path0, VGPaintMode.VG_STROKE_PATH); } #endregion #region fill cells if (CellFill) { for (var i = 0; i < mLenghtX.Length; i++) { for (var j = 0; j < mLenghtY.Length; j++) { VG.vgSetParameteri(fillPaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); VG.vgSetParameterfv(fillPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, CellColors[i, j].Value); VG.vgSetPaint(fillPaint, VGPaintMode.VG_FILL_PATH); VG.vgClearPath(path0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VGU.vguRect(path0, mX + GetLenght(i, mLenghtX), mY + GetLenght(j, mLenghtY), mLenghtX[i], mLenghtY[j]); VG.vgDrawPath(path0, VGPaintMode.VG_FILL_PATH); } } } #endregion #region draw cells borders if (CellBorder) { VG.vgSetParameteri(strokePaint, (int)VGPaintParamType.VG_PAINT_TYPE, (int)VGPaintType.VG_PAINT_TYPE_COLOR); VG.vgSetParameterfv(strokePaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, new[] { 0.0f, 0.0f, 0.0f, 1.0f }); VG.vgSetPaint(strokePaint, VGPaintMode.VG_STROKE_PATH); VG.vgClearPath(path0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VG.vgSetf(VGParamType.VG_STROKE_LINE_WIDTH, 1.0f); VG.vgSeti(VGParamType.VG_STROKE_CAP_STYLE, (int)VGCapStyle.VG_CAP_BUTT); VG.vgSeti(VGParamType.VG_STROKE_JOIN_STYLE, (int)VGJoinStyle.VG_JOIN_BEVEL); for (var i = 0; i < mLenghtX.Length; i++) { for (var j = 0; j < mLenghtY.Length; j++) { VGU.vguRect(path0, mX + GetLenght(i, mLenghtX), mY + GetLenght(j, mLenghtY), mLenghtX[i], mLenghtY[j]); } } VG.vgDrawPath(path0, VGPaintMode.VG_STROKE_PATH); } #endregion VG.vgDestroyPath(path0); VG.vgDestroyPaint(strokePaint); } base.Update(); }
private void Init(int x, int y) { InitBackground(); mPaint = VG.vgCreatePaint(); VG.vgSetParameterfv(mPaint, (int)VGPaintParamType.VG_PAINT_COLOR, 4, (new Color(0xEDAB18ff)).Value); AddVGPath(new VGPath(mPath, new VGSolidColor(new Color(0xD1D3D4FF)), new VGSolidColor(new Color(0x2c2d2eff))) { StrokeWidth = 0.5f }); var divideLines = VGPath.OpenVGPath(); const int kBiasY = 44; VGU.vguLine(divideLines, 0, 3 * kBiasY, Width - 30, 3 * kBiasY); VGU.vguLine(divideLines, 0, 2 * kBiasY, Width - 30, 2 * kBiasY); VGU.vguLine(divideLines, 0, kBiasY, Width - 30, kBiasY); VGU.vguLine(divideLines, 0, 0, Width - 30, 0); var lines = new VGPath(divideLines, new VGSolidColor(new Color(0xD1D3D4FF)), null) { StrokeWidth = 0.5f }; lines.Move(15, kBiasY); AddVGPath(lines); const int kBiasX = 47; const int kBiasX0 = 60; Text.Label(this, "T, ⁰C", 16, kBiasX0, kBiasY * 4, kBiasX, 18); Text.Label(this, "I, A", 16, kBiasX0 + kBiasX, kBiasY * 4, kBiasX, 18); Text.Label(this, "U, B", 16, kBiasX0 + 2 * kBiasX, kBiasY * 4, kBiasX, 18); Text.Label(this, "F, Гц", 16, kBiasX0 + 3 * kBiasX, kBiasY * 4, kBiasX, 18); Text.Label(this, "об/мин", 16, kBiasX0 + 4 * kBiasX, kBiasY * 4, kBiasX, 18); //Text.Label(this, "ПЧН #1\\nПЧН #2\\nПЧН #3\\nПЧН #4", 18, 15, 22, kBiasX0 - 15, kBiasY, Align.Left); mTable = new Table(this); mTableLine = new TableLine(kBiasY / 2); mTableLine.AddColumn(kBiasX0 - 15, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3)); //mTableLine.Text[0].Text = "ПЧН #4"; mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3)); mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3)); mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3)); mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3)); mTableLine.AddColumn(kBiasX, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3)); mTableStatusLine = new TableLine(kBiasY / 2); mTableStatusLine.AddColumn(kBiasX0 - 15, null, Align.Center, 16, new Color(0xD1D3D4FF), new GfxPoint(0, 5)); mTableStatusLine.Text[0].Text = "статус:"; mTableStatusLine.AddColumn(kBiasX * 5, null, Align.Center, 17, Palette.White, new GfxPoint(0, 3)); mTable.AddLine(mTableStatusLine); mTable.AddLine(mTableLine); mTable.AddLine(new TableLine(mTableStatusLine)); mTable.AddLine(new TableLine(mTableLine)); mTable.AddLine(new TableLine(mTableStatusLine)); mTable.AddLine(new TableLine(mTableLine)); mTable.AddLine(new TableLine(mTableStatusLine)); mTable.AddLine(new TableLine(mTableLine)); //mTable.SetBorder(1, Palette.Lime); // for debug mTable.Move(15, 0); mTable.GetCellById(7, 0).Text = "Uz 2"; mTable.GetCellById(5, 0).Text = "Uz 3"; mTable.GetCellById(3, 0).Text = "Uz 4"; mTable.GetCellById(1, 0).Text = "Uz 5"; #region temperature mReciever.GetSignal("uz.2.temperature").OnUpdate += sensor => mTable.GetCellById(7, 1).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.3.temperature").OnUpdate += sensor => { mTable.GetCellById(5, 1).Text = string.Format("{0}", sensor.Value); }; mReciever.GetSignal("uz.4.temperature").OnUpdate += sensor => mTable.GetCellById(3, 1).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.5.temperature").OnUpdate += sensor => mTable.GetCellById(1, 1).Text = string.Format("{0}", sensor.Value); mTable.GetCellById(7, 1).Text = "-"; mTable.GetCellById(5, 1).Text = "-"; mTable.GetCellById(3, 1).Text = "-"; mTable.GetCellById(1, 1).Text = "-"; #endregion #region current mReciever.GetSignal("uz.2.current").OnUpdate += sensor => mTable.GetCellById(7, 2).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.3.current").OnUpdate += sensor => mTable.GetCellById(5, 2).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.4.current").OnUpdate += sensor => mTable.GetCellById(3, 2).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.5.current").OnUpdate += sensor => mTable.GetCellById(1, 2).Text = string.Format("{0}", sensor.Value); mTable.GetCellById(7, 2).Text = "-"; mTable.GetCellById(5, 2).Text = "-"; mTable.GetCellById(3, 2).Text = "-"; mTable.GetCellById(1, 2).Text = "-"; #endregion #region voltage mReciever.GetSignal("uz.2.voltage").OnUpdate += sensor => mTable.GetCellById(7, 3).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.3.voltage").OnUpdate += sensor => mTable.GetCellById(5, 3).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.4.voltage").OnUpdate += sensor => mTable.GetCellById(3, 3).Text = string.Format("{0}", sensor.Value); mReciever.GetSignal("uz.5.voltage").OnUpdate += sensor => mTable.GetCellById(1, 3).Text = string.Format("{0}", sensor.Value); mTable.GetCellById(7, 3).Text = "-"; mTable.GetCellById(5, 3).Text = "-"; mTable.GetCellById(3, 3).Text = "-"; mTable.GetCellById(1, 3).Text = "-"; #endregion // TODO: привязать к реальным значениям #region freq mReciever.GetSignal("uz.2.frequency").OnUpdate += sensor => mTable.GetCellById(7, 4).Text = string.Format("{0:F2}", sensor.Value / 100); mReciever.GetSignal("uz.3.frequency").OnUpdate += sensor => mTable.GetCellById(5, 4).Text = string.Format("{0:F2}", sensor.Value / 100); mReciever.GetSignal("uz.4.frequency").OnUpdate += sensor => mTable.GetCellById(3, 4).Text = string.Format("{0:F2}", sensor.Value / 100); mReciever.GetSignal("uz.5.frequency").OnUpdate += sensor => mTable.GetCellById(1, 4).Text = string.Format("{0:F2}", sensor.Value / 100); mTable.GetCellById(7, 4).Text = "-"; mTable.GetCellById(5, 4).Text = "-"; mTable.GetCellById(3, 4).Text = "-"; mTable.GetCellById(1, 4).Text = "-"; #endregion #region rpm - энкодера нет физически //mReciever.GetSignal("uz.2.speed").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("{0}", sensor.Value); //mReciever.GetSignal("uz.3.speed").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("{0}", sensor.Value); //mReciever.GetSignal("uz.4.speed").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("{0}", sensor.Value); //mReciever.GetSignal("uz.5.speed").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("{0}", sensor.Value); mTable.GetCellById(7, 5).Text = "-"; mTable.GetCellById(5, 5).Text = "-"; mTable.GetCellById(3, 5).Text = "-"; mTable.GetCellById(1, 5).Text = "-"; #endregion // TODO: по значению #region status /* * mReciever.GetSignal("uz.2.error").OnUpdate += sensor => mTable.GetCellById(7, 5).Text = string.Format("0x{0:X4}", sensor.Value); * mReciever.GetSignal("uz.3.error").OnUpdate += sensor => mTable.GetCellById(5, 5).Text = string.Format("0x{0:X4}", sensor.Value); * mReciever.GetSignal("uz.4.error").OnUpdate += sensor => mTable.GetCellById(3, 5).Text = string.Format("0x{0:X4}", sensor.Value); * mReciever.GetSignal("uz.5.error").OnUpdate += sensor => mTable.GetCellById(1, 5).Text = string.Format("0x{0:X4}", sensor.Value); */ mReciever.GetSignal("uz.2.error").OnUpdate += sensor => { mTable.GetCellById(6, 1).SetFont(sensor.Value > 0 ? Palette.Red : Palette.White); mTable.GetCellById(6, 1).Text = string.Format("{0}", sensor.Value); }; mReciever.GetSignal("uz.3.error").OnUpdate += sensor => { mTable.GetCellById(4, 1).SetFont(sensor.Value > 0 ? Palette.Red : Palette.White); mTable.GetCellById(4, 1).Text = string.Format("{0}", sensor.Value); }; mReciever.GetSignal("uz.4.error").OnUpdate += sensor => { mTable.GetCellById(2, 1).SetFont(sensor.Value > 0 ? Palette.Red : Palette.White); mTable.GetCellById(2, 1).Text = string.Format("{0}", sensor.Value); }; mReciever.GetSignal("uz.5.error").OnUpdate += sensor => { mTable.GetCellById(0, 1).SetFont(sensor.Value > 0 ? Palette.Red : Palette.White); mTable.GetCellById(0, 1).Text = string.Format("{0}", sensor.Value); }; mTable.GetCellById(6, 1).Text = "6:1"; mTable.GetCellById(4, 1).Text = "4:1"; mTable.GetCellById(2, 1).Text = "2:1"; mTable.GetCellById(0, 1).Text = "0:1"; #endregion //mReciever.GetSignal("").OnUpdate += sensor => mTable.GetCellById(0, 0).Text = string.Format("{0}", sensor.Value); Move(x, y); }