void DrawD(PixelFarm.Drawing.Painter painter) { PathWriter ps = new PathWriter(); painter.Clear(PixelFarm.Drawing.Color.White); painter.StrokeColor = PixelFarm.Drawing.Color.Red; //p.Line(10, 10, 50, 10); //p.Line(50, 10, 50, 50); //p.Line(50, 50, 10, 50); //p.Line(50, 10, 10, 10); ps.Clear(); ps.MoveTo(10, 10); ps.LineTo(50, 10); ps.LineTo(50, 50); ps.LineTo(10, 50); ps.CloseFigure(); // //ps.MoveTo(15, 15); //ps.LineTo(15, 45); //ps.LineTo(45, 45); //ps.LineTo(45, 15); //ps.CloseFigure(); // //p.Fill(ps.Vxs, PixelFarm.Drawing.Color.Black); painter.Draw(ps.Vxs, PixelFarm.Drawing.Color.Red); }
public override void Draw(PixelFarm.Drawing.Painter p) { //---------------- //5. use PixelFarm's Agg to render to bitmap... //5.1 clear background p.Clear(PixelFarm.Drawing.Color.White); if (FillBG) { //5.2 p.FillColor = PixelFarm.Drawing.Color.Black; //5.3 //p.Fill(vxs); float x = p.OriginX; float y = p.OriginY; p.Fill(_left_vxs); p.SetOrigin(x + 50, y + 50); p.Fill(_right_vxs); p.SetOrigin(x, y); } if (FillBorder) { //5.4 p.StrokeColor = PixelFarm.Drawing.Color.Green; //user can specific border width here... p.StrokeWidth = 2; //5.5 float x = p.OriginX; float y = p.OriginY; p.Draw(_left_vxs); p.SetOrigin(x + 50, y + 20); p.Draw(_right_vxs); p.SetOrigin(x, y); } }
void DrawE(PixelFarm.Drawing.Painter painter) { PathWriter ps = new PathWriter(); painter.Clear(PixelFarm.Drawing.Color.White); painter.StrokeColor = PixelFarm.Drawing.Color.Red; //p.Line(10, 10, 50, 10); //p.Line(50, 10, 50, 50); //p.Line(50, 50, 10, 50); //p.Line(50, 10, 10, 10); ps.Clear(); //ps.MoveTo(10, 10); //ps.LineTo(50, 10); //ps.LineTo(50, 50); //ps.MoveTo(10, 10); //ps.LineTo(50, 10); //ps.LineTo(10, 20); ps.MoveTo(150, 10); ps.LineTo(110, 10); ps.LineTo(150, 20); //ps.MoveTo(50, 50); //ps.LineTo(40, 50); //ps.LineTo(80, 70); //ps.CloseFigure(); //p.Fill(ps.Vxs, PixelFarm.Drawing.Color.Black); VertexStore output = new VertexStore(); StrokeGen2 gen2 = new StrokeGen2(); gen2.LineCapStyle = LineCap.Butt; gen2.LineJoinStyle = LineJoin.Miter; gen2.HalfStrokeWidth = 7;// gen2.Generate(ps.Vxs, output); //----------------------------------------------------- painter.Fill(output, PixelFarm.Drawing.Color.Red); painter.StrokeWidth = 1f; painter.Draw(ps.Vxs, PixelFarm.Drawing.Color.Black); }
public override void Draw(PixelFarm.Drawing.Painter p) { p.Clear(Drawing.Color.White); p.FillColor = Drawing.Color.Black; int j = myBrushPathList.Count; for (int n = 0; n < j; ++n) { var brushPath = myBrushPathList[n]; if (brushPath.Vxs != null) { switch (brushPath.BrushMode) { case SmoothBrushMode.CutBrush: { } break; default: { //TODO: review PixelCache here p.FillColor = brushPath.FillColor; p.Fill(brushPath.Vxs); if (brushPath.StrokeColor.alpha > 0) { p.StrokeColor = Drawing.Color.Red; p.Draw(brushPath.Vxs); } } break; } } else { //current drawing brush var contPoints = brushPath.contPoints; int pcount = contPoints.Count; for (int i = 1; i < pcount; ++i) { var p0 = contPoints[i - 1]; var p1 = contPoints[i]; p.DrawLine(p0.x, p0.y, p1.x, p1.y); } } } }
public void RenderChar(char testChar, HintTechnique hint) { builder.SetHintTechnique(hint); #if DEBUG GlyphBoneJoint.dbugTotalId = 0;//reset builder.dbugAlwaysDoCurveAnalysis = true; #endif _infoView.Clear(); _latestHint = hint; _testChar = testChar; //---------------------------------------------------- // builder.Build(testChar, _sizeInPoint); var txToVxs1 = new GlyphTranslatorToVxs(); builder.GlyphDynamicEdgeOffset = this.GlyphEdgeOffset; builder.ReadShapes(txToVxs1); #if DEBUG var ps = txToVxs1.dbugGetPathWriter(); _infoView.ShowOrgBorderInfo(ps.Vxs); #endif PixelFarm.Drawing.VertexStore vxs = new PixelFarm.Drawing.VertexStore(); txToVxs1.WriteOutput(vxs); //---------------------------------------------------- //---------------------------------------------------- painter.UseSubPixelLcdEffect = this.UseLcdTechnique; //5. use PixelFarm's Agg to render to bitmap... //5.1 clear background painter.Clear(PixelFarm.Drawing.Color.White); RectD bounds = new RectD(); BoundingRect.GetBoundingRect(new PixelFarm.Drawing.VertexStoreSnap(vxs), ref bounds); //---------------------------------------------------- float scale = _typeface.CalculateScaleToPixelFromPointSize(_sizeInPoint); _pxscale = scale; this._infoView.PxScale = scale; var left2 = 0; int floor_1 = (int)left2; float diff = left2 - floor_1; //---------------------------------------------------- if (OffsetMinorX) { MinorOffsetInfo = left2.ToString() + " =>" + floor_1 + ",diff=" + diff; } else { MinorOffsetInfo = left2.ToString(); } //5. use PixelFarm's Agg to render to bitmap... //5.1 clear background painter.Clear(PixelFarm.Drawing.Color.White); if (FillBackGround) { //5.2 painter.FillColor = PixelFarm.Drawing.Color.Black; float xpos = 5;// - diff; if (OffsetMinorX) { xpos -= diff; } painter.SetOrigin(xpos, 10); painter.Fill(vxs); } if (DrawBorder) { //5.4 painter.StrokeColor = PixelFarm.Drawing.Color.Green; //user can specific border width here... //5.5 painter.Draw(vxs); //-------------- int markOnVertexNo = _infoView.DebugMarkVertexCommand; double x, y; vxs.GetVertex(markOnVertexNo, out x, out y); painter.FillRect(x, y, 4, 4, PixelFarm.Drawing.Color.Red); //-------------- _infoView.ShowFlatternBorderInfo(vxs); //-------------- } #if DEBUG builder.dbugAlwaysDoCurveAnalysis = false; #endif if (ShowTess) { RenderTessTesult(); } //if (DrawDynamicOutline) //{ // GlyphDynamicOutline dynamicOutline = builder.LatestGlyphFitOutline; // WalkDynamicOutline(painter, dynamicOutline, scale, DrawRegenerateOutline); //} }
public override void Draw(PixelFarm.Drawing.Painter p) { p.Clear(Drawing.Color.White); p.StrokeColor = Color.Black; p.StrokeWidth = 2; p.StrokeColor = Color.Green; p.Draw(_triangleVxs); if (!ShowReconstructionCurve) { return; } //draw Ci line p.StrokeColor = KnownColors.OrangeRed; DrawLine(p, a01, a12); DrawLine(p, a12, a20); DrawLine(p, a20, a01); //find B //DrawPoint(p, a01); //DrawPoint(p, a12); //DrawPoint(p, a20); BezierControllerArmPair c1 = BezierControllerArmPair.ReconstructControllerArms(v0, v1, v2); BezierControllerArmPair c2 = BezierControllerArmPair.ReconstructControllerArms(v1, v2, v0); BezierControllerArmPair c0 = BezierControllerArmPair.ReconstructControllerArms(v2, v0, v1); c0.UniformSmoothCoefficient = SmoothCoefficientValue; c1.UniformSmoothCoefficient = SmoothCoefficientValue; c2.UniformSmoothCoefficient = SmoothCoefficientValue; //DrawPoint(p, c0 = FindB(v0, v1, v2, out c1)); //DrawPoint(p, b2 = FindB(v1, v2, v0, out c2)); //DrawPoint(p, b0 = FindB(v2, v0, v1, out c0)); p.StrokeColor = Color.Red; DrawControllerPair(p, c0); DrawControllerPair(p, c1); DrawControllerPair(p, c2); p.StrokeColor = Color.Blue; using (Tools.BorrowVxs(out var tmpVxs1, out var tmpVxs2)) using (Tools.BorrowPathWriter(tmpVxs1, out var pw)) { pw.MoveTo(c0.mid.X, c0.mid.y); pw.Curve4(c0.right.x, c0.right.y, c1.left.x, c1.left.y, c1.mid.x, c1.mid.y); //1st curve pw.Curve4(c1.right.x, c1.right.y, c2.left.x, c2.left.y, c2.mid.x, c2.mid.y); //2nd curve pw.Curve4(c2.right.x, c2.right.y, c0.left.x, c0.left.y, c0.mid.x, c0.mid.y); //3rd curve _curveflattener.MakeVxs(tmpVxs1, tmpVxs2); p.Draw(tmpVxs2); } }