public override void OnDraw() { RasterizerScanlineAA <T> ras = new RasterizerScanlineAA <T>(); ScanlineUnpacked8 sl = new ScanlineUnpacked8(); #if SourceDepth24 FormatRGB pixf = new FormatRGB(rbuf_window(), new BlenderBGR()); #else FormatRGBA pixf = new FormatRGBA(rbuf_window(), new blender_bgra32()); #endif FormatClippingProxy clippingProxy = new FormatClippingProxy(pixf); clippingProxy.Clear(new RGBA_Doubles(0, 0, 0)); m_profile.text_size(8.0); //m_profile.Render(ras, sl, clippingProxy); //m_spline_r.Render(ras, sl, clippingProxy); //m_spline_g.Render(ras, sl, clippingProxy); //m_spline_b.Render(ras, sl, clippingProxy); //m_spline_a.Render(ras, sl, clippingProxy); //m_GradTypeRBox.Render(ras, sl, clippingProxy); //m_GradWrapRBox.Render(ras, sl, clippingProxy); // draw a background to show how the alpha is working int RectWidth = 32; int xoffset = 238; int yoffset = 171; for (int i = 0; i < 7; i++) { for (int j = 0; j < 7; j++) { if ((i + j) % 2 != 0) { VertexSource.RoundedRect <T> rect = new VertexSource.RoundedRect <T>(i * RectWidth + xoffset, j * RectWidth + yoffset, (i + 1) * RectWidth + xoffset, (j + 1) * RectWidth + yoffset, 2); rect.NormalizeRadius(); // Drawing as an outline ras.AddPath(rect); Renderer <T> .RenderSolid(clippingProxy, ras, sl, new RGBA_Bytes(.9, .9, .9)); } } } double ini_scale = 1.0; IAffineTransformMatrix <T> mtx1 = MatrixFactory <T> .NewIdentity(VectorDimension.Two); mtx1.Scale(MatrixFactory <T> .CreateVector2D(ini_scale, ini_scale)); mtx1.Translate(MatrixFactory <T> .CreateVector2D(center_x, center_y)); mtx1.Add(trans_affine_resizing()); VertexSource.Ellipse <T> e1 = new AGG.VertexSource.Ellipse <T>(); e1.Init(0.0, 0.0, 110.0, 110.0, 64); IAffineTransformMatrix <T> mtx_g1 = MatrixFactory <T> .NewIdentity(VectorDimension.Two); mtx_g1.Scale(MatrixFactory <T> .CreateVector2D(ini_scale, ini_scale)); mtx_g1.Scale(MatrixFactory <T> .CreateVector2D(m_SaveData.m_scale, m_SaveData.m_scale)); mtx_g1.Scale(MatrixFactory <T> .CreateVector2D(m_scale_x, m_scale_y)); mtx_g1.RotateAlong(MatrixFactory <T> .CreateVector2D(0, 0), m_SaveData.m_angle.ToDouble()); mtx_g1.Translate(MatrixFactory <T> .CreateVector2D(m_SaveData.m_center_x, m_SaveData.m_center_y)); mtx_g1.Add(trans_affine_resizing()); mtx_g1 = mtx_g1.Inverse; RGBA_Bytes[] color_profile = new RGBA_Bytes[256]; // color_type is defined in pixel_formats.h for (int i = 0; i < 256; i++) { color_profile[i] = new RGBA_Bytes(m_spline_r.spline()[i].ToInt(), m_spline_g.spline()[i].ToInt(), m_spline_b.spline()[i].ToInt(), m_spline_a.spline()[i].ToInt()); } ConvTransform <T> t1 = new ConvTransform <T>(e1, mtx1); IGradient innerGradient = null; switch (m_GradTypeRBox.cur_item()) { case 0: innerGradient = new GradientRadial(); break; case 1: innerGradient = new GradientDiamond(); break; case 2: innerGradient = new GradientX(); break; case 3: innerGradient = new GradientXY(); break; case 4: innerGradient = new GradientSqrtXY(); break; case 5: innerGradient = new GradientConic(); break; } IGradient outerGradient = null; switch (m_GradWrapRBox.cur_item()) { case 0: outerGradient = new GradientReflectAdaptor(innerGradient); break; case 1: outerGradient = new GradientRepeatAdaptor(innerGradient); break; case 2: outerGradient = new GradientClampAdaptor(innerGradient); break; } SpanAllocator span_alloc = new SpanAllocator(); ColorFunctionProfile colors = new ColorFunctionProfile(color_profile, m_profile.gamma()); SpanInterpolatorLinear <T> inter = new SpanInterpolatorLinear <T>(mtx_g1); SpanGradient <T> span_gen = new SpanGradient <T>(inter, outerGradient, colors, 0, 150); ras.AddPath(t1); Renderer <T> .GenerateAndRender(ras, sl, clippingProxy, span_alloc, span_gen); base.OnDraw(); }