public void FillRoundRectangle(double left, double bottom, double right, double top, double radius) { if (roundRect == null) { roundRect = new RoundedRect(left, bottom, right, top, radius); roundRect.NormalizeRadius(); } else { roundRect.SetRect(left, bottom, right, top); roundRect.SetRadius(radius); roundRect.NormalizeRadius(); } this.Fill(roundRect.MakeVxs()); }
public override void DrawRoundRect(double left, double bottom, double right, double top, double radius) { if (roundRect == null) { roundRect = new RoundedRect(left, bottom, right, top, radius); roundRect.NormalizeRadius(); } else { roundRect.SetRect(left, bottom, right, top); roundRect.SetRadius(radius); roundRect.NormalizeRadius(); } var v1 = GetFreeVxs(); this.Draw(roundRect.MakeVxs(v1)); ReleaseVxs(ref v1); }
public override void FillRoundRectangle(double left, double bottom, double right, double top, double radius) { if (roundRect == null) { roundRect = new Agg.VertexSource.RoundedRect(left, bottom, right, top, radius); roundRect.NormalizeRadius(); } else { roundRect.SetRect(left, bottom, right, top); roundRect.SetRadius(radius); roundRect.NormalizeRadius(); } var v1 = GetFreeVxs(); this.Fill(roundRect.MakeVxs(v1)); ReleaseVxs(ref v1); }
public override void OnDraw() { GammaLut gamma = new GammaLut(m_gamma.value().ToDouble()); IBlender NormalBlender = new BlenderBGRA(); IBlender GammaBlender = new BlenderGammaBGRA(gamma); FormatRGBA pixf = new FormatRGBA(rbuf_window(), NormalBlender); FormatClippingProxy clippingProxy = new FormatClippingProxy(pixf); clippingProxy.Clear(m_white_on_black.status() ? new RGBA_Doubles(0, 0, 0) : new RGBA_Doubles(1, 1, 1)); RasterizerScanlineAA <T> ras = new RasterizerScanlineAA <T>(); ScanlinePacked8 sl = new ScanlinePacked8(); Ellipse <T> e = new Ellipse <T>(); // TODO: If you drag the control circles below the bottom of the window we get an exception. This does not happen in AGG. // It needs to be debugged. Turning on clipping fixes it. But standard agg works without clipping. Could be a bigger problem than this. //ras.clip_box(0, 0, width(), height()); // Render two "control" circles e.Init(m_x[0], m_y[0], M.New <T>(3), M.New <T>(3), 16); ras.AddPath(e); Renderer <T> .RenderSolid(clippingProxy, ras, sl, new RGBA_Bytes(127, 127, 127)); e.Init(m_x[1], m_y[1], M.New <T>(3), M.New <T>(3), 16); ras.AddPath(e); Renderer <T> .RenderSolid(clippingProxy, ras, sl, new RGBA_Bytes(127, 127, 127)); T d = m_offset.value(); // Creating a rounded rectangle RoundedRect <T> r = new RoundedRect <T>(m_x[0].Add(d), m_y[0].Add(d), m_x[1].Add(d), m_y[1].Add(d), m_radius.value()); r.NormalizeRadius(); // Drawing as an outline if (!m_DrawAsOutlineCheckBox.status()) { ConvStroke <T> p = new ConvStroke <T>(r); p.Width = M.One <T>(); ras.AddPath(p); } else { ras.AddPath(r); } pixf.Blender = GammaBlender; Renderer <T> .RenderSolid(clippingProxy, ras, sl, m_white_on_black.status()?new RGBA_Bytes(1, 1, 1) : new RGBA_Bytes(0, 0, 0)); // this was in the original demo, but it does nothing because we changed the blender not the gamma function. //ras.gamma(new gamma_none()); // so let's change the blender instead pixf.Blender = NormalBlender; // Render the controls //m_radius.Render(ras, sl, clippingProxy); //m_gamma.Render(ras, sl, clippingProxy); //m_offset.Render(ras, sl, clippingProxy); //m_white_on_black.Render(ras, sl, clippingProxy); //m_DrawAsOutlineCheckBox.Render(ras, sl, clippingProxy); base.OnDraw(); }