public override void OnDraw(Graphics2D graphics2D) { base.OnDraw(graphics2D); RectangleDouble border = LocalBounds; border.Deflate(new BorderDouble(1)); graphics2D.Rectangle(border, ActiveTheme.Instance.SecondaryBackgroundColor, 4); }
public override void OnDraw(Graphics2D graphics2D) { graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Black); RoundedRect boundsRect = new RoundedRect(dragBar.BoundsRelativeToParent, 0); graphics2D.Render(boundsRect, DragBarColor); base.OnDraw(graphics2D); }
public override void OnDraw(Graphics2D graphics2D) { base.OnDraw(graphics2D); if (Focused) { graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Orange); } }
public override void OnDraw(Graphics2D graphics2D) { SetNoContentFieldDescriptionVisibility(); base.OnDraw(graphics2D); if (ContainsFocus) { graphics2D.Rectangle(LocalBounds, RGBA_Bytes.Orange); } }
public FloodFillDemo() { BackgroundColor = RGBA_Bytes.White; imageToFillOn = new ImageBuffer(400, 300, 32, new BlenderBGRA()); Graphics2D imageToFillGraphics = imageToFillOn.NewGraphics2D(); imageToFillGraphics.Clear(RGBA_Bytes.White); imageToFillGraphics.DrawString("Click to fill", 20, 30); imageToFillGraphics.Circle(new Vector2(200, 150), 35, RGBA_Bytes.Black); imageToFillGraphics.Circle(new Vector2(200, 150), 30, RGBA_Bytes.Green); imageToFillGraphics.Rectangle(20, 50, 210, 280, RGBA_Bytes.Black); imageToFillGraphics.Rectangle(imageToFillOn.GetBounds(), RGBA_Bytes.Blue); Random rand = new Random(); for (int i = 0; i < 20; i++) { Ellipse elipse = new Ellipse(rand.Next(imageToFillOn.Width), rand.Next(imageToFillOn.Height), rand.Next(10, 60), rand.Next(10, 60)); Stroke outline = new Stroke(elipse); imageToFillGraphics.Render(outline, RGBA_Bytes.Black); } m_slider1 = new Slider(new Vector2(80, 10), 510); m_slider2 = new Slider(new Vector2(80, 10 + 20), 510); m_slider1.ValueChanged += new EventHandler(NeedsRedraw); m_slider2.ValueChanged += new EventHandler(NeedsRedraw); AddChild(m_slider1); AddChild(m_slider2); m_slider1.Text = "Pixel size={0:F3}"; m_slider1.SetRange(8, 100); m_slider1.NumTicks = 23; m_slider1.Value = 32; m_slider2.Text = "gamma={0:F3}"; m_slider2.SetRange(0.0, 3.0); m_slider2.Value = 1.0; }
public override void OnDraw(Graphics2D graphics2D) { if (borderColor.Alpha0To255 > 0) { RectangleDouble borderRectangle = LocalBounds; if (borderWidth > 0) { if (borderWidth == 1) { graphics2D.Rectangle(borderRectangle, borderColor); } else { //boarderRectangle.Inflate(-borderWidth / 2); RoundedRect rectBorder = new RoundedRect(borderRectangle, this.borderRadius); graphics2D.Render(new Stroke(rectBorder, borderWidth), borderColor); } } } if (this.fillColor.Alpha0To255 > 0) { RectangleDouble insideBounds = LocalBounds; insideBounds.Inflate(-this.borderWidth); RoundedRect rectInside = new RoundedRect(insideBounds, Math.Max(this.borderRadius - this.borderWidth, 0)); graphics2D.Render(rectInside, this.fillColor); } base.OnDraw(graphics2D); }
public override void OnDraw(Graphics2D graphics2D) { RectangleDouble borderRectangle = LocalBounds; if (BorderWidth > 0) { if (BorderWidth == 1) { graphics2D.Rectangle(borderRectangle, BorderColor); } else { RoundedRect rectBorder = new RoundedRect(borderRectangle, 0); graphics2D.Render(new Stroke(rectBorder, BorderWidth), BorderColor); } } base.OnDraw(graphics2D); }
public override void OnDraw(Graphics2D graphics2D) { RectangleDouble barBounds = bar.BoundsRelativeToParent; graphics2D.FillRectangle(barBounds.Left, barBounds.Bottom, barBounds.Left + barBounds.Width * PercentComplete / 100.0, barBounds.Top, ActiveTheme.Instance.PrimaryAccentColor); graphics2D.Rectangle(barBounds, RGBA_Bytes.Black); base.OnDraw(graphics2D); }
public static void Main(string[] args) { // first we will show how to use the simple drawing functions in graphics 2D { ImageBuffer simpleImage = new ImageBuffer(640, 480, 32, new BlenderBGRA()); Graphics2D simpleImageGraphics2D = simpleImage.NewGraphics2D(); // clear the image to white simpleImageGraphics2D.Clear(Color.White); // draw a circle simpleImageGraphics2D.Circle(50, 50, 30, Color.Blue); // draw a line simpleImageGraphics2D.Line(10, 100, 520, 50, new Color(20, 200, 200)); // draw a filled box simpleImageGraphics2D.FillRectangle(60, 260, 200, 280, Color.Yellow); // and an outline around it simpleImageGraphics2D.Rectangle(60, 260, 200, 280, Color.Magenta); // draw some text simpleImageGraphics2D.DrawString("A Simple Example", 300, 400, 20); // and save this image out ImageTgaIO.Save(simpleImage, "SimpleDrawAndSave.tga"); } // now we will we will show how to use the render function to draw more complex things { ImageBuffer lessSimpleImage = new ImageBuffer(640, 480, 32, new BlenderBGRA()); Graphics2D lessSimpleImageGraphics2D = lessSimpleImage.NewGraphics2D(); // clear the image to white lessSimpleImageGraphics2D.Clear(Color.White); // draw a circle Ellipse ellipseTest = new Ellipse(0, 0, 100, 50); for (double angleDegrees = 0; angleDegrees < 180; angleDegrees += 22.5) { VertexSourceApplyTransform rotatedTransform = new VertexSourceApplyTransform(ellipseTest, Affine.NewRotation(MathHelper.DegreesToRadians(angleDegrees))); VertexSourceApplyTransform rotatedAndTranslatedTransform = new VertexSourceApplyTransform(rotatedTransform, Affine.NewTranslation(lessSimpleImage.Width / 2, 150)); lessSimpleImageGraphics2D.Render(rotatedAndTranslatedTransform, Color.Yellow); Stroke ellipseOutline = new Stroke(rotatedAndTranslatedTransform, 3); lessSimpleImageGraphics2D.Render(ellipseOutline, Color.Blue); } // and a little polygon VertexStorage littlePoly = new VertexStorage(); littlePoly.MoveTo(50, 50); littlePoly.LineTo(150, 50); littlePoly.LineTo(200, 200); littlePoly.LineTo(50, 150); littlePoly.LineTo(50, 50); lessSimpleImageGraphics2D.Render(littlePoly, Color.Cyan); // draw some text TypeFacePrinter textPrinter = new TypeFacePrinter("Printing from a printer", 30, justification: Justification.Center); IVertexSource translatedText = new VertexSourceApplyTransform(textPrinter, Affine.NewTranslation(new Vector2(lessSimpleImage.Width / 2, lessSimpleImage.Height / 4 * 3))); lessSimpleImageGraphics2D.Render(translatedText, Color.Red); Stroke strokedText = new Stroke(translatedText); lessSimpleImageGraphics2D.Render(strokedText, Color.Black); IVertexSource rotatedText = new VertexSourceApplyTransform(textPrinter, Affine.NewRotation(MathHelper.DegreesToRadians(90))); IVertexSource rotatedTranslatedText = new VertexSourceApplyTransform(rotatedText, Affine.NewTranslation(new Vector2(40, lessSimpleImage.Height / 2))); lessSimpleImageGraphics2D.Render(rotatedTranslatedText, Color.Black); // and save this image out ImageTgaIO.Save(lessSimpleImage, "LessSimpleDrawAndSave.tga"); } }
public override void OnDraw(Graphics2D graphics2D) { CameraCalibrationWidget_OnDraw.Start(); graphics2D.Clear(RGBA_Bytes.White); rect_d rect = new rect_d(Width - 40, 10, Width - 10, 40); graphics2D.Rectangle(rect, RGBA_Bytes.Black); Invalidate(rect); base.OnDraw(graphics2D); CameraCalibrationWidget_OnDraw.Stop(); }
public override void OnDraw(Graphics2D graphics2D) { MatterCadWidget_OnDraw.Start(); graphics2D.Clear(RGBA_Bytes.White); rect_d rect = new rect_d(Width - 40, 10, Width - 10, 40); graphics2D.FillRectangle(rect, previewWindowRayTrace.mouseOverColor); graphics2D.Rectangle(rect, RGBA_Bytes.Black); Invalidate(rect); base.OnDraw(graphics2D); MatterCadWidget_OnDraw.Stop(); }