public abstract Fill ( |
||
vxs | ||
Résultat | void |
public override void Draw(CanvasPainter p) { if (myvxs == null) { var transform = Affine.NewMatix( AffinePlan.Translate(-lionShape.Center.x, -lionShape.Center.y), AffinePlan.Scale(spriteScale, spriteScale), AffinePlan.Rotate(angle + Math.PI), AffinePlan.Skew(skewX / 1000.0, skewY / 1000.0), AffinePlan.Translate(Width / 2, Height / 2) ); //create vertextStore again from origiinal path myvxs = transform.TransformToVxs(lionShape.Path.Vxs); } //--------------------------------------------------------------------------------------------- { try { int j = lionShape.NumPaths; int[] pathList = lionShape.PathIndexList; ColorRGBA[] colors = lionShape.Colors; //graphics2D.UseSubPixelRendering = true; for (int i = 0; i < j; ++i) { p.FillColor = colors[i]; p.Fill(new VertexStoreSnap(myvxs, pathList[i])); //graphics2D.Render(new VertexStoreSnap(myvxs, pathList[i]), colors[i]); } } catch (Exception ex) { } } }
public static void Fill(this CanvasPainter p, VertexStore vxs, Color color) { Color prevColor = p.FillColor; p.FillColor = color; p.Fill(vxs); p.FillColor = prevColor; }
public static void Fill(this CanvasPainter p, VertexStoreSnap snap, Color color) { Color prevColor = p.FillColor; p.FillColor = color; p.Fill(snap); p.FillColor = prevColor; }
public void Print(CanvasPainter painter, char[] buffer, double x, double y) { int j = buffer.Length; int buffsize = j * 2; //get kerning list ProperGlyph[] properGlyphs = new ProperGlyph[buffsize]; ActualFont implFont = actualFont; TextShapingService.GetGlyphPos(actualFont, buffer, 0, buffsize, properGlyphs); double xpos = x; for (int i = 0; i < buffsize; ++i) { uint codepoint = properGlyphs[i].codepoint; if (codepoint == 0) { break; } //------------------------------------------------------------- FontGlyph glyph = implFont.GetGlyphByIndex(codepoint); //var left = glyph.glyphMatrix.img_horiBearingX; //-------------------------------------------------------- //render with vector //var mat = Agg.Transform.Affine.NewMatix( //Agg.Transform.AffinePlan.Scale(0.30), //Agg.Transform.AffinePlan.Translate(xpos, y)); //var vxs1 = mat.TransformToVxs(glyph.flattenVxs); VertexStore vxs1 = Agg.Transform.Affine.TranslateToVxs( glyph.flattenVxs, (float)(xpos), (float)(y), vxsPool.GetFreeVxs()); painter.Fill(vxs1); vxsPool.Release(ref vxs1); //-------------------------------------------------------- ////render with bitmap //if (glyph.glyphImage32 != null) //{ // if (glyph.glyphImage32.Width > 0 && glyph.glyphImage32.Height > 0) // { // painter.DrawImage(glyph.glyphImage32, // (float)(xpos + (left >> 6)), // (float)(y + (glyph.exportGlyph.bboxYmin >> 6))); // } //} int w = (glyph.glyphMatrix.advanceX) >> 6; xpos += (w); //------------------------------------------------------------- } }
public override void Draw(CanvasPainter p) { if (myvxs == null) { var transform = Affine.NewMatix( AffinePlan.Translate(-lionShape.Center.x, -lionShape.Center.y), AffinePlan.Scale(spriteScale, spriteScale), AffinePlan.Rotate(angle + Math.PI), AffinePlan.Skew(skewX / 1000.0, skewY / 1000.0), AffinePlan.Translate(Width / 2, Height / 2) ); //create vertextStore again from original path myvxs = new VertexStore(); transform.TransformToVxs(lionShape.Path.Vxs, myvxs); if (AutoFlipY) { //flip the lion PixelFarm.Agg.Transform.Affine aff = PixelFarm.Agg.Transform.Affine.NewMatix( PixelFarm.Agg.Transform.AffinePlan.Scale(-1, -1), PixelFarm.Agg.Transform.AffinePlan.Translate(0, 600)); // var v2 = new VertexStore(); myvxs = transform.TransformToVxs(myvxs, v2); } } //--------------------------------------------------------------------------------------------- { int j = lionShape.NumPaths; int[] pathList = lionShape.PathIndexList; Drawing.Color[] colors = lionShape.Colors; //graphics2D.UseSubPixelRendering = true; for (int i = 0; i < j; ++i) { p.FillColor = colors[i]; p.Fill(new VertexStoreSnap(myvxs, pathList[i])); } } }