static bool HitTestOnSubPart(SvgRenderVx _svgRenderVx, float x, float y) { int partCount = _svgRenderVx.SvgVxCount; for (int i = partCount - 1; i >= 0; --i) { //we do hittest top to bottom => (so => iter backward) SvgPart vx = _svgRenderVx.GetInnerVx(i); if (vx.Kind != SvgRenderVxKind.Path) { continue; } VertexStore innerVxs = vx.GetVxs(); //fine tune //hit test *** if (VertexHitTester.IsPointInVxs(innerVxs, x, y)) { return(true); } } return(false); }
void DrawAsScanline(ClipProxyImage imageClippingProxy, AggRenderSurface aggsx, ScanlineRasterizer rasterizer, ScanlineRasToDestBitmapRenderer sclineRasToBmp) { SvgRenderVx renderVx = lionShape.GetRenderVx(); int num_paths = renderVx.SvgVxCount; for (int i = 0; i < num_paths; ++i) { rasterizer.Reset(); SvgPart svgPart = renderVx.GetInnerVx(i); switch (svgPart.Kind) { case SvgRenderVxKind.Path: { rasterizer.AddPath(new PixelFarm.Drawing.VertexStoreSnap(svgPart.GetVxs(), 0)); sclineRasToBmp.RenderWithColor(imageClippingProxy, rasterizer, aggsx.ScanlinePacked8, new Drawing.Color(255, 0, 0)); } break; } } }
void DrawWithLineProfile(OutlineAARasterizer rasterizer) { SvgRenderVx renderVx = lionShape.GetRenderVx(); int num_paths = renderVx.SvgVxCount; var renderState = new TempRenderState(); renderState.strokeColor = PixelFarm.Drawing.Color.Black; renderState.strokeWidth = 1; renderState.fillColor = PixelFarm.Drawing.Color.Black; renderState.affineTx = null; for (int i = 0; i < num_paths; ++i) { SvgPart vx = renderVx.GetInnerVx(i); switch (vx.Kind) { case SvgRenderVxKind.BeginGroup: { ////1. save current state before enter new state //p.StackPushUserObject(renderState); ////2. enter new px context //if (vx.HasFillColor) //{ // p.FillColor = renderState.fillColor = vx.FillColor; //} //if (vx.HasStrokeColor) //{ // p.StrokeColor = renderState.strokeColor = vx.StrokeColor; //} //if (vx.HasStrokeWidth) //{ // p.StrokeWidth = renderState.strokeWidth = vx.StrokeWidth; //} //if (vx.AffineTx != null) //{ // //apply this to current tx // if (currentTx != null) // { // currentTx = currentTx * vx.AffineTx; // } // else // { // currentTx = vx.AffineTx; // } // renderState.affineTx = currentTx; //} } break; case SvgRenderVxKind.EndGroup: { ////restore to prev state //renderState = (TempRenderState)p.StackPopUserObject(); //p.FillColor = renderState.fillColor; //p.StrokeColor = renderState.strokeColor; //p.StrokeWidth = renderState.strokeWidth; //currentTx = renderState.affineTx; } break; case SvgRenderVxKind.Path: { //temp rasterizer.RenderVertexSnap( new PixelFarm.Drawing.VertexStoreSnap(vx.GetVxs(), 0), new Drawing.Color(255, 0, 0)); } break; //{ // VertexStore vxs = vx.GetVxs(); // if (vx.HasFillColor) // { // //has specific fill color // if (vx.FillColor.A > 0) // { // if (currentTx == null) // { // p.Fill(vxs, vx.FillColor); // } // else // { // //have some tx // tempVxs.Clear(); // currentTx.TransformToVxs(vxs, tempVxs); // p.Fill(tempVxs, vx.FillColor); // } // } // } // else // { // if (p.FillColor.A > 0) // { // if (currentTx == null) // { // p.Fill(vxs); // } // else // { // //have some tx // tempVxs.Clear(); // currentTx.TransformToVxs(vxs, tempVxs); // p.Fill(tempVxs); // } // } // } // if (p.StrokeWidth > 0) // { // //check if we have a stroke version of this render vx // //if not then request a new one // VertexStore strokeVxs = GetStrokeVxsOrCreateNew(vx, p, (float)p.StrokeWidth); // if (vx.HasStrokeColor) // { // //has speciic stroke color // p.StrokeWidth = vx.StrokeWidth; // if (currentTx == null) // { // p.Fill(strokeVxs, vx.StrokeColor); // } // else // { // //have some tx // tempVxs.Clear(); // currentTx.TransformToVxs(strokeVxs, tempVxs); // p.Fill(tempVxs, vx.StrokeColor); // } // } // else if (p.StrokeColor.A > 0) // { // if (currentTx == null) // { // p.Fill(strokeVxs, p.StrokeColor); // } // else // { // tempVxs.Clear(); // currentTx.TransformToVxs(strokeVxs, tempVxs); // p.Fill(tempVxs, p.StrokeColor); // } // } // else // { // } // } // else // { // if (vx.HasStrokeColor) // { // VertexStore strokeVxs = GetStrokeVxsOrCreateNew(vx, p, (float)p.StrokeWidth); // p.Fill(strokeVxs); // } // else if (p.StrokeColor.A > 0) // { // VertexStore strokeVxs = GetStrokeVxsOrCreateNew(vx, p, (float)p.StrokeWidth); // p.Fill(strokeVxs, p.StrokeColor); // } // } //} break; } } }