public ProgressBar(IWidget parent, int x, int y, int width, int height, int round) : base(parent, x, y, width, height) { mRound = round; mPath = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VGU.vguRoundRect(mPath, 0, 0, Width, Height, mRound, mRound); mPaint = VG.vgCreatePaint(); Status = new TextArea(this, 0, 0, Width, Height); Status.SetAlign(Align.Center, new GfxPoint(0, 3)); Status.OnTextChange += caller => Invalidate(); Border = new VGSolidColor(Palette.White); Background = new VGSolidColor(Palette.Black); var percent = new VGLinearGradient(0, 0, 0, Height); percent.AddColor(0, new Color(0xE9AE5DFF)); //percent.AddColor(50, new Color(0xE08F1EFF)); percent.AddColor(100, new Color(0xE08F1EFF)); //percent.AddColor(0, new Color(0x00FF00FF)); //percent.AddColor(100, new Color(0xFF0000FF)); PercentLine = percent; }
public override void Draw() { { VG.vgSeti(VGParamType.VG_MATRIX_MODE, (int)VGMatrixMode.VG_MATRIX_PATH_USER_TO_SURFACE); VG.vgLoadIdentity(); for (var i = 0; i < mCount; i++) { VG.vgClearPath(mPath, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); if (i == (mSpeed - 1)) { VG.vgSetPaint(mActivePaint, VGPaintMode.VG_FILL_PATH); mText[i][0].SetFont(Palette.Black); } else { VG.vgSetPaint(mDefaultPaint, VGPaintMode.VG_FILL_PATH); mText[i][0].SetFont(Palette.White); } VGU.vguRoundRect(mPath, X, Y + i * (Width + 5), Width, Width, 5, 5); VG.vgDrawPath(mPath, VGPaintMode.VG_FILL_PATH); VG.vgFinish(); } } //base.Update(); }
Button EngButton(IWidget parent, string name, int x, int y) { const int kHeight = 35; const float kRound = 5f; var contour = VGPath.OpenVGPath(); // 33x35 VGU.vguRoundRect(contour, 0, 0, 33, kHeight, kRound, kRound); var normal = new VGPath(contour, null, new VGSolidColor(Palette.LightGrey)); var active = new VGPath(contour, null, new VGSolidColor(Palette.DarkGray)); var btn = new Button(parent, active, normal);//, "eng");//, x, y, width, kHeight, kRound); var label = new TextArea(btn, 0, 0, btn.Width, btn.Height) { Text = name }; label.SetAlign(Align.Center, new GfxPoint(0, 5)); label.SetFont(22); btn.Move(x, y); btn.OnRelease = caller => { Text += Text.Length == 0 ? label.Text : label.Text.ToLower(); mTextArea.Text = Text; }; btn.Hide(); mEngLayout.Add(btn); return(btn); }
private static void InitModal() { if (mModalInitialized) { return; } const int kWidth = 90; const int kHeight = 35; const int kRound = 10; mModalOutline = VGPath.OpenVGPath(); VGU.vguRoundRect(mModalOutline, 0, 0, kWidth, kHeight, kRound, kRound); mModalStrokeVGPaint = new VGSolidColor(Palette.LightGrey); #region default color mModalNormalVGPaintDefault = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight); mModalActiveVGPaintDefault = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight); #endregion #region red color mModalNormalVGPaintRed = SetPaint(new Color(0x640000FF), Palette.Red, kHeight); mModalActiveVGPaintRed = SetPaint(Palette.Red, new Color(0x640000FF), kHeight); #endregion #region green color mModalNormalVGPaintGreen = SetPaint(new Color(0x006400FF), Palette.Lime, kHeight); mModalActiveVGPaintGreen = SetPaint(Palette.Lime, new Color(0x006400FF), kHeight); #endregion mModalInitialized = true; }
public static TableLine InputArea(IWidget parent, string label, int x, int y, int width = 440, int height = 30) { var rv = new TableLine(parent, height); rv.AddColumn(width, null, Align.Left, 20, Palette.Black, new GfxPoint(5, 5)); var outline = VGPath.OpenVGPath(); VGU.vguRoundRect(outline, 0, 0, width, height, 5, 5); rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background))); rv.Move(x, y); var hitLabel = new TextArea(rv, 0, 0, rv.Width, rv.Height); hitLabel.SetAlign(Align.Left, new GfxPoint(5, 5)); hitLabel.SetFont(Palette.DarkSlateGray, 20); hitLabel.Text = label; rv.OnPaint += caller => { if (string.IsNullOrEmpty(rv.Text[0].Text)) { hitLabel.Show(); } else { hitLabel.Hide(); } }; return(rv); }
public VideoPlayer(IWindow parent, string text, int port, int x, int y, int width, int height) : base(parent, x, Application.Screen.Height - y - height, width, height) { var label = new TextArea(this, 0, height / 2 - 20, width, 40) { Text = text }; label.SetFont(Palette.White, 35); label.SetAlign(Align.Center, new GfxPoint(0, 5)); mPath = new VGPath(null, new VGSolidColor(new Color(0x2c2d2eff))); //VGU.vguRect(mPath.GetPath(), 0, 0, width, height); VGU.vguRoundRect(mPath.GetPath(), 0, 0, width - 12, height - 12, 10, 10); mPath.Move(6, 7); mArgs = string.Format("tcpclientsrc host=127.0.0.1 port={0} ! multipartdemux boundary=\"boundary\" ! vpudec ! mfw_isink axis-left={1} axis-top={2} disp-width={3} disp-height={4}", port, x, y, width, height); Environment.SetEnvironmentVariable("VSALPHA", "1"); mThread = new Thread(Processing); mThread.Start(); }
protected internal TestWidget(IWidget parent) : base(parent, 0, 0, 150, 150) { //Text.Label(this, "Hello", 50, 10, 20, Width, 50, Align.Center, Palette.DarkSlateGray); //mPath = new VGPath(null, new VGSolidColor(Palette.Orange)); mPath = new VGPath(null, new VGSolidColor(new Color(0xFFA5003F))); mPath.Move(30, 30); VGU.vguRoundRect(mPath.GetPath(), 0, 0, 100, 100, 35, 35); }
private void InitBackground() { if (mInitialized) { return; } const int kRound = 10; mPath = VGPath.OpenVGPath(); VGU.vguRoundRect(mPath, 0, 0, Width, Height, kRound, kRound); mInitialized = true; }
public override ModalWindow AddModal(string name) { var modal = base.AddModal("modal-" + name); var modalOutline = VGPath.OpenVGPath(); VGU.vguRoundRect(modalOutline, 0, 0, 400, 230, 20, 20); var fill = new VGLinearGradient(0, 0, 0, 230); fill.AddColor(0, Palette.DarkGray); fill.AddColor(25, Palette.LightGrey); fill.AddColor(100, Palette.LightGrey); var outline = new VGPath(modalOutline, new VGSolidColor(Palette.DarkSlateGray), fill) { StrokeWidth = 2.0f }; outline.Move(40, 25); modal.AddVGPath(outline); var textOutline = VGPath.OpenVGPath(); VGU.vguRect(textOutline, 0, 0, 360, 160); var text = new VGPath(textOutline, new VGSolidColor(Palette.DarkSlateGray), new VGSolidColor(Palette.White)) { StrokeWidth = 2.0f }; text.Move(60, 85); modal.AddVGPath(text); switch (name) { case "yesno": ConfigureModalYesNo(modal); break; case "ok": ConfigureModalOk(modal); break; } return(modal); }
public static TableLine DateTime(IWidget parent, int x, int y) { const int kHeight = 40; var rv = new TableLine(parent, kHeight); rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // hour rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // : rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // minute rv.AddColumn(0, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // : rv.AddColumn(0, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // seconds rv.AddColumn(20, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // " - " rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // day rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // "/" rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // month rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // "/" rv.AddColumn(80, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // year //rv.AddColumn(30, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // seconds var outline = VGPath.OpenVGPath(); VGU.vguRoundRect(outline, 0, 0, rv.Width, kHeight, 5, 5); rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background))); rv.Move(x, y); { rv.Text[0].Text = "09"; rv.Text[1].Text = ":"; rv.Text[2].Text = "00"; rv.Text[3].Text = ":"; rv.Text[4].Text = "00"; rv.Text[5].Text = " - "; rv.Text[6].Text = "01"; rv.Text[7].Text = "/"; rv.Text[8].Text = "03"; rv.Text[9].Text = "/"; rv.Text[10].Text = "2014"; //rv.Text[0].Text = ":"; //rv.Text[0].Text = "14"; } return(rv); }
private void InitBackground() { if (mInitialized) { return; } const int kRound = 10; mPath = VGPath.OpenVGPath(); VGU.vguRoundRect(mPath, 0, 0, Width, Height, kRound, kRound); mLinear = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_F, 1.0f, 0.0f, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); mInitialized = true; }
Button GenericButton(IWidget parent, int x, int y, int width, string text, Color color) { const int kHeight = 35; const float kRound = 5f; var contour = VGPath.OpenVGPath(); VGU.vguRoundRect(contour, 0, 0, width, kHeight, kRound, kRound); var normal = new VGPath(contour, null, new VGSolidColor(color ?? Palette.LightGrey)); var activeColor = Palette.DarkGray; if (color == Palette.Red) { activeColor = Palette.Orange; } //activeColor = new Color(0x640000FF); if (color == Palette.Lime) { activeColor = Palette.Orange; } //activeColor = new Color(0x006400FF); var active = new VGPath(contour, null, new VGSolidColor(activeColor)); var btn = new Button(parent, active, normal);//, "generic");//, x, y, width, kHeight, kRound); var label = new TextArea(btn, 0, 0, btn.Width, btn.Height) { Text = text }; label.SetAlign(Align.Center, new GfxPoint(0, 10)); label.SetFont(22); btn.Move(x, y); btn.Show(); return(btn); }
private static void InitDown() { if (mDownInitialized) { return; } const int kWidth = 62; const int kHeight = 34; const int kRound = 10; mDownOutline = VGPath.OpenVGPath(); VGU.vguRoundRect(mDownOutline, 0, 0, kWidth, kHeight, kRound, kRound); #region default color mClassicActiveVGPaintDefault = SetPaint(Palette.Black, new Color(0x58595BFF), kHeight); #endregion mDownInitialized = true; }
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 static void InitGiant() { if (mGiantInitialized) { return; } const int kWidth = 230; const int kHeight = 90; const int kRound = 25; mGiantOutline = VGPath.OpenVGPath(); VGU.vguRoundRect(mGiantOutline, 0, 0, kWidth, kHeight, kRound, kRound); mGiantStrokeVGPaint = new VGSolidColor(Palette.LightGrey); //mGiantNormalVGPaint = SetPaint(Palette.LightBlue, Palette.LightGrey, kHeight); mGiantNormalVGPaint = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight); mGiantActiveVGPaint = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight); mGiantInitialized = true; }
private static void InitClassic() { if (mClassicInitialized) { return; } const int kWidth = 120; const int kHeight = 50; const int kRound = 15; mClassicOutline = VGPath.OpenVGPath(); VGU.vguRoundRect(mClassicOutline, 0, 0, kWidth, kHeight, kRound, kRound); mClassicStrokeVGPaint = new VGSolidColor(Palette.LightGrey); #region default color //mClassicNormalVGPaintDefault = SetPaint(Palette.LightBlue, Palette.LightGrey, kHeight); mClassicNormalVGPaintDefault = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight); mClassicActiveVGPaintDefault = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight); #endregion #region red color //mClassicNormalVGPaintRed = SetPaint(Palette.LightBlue, Palette.Red, kHeight); mClassicNormalVGPaintRed = SetPaint(new Color(0x640000FF), Palette.Red, kHeight); mClassicActiveVGPaintRed = SetPaint(Palette.Red, new Color(0x640000FF), kHeight); #endregion #region green color //mClassicNormalVGPaintGreen = SetPaint(Palette.LightBlue, Palette.Lime, kHeight); //mClassicNormalVGPaintGreen = SetPaint(new Color(0x004623FF), Palette.Lime, kHeight); mClassicNormalVGPaintGreen = SetPaint(new Color(0x006400FF), Palette.Lime, kHeight); mClassicActiveVGPaintGreen = SetPaint(Palette.Lime, new Color(0x006400FF), kHeight); #endregion mClassicInitialized = true; }
public static TableLine DateTime(IWidget parent, int x, int y) { const int kHeight = 30; var rv = new TableLine(parent, kHeight); rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // hour rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // : rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // minute rv.AddColumn(0, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // : rv.AddColumn(0, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // seconds rv.AddColumn(15, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // " - " rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // day rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // "/" rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // month rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // "/" rv.AddColumn(55, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // year //rv.AddColumn(30, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // seconds var outline = VGPath.OpenVGPath(); VGU.vguRoundRect(outline, 0, 0, rv.Width, kHeight, 5, 5); rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background))); rv.Move(x, y); foreach (var label in rv.Text) { label.SetFont(Palette.Black, 25); label.SetAlign(Align.Center); } //rv.OnShow += caller => { rv.Text[0].Text = "09"; rv.Text[1].Text = ":"; rv.Text[2].Text = "00"; rv.Text[3].Text = ":"; rv.Text[4].Text = "00"; rv.Text[5].Text = " - "; rv.Text[6].Text = "01"; rv.Text[7].Text = "/"; rv.Text[8].Text = "03"; rv.Text[9].Text = "/"; rv.Text[10].Text = "2014"; //rv.Text[0].Text = ":"; //rv.Text[0].Text = "14"; } rv.OnPress += caller => { var cell = caller as TextArea; if (cell != null) { cell.SetFont(Palette.Red); } }; return(rv); }
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() { 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(); }
private void AddChilds() { #region generic var window = this; mTextArea = new TextArea(window, 20, 207, 435, 25) { Text = "" }; //, Size = 18, Background = true}; mTextArea.SetFont(Palette.Black, 24); mTextArea.SetAlign(Align.Left, new GfxPoint(0, 5)); var outline = VGPath.OpenVGPath(); VGU.vguRoundRect(outline, 0, 0, mTextArea.Width + 6, mTextArea.Height + 6, 5, 5); var vgOutline = new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.White)); vgOutline.Move(mTextArea.X - 3, mTextArea.Y - 3); window.AddVGPath(vgOutline); GenericButton(window, 15, 15, 80, "cancel", Palette.Red).OnRelease = caller => { if (ReturnWindow == null) { return; } mTextArea.Text = ""; Text = ""; mBlink.Stop(); mApplication.SetFocusedWindow(ReturnWindow); }; GenericButton(window, 385, 15, 80, "enter", Palette.Lime).OnRelease = caller => { if (ReturnWindow == null) { return; } if (OnEnter != null) { OnEnter(Text); } mTextArea.Text = ""; Text = ""; mBlink.Stop(); mApplication.SetFocusedWindow(ReturnWindow); }; GenericButton(window, 110, 15, 260, "", null).OnRelease = caller => { Text = (Text + " "); mTextArea.Text = Text; }; #endregion #region symbols var xPos = 110; var xPosStep = 52; var yPos = 150; #region first row { var btnRus = NumericButton(window, "rus", 20, yPos); btnRus.OnRelease = caller => ActivateLayout(mRusLayout); NumericButton(window, "0", xPos, yPos); xPos += xPosStep; NumericButton(window, "1", xPos, yPos); xPos += xPosStep; NumericButton(window, "2", xPos, yPos); xPos += xPosStep; NumericButton(window, "3", xPos, yPos); xPos += xPosStep; NumericButton(window, "4", xPos, yPos); xPos = 415; var btnDel = NumericButton(window, "del", xPos, yPos); btnDel.OnRelease = caller => { Text = RemoveLastSymbol(Text); mTextArea.Text = Text; }; } #endregion #region second row xPos = 110; yPos = 107; { var btnEng = NumericButton(window, "eng", 20, yPos); //btnEng.PressColor = Utils.ColorPalette.Blue; btnEng.OnRelease = caller => ActivateLayout(mEngLayout); NumericButton(window, "5", xPos, yPos); xPos += xPosStep; NumericButton(window, "6", xPos, yPos); xPos += xPosStep; NumericButton(window, "7", xPos, yPos); xPos += xPosStep; NumericButton(window, "8", xPos, yPos); xPos += xPosStep; NumericButton(window, "9", xPos, yPos); } #endregion #region third row xPos = 110; yPos = 65; { NumericButton(window, ".", xPos, yPos); xPos += xPosStep; NumericButton(window, ",", xPos, yPos); xPos += xPosStep; NumericButton(window, "_", xPos, yPos); xPos += xPosStep; NumericButton(window, "#", xPos, yPos); xPos += xPosStep; NumericButton(window, ":", xPos, yPos); } #endregion #endregion #region russian xPos = 10; xPosStep = 39; yPos = 150; #region first row { RusButton(window, "É", xPos, yPos); xPos += xPosStep; RusButton(window, "Ö", xPos, yPos); xPos += xPosStep; RusButton(window, "Ó", xPos, yPos); xPos += xPosStep; RusButton(window, "Ê", xPos, yPos); xPos += xPosStep; RusButton(window, "Å", xPos, yPos); xPos += xPosStep; RusButton(window, "Í", xPos, yPos); xPos += xPosStep; RusButton(window, "Ã", xPos, yPos); xPos += xPosStep; RusButton(window, "Ø", xPos, yPos); xPos += xPosStep; RusButton(window, "Ù", xPos, yPos); xPos += xPosStep; RusButton(window, "Ç", xPos, yPos); xPos += xPosStep; RusButton(window, "Õ", xPos, yPos); xPos += xPosStep; RusButton(window, "Ú", xPos, yPos); } #endregion #region second row xPos = 10; yPos = 107; { var btn123 = RusButton(window, "123", xPos, yPos); //btn123.PressColor = Utils.ColorPalette.Blue; btn123.OnRelease = caller => ActivateLayout(mSymbolLayout); xPos += xPosStep; RusButton(window, "Ô", xPos, yPos); xPos += xPosStep; RusButton(window, "Û", xPos, yPos); xPos += xPosStep; RusButton(window, "Â", xPos, yPos); xPos += xPosStep; RusButton(window, "À", xPos, yPos); xPos += xPosStep; RusButton(window, "Ï", xPos, yPos); xPos += xPosStep; RusButton(window, "Ð", xPos, yPos); xPos += xPosStep; RusButton(window, "Î", xPos, yPos); xPos += xPosStep; RusButton(window, "Ë", xPos, yPos); xPos += xPosStep; RusButton(window, "Ä", xPos, yPos); xPos += xPosStep; RusButton(window, "Æ", xPos, yPos); xPos += xPosStep; RusButton(window, "Ý", xPos, yPos); } #endregion #region third row xPos = 10; yPos = 65; { var btnEng = RusButton(window, "eng", xPos, yPos); //btnEng.PressColor = Utils.ColorPalette.Blue; btnEng.OnRelease = caller => ActivateLayout(mEngLayout); xPos += xPosStep; RusButton(window, "ß", xPos, yPos); xPos += xPosStep; RusButton(window, "×", xPos, yPos); xPos += xPosStep; RusButton(window, "Ñ", xPos, yPos); xPos += xPosStep; RusButton(window, "Ì", xPos, yPos); xPos += xPosStep; RusButton(window, "È", xPos, yPos); xPos += xPosStep; RusButton(window, "Ò", xPos, yPos); xPos += xPosStep; RusButton(window, "Ü", xPos, yPos); xPos += xPosStep; RusButton(window, "Á", xPos, yPos); xPos += xPosStep; RusButton(window, "Þ", xPos, yPos); xPos += xPosStep; xPos += xPosStep; var btnDel = RusButton(window, "del", xPos, yPos); btnDel.OnRelease = caller => { Text = RemoveLastSymbol(Text); mTextArea.Text = Text; }; } #endregion #endregion #region english xPos = 10; xPosStep = 39; yPos = 150; #region first row { EngButton(window, "Q", xPos, yPos); xPos += xPosStep; EngButton(window, "W", xPos, yPos); xPos += xPosStep; EngButton(window, "E", xPos, yPos); xPos += xPosStep; EngButton(window, "R", xPos, yPos); xPos += xPosStep; EngButton(window, "T", xPos, yPos); xPos += xPosStep; EngButton(window, "Y", xPos, yPos); xPos += xPosStep; EngButton(window, "U", xPos, yPos); xPos += xPosStep; EngButton(window, "I", xPos, yPos); xPos += xPosStep; EngButton(window, "O", xPos, yPos); xPos += xPosStep; EngButton(window, "P", xPos, yPos); xPos += xPosStep; EngButton(window, "{", xPos, yPos); xPos += xPosStep; EngButton(window, "}", xPos, yPos); } #endregion #region second row xPos = 10; yPos = 107; { var btn123 = EngButton(window, "123", xPos, yPos); //btn123.PressColor = Utils.ColorPalette.Blue; btn123.OnRelease = caller => ActivateLayout(mSymbolLayout); xPos += xPosStep; EngButton(window, "A", xPos, yPos); xPos += xPosStep; EngButton(window, "S", xPos, yPos); xPos += xPosStep; EngButton(window, "D", xPos, yPos); xPos += xPosStep; EngButton(window, "F", xPos, yPos); xPos += xPosStep; EngButton(window, "G", xPos, yPos); xPos += xPosStep; EngButton(window, "H", xPos, yPos); xPos += xPosStep; EngButton(window, "J", xPos, yPos); xPos += xPosStep; EngButton(window, "K", xPos, yPos); xPos += xPosStep; EngButton(window, "L", xPos, yPos); xPos += xPosStep; EngButton(window, ";", xPos, yPos); xPos += xPosStep; EngButton(window, "\"", xPos, yPos); } #endregion #region third row xPos = 10; yPos = 65; { var btnRus = EngButton(window, "rus", xPos, yPos); //btnRus.PressColor = Utils.ColorPalette.Blue; btnRus.OnRelease = caller => ActivateLayout(mRusLayout); xPos += xPosStep; EngButton(window, "Z", xPos, yPos); xPos += xPosStep; EngButton(window, "X", xPos, yPos); xPos += xPosStep; EngButton(window, "C", xPos, yPos); xPos += xPosStep; EngButton(window, "V", xPos, yPos); xPos += xPosStep; EngButton(window, "B", xPos, yPos); xPos += xPosStep; EngButton(window, "N", xPos, yPos); xPos += xPosStep; EngButton(window, "M", xPos, yPos); xPos += xPosStep; EngButton(window, "<", xPos, yPos); xPos += xPosStep; EngButton(window, ">", xPos, yPos); xPos += xPosStep; xPos += xPosStep; var btnDel = EngButton(window, "del", xPos, yPos); btnDel.OnRelease = caller => { Text = RemoveLastSymbol(Text); mTextArea.Text = Text; }; } #endregion #endregion }
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 static Window ShowWindow() { var window = new Window("show", kWidth, kHeight) { Description = "Шеф-повар \"Сибовар\"" }; var line = new TableLine(25); line.AddColumn(80); line.AddColumn(80); line.AddColumn(70); line.Text[0].Text = "HgjloGreen"; line.Text[0].SetFont(Palette.Lime, 20); line.Text[0].SetAlign(Align.Left, new GfxPoint(0, 3)); line.Text[1].Text = "HelloRed"; line.Text[1].SetFont(Palette.Red, 15); line.Text[1].SetAlign(Align.Center); line.Text[2].Text = "HgelloBlue"; line.Text[2].SetFont(Palette.PaleTurquoise, 30); line.Text[2].SetAlign(Align.Left, new GfxPoint(0, 4)); line.Name = "line"; var table = new Table(window) { Name = "table" }; table.Move(10, 50); table.AddLine(new TableLine(line)); table.AddLine(new TableLine(line)); table.AddLine(new TableLine(line)); table.SetBackground(Palette.Red, Palette.White); table.SetBorder(1, Palette.Lime); table.OnPress += caller => { var rv = table.GetLineByCell(caller); if (rv == null) { return; } table.ActiveLine = rv; window.Description = rv.Name; }; var text = new TextArea(window, 10, 180, 325, 50); text.SetFont("i260c", Palette.PaleTurquoise, 50); text.Text = "0123456789:"; text.OnPress += caller => window.Description = "Text.Pressed"; var bar = new ProgressBar(window, 40, 30, 200, 15, 15) { Percent = 10, Status = { Text = "hello" } }; bar.Status.SetAlign(Align.Center, new GfxPoint(3, 3)); bar.Status.SetFont(Palette.White, 14); bar.Rotate(70); text.OnRelease += caller => { window.Description = "Text.Released"; //mApplication.SetFocusedWindow("1"); line.Move(line.X - 3, line.Y - 3); table.ActiveLine = null; bar.Percent -= 1; }; window.OnPaint += delegate { Debug.Print(DateTime.Now.ToString("HH:mm:ss") + ":\tHome update"); }; var activePath = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VGU.vguRoundRect(activePath, 0, 0, 60, 100, 20, 20); var normalPath = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL); VGU.vguRoundRect(normalPath, 0, 0, 100, 50, 20, 20); VGU.vguRoundRect(normalPath, 10, 50, 80, 70, 20, 20); var activeButton = new VGSolidColor(new Color(0xFF0000FF)); //var normalButton = new VGSolidColor(new Color(0x00FF00FF)); var normalButton = new VGLinearGradient(0, 0, 100, 120); normalButton.AddColor(0, new Color(0xFF0000FF)); normalButton.AddColor(100, new Color(0x00FF00FF)); var button = new Button(window, new VGPath(activePath, null, activeButton), new VGPath(normalPath, null, normalButton)); button.IsCached = true; button.Move(250, 50); button.OnPress += delegate { Console.WriteLine("button.OnPress"); }; var image = new Image(window, 25, 10); image.Load("splash.raw"); image.Scale(0.5f, 0.5f); image.RotateCenter = new GfxPoint(image.Width / 2, image.Height / 2); //image.Hide(); window.OnPaint += caller => { image.Rotate(mImageRotate); mImageRotate += 5; }; var graphicArea = new GraphicArea(window, 200, 200); graphicArea.Move(70, 20); graphicArea.Background = new Color(0xF0F0F0FF); graphicArea.Grid = new VGPath(activePath, activeButton, null); graphicArea.Arrows = new VGPath(normalPath, new VGSolidColor(Palette.PaleTurquoise), null); var graphicData1 = new GraphicsData { Data = new byte[] { 0, 15, 25, 50, 40, 35, 12, 10, 15, 17, 30, 32, 35, 35, 35, 35, 35, 40, 45, 57, 25, 23, 20, 18, 12, 12, 12, 30, 32, 35, 35, 35, 35, 35, 40, 45 } }; var graphicData2 = new GraphicsData(graphicData1) { Color = Palette.Lime, Position = new GfxPoint(10, 10) }; graphicArea.AddGrapic(graphicData1); graphicArea.AddGrapic(graphicData2); return(window); }
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() { 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); }