public RectF(IRectangleF area) { X = area.X; Y = area.Y; Width = area.Width; Height = area.Height; }
public TrapeziumData(IList <PointF> points, Angle angle, IRectangleF bounds) { Points = points; Angle = angle; Bounds = bounds; Initialized = true; }
public Angle AssignCenter(IRectangleF rc, bool permanent = false) { if (CenterAssigned) { return(this); } var a = new Angle(Degree, rc.X + rc.Width / 2f, rc.Y + rc.Height / 2f, Skew, permanent); return(a); }
public IRectangleF MeasureText(IDrawStyle style = null) { if (!Changed) return Bounds; ChangeDrawStyle(style); var info = font.MeasureGlyphs(originalGlyphs, DrawX, DrawY, DrawStyle); area = info.Bounds; originalGlyphs = info.Glyphs; RestoreDrawStyle(); return area; }
public Shape(IShape shape) { Points = shape; Name = shape.Name; Angle = shape.Angle; Bounds = shape.Bounds; ID = shape.ID; if (ID == null) { shape.AssignIDIfNone(); } }
public Shape(IEnumerable <PointF> points, string shapeType, Angle angle, IRectangleF originalArea) { Points = points; Name = shapeType; Angle = angle; Bounds = originalArea ?? points.ToArea(); ID = (points is IElement) ? (points as IElement).ID : "Custom"; if (ID == null) { ID = Implementation.Factory.NewID(Points); } }
GlyphsData(string text, IRectangleF area, IList <IGlyph> glyphs, float minHBY, Angle angle = default(Angle), bool containsNewLine = false) { Bounds = area; Bounds = area; Glyphs = glyphs; MinHBY = minHBY; Angle = angle; ContainsNewLine = containsNewLine; if (text == null) { Text = new string(glyphs.Select(x => x.Character).ToArray()); } else { Text = text; } }
public Angle(float angle, IRectangleF area, bool skew = false) : this(angle, area.Center(), skew) { }
public static IBoxF newBoxF(this IFactory factory, IRectangleF area) => factory.newBoxF(area?.X ?? 0, area?.Y ?? 0, area?.Width ?? 0, area?.Height ?? 0);
public static IRhombus newRhombus(this IFactory factory, IRectangleF area, Angle angle = default(Angle), float?deviation = null) => factory.newRhombus(area.X, area.Y, area.Width, area.Height, angle, deviation);
public static IRoundedBox newRoundedBox(this IFactory factory, IRectangleF rc, float cornerRadius, Angle angle = default(Angle)) => factory.newRoundedBox(rc.X, rc.Y, rc.Width, rc.Height, cornerRadius, angle);
public Occupier(IRectangleF bounds, Angle angle) { Bounds = bounds; Angle = angle; }
public static GlyphsData Create(string text, IRectangleF area, IList <IGlyph> glyphs, float minHBY, Angle angle = default(Angle), bool containsNewLine = false) => new GlyphsData(text, area, glyphs, minHBY, angle, containsNewLine);
void Initialize(ICurve curve, IRectangleF area, bool assignID, PointF c = default(PointF) , ICurve attachedCurve = null) { Initialize(curve.StartAngle, curve.EndAngle, new EllipseData(area, curve.Data), curve.Type, assignID, c, attachedCurve); }
public EllipseData(IRectangleF rc, Angle angle) : this(rc.X, rc.Y, rc.Width, rc.Height, angle) { }
public EllipseData(IRectangleF rc, EllipseData original) : this(rc.X, rc.Y, rc.Width, rc.Height, original.Angle) { }
public static GlyphsData MeasureGlyphs(this IFont font, IList <IGlyph> Glyphs, float destX, float destY, IDrawStyle drawStyle = null) { if (font == null) { return(GlyphsData.Empty); } var DrawStyle = drawStyle ?? new DrawStyle(); DrawStyle.LineHeight = font.Info.LineHeight.Ceiling(); float lineHeight = DrawStyle.LineHeight; float newx, newy, right, bottom, minX, minY, kerning; for (int i = 0; i < Glyphs.Count; i++) { Glyphs[i].SetDrawXY(0, 0); } var minHBY = Glyphs.Min(g => g.Bounds.Y); if (minHBY < 0) { destY += -minHBY; } if (Glyphs[0].Bounds.X < 0) { destX += -Glyphs[0].Bounds.X; } newx = right = minX = destX; newy = bottom = minY = destY; bool start = true; kerning = 0; for (int i = 0; i < Glyphs.Count; i++) { IGlyph g = Glyphs[i]; lineHeight = Math.Max(lineHeight, g.Bounds.Height); if (IsSpace(Glyphs, i)) { switch (DrawStyle.Breaker) { case TextBreaker.None: case TextBreaker.Word: if (DrawStyle.Delimiter == BreakDelimiter.Word) { goto case TextBreaker.SingleWord; } break; case TextBreaker.Line: default: if (!start) { newx += g.Bounds.Width; } goto mks; case TextBreaker.SingleWord: newx = destX; newy += lineHeight; start = true; break; } } else if (IsCR(Glyphs, i) || IsLF(Glyphs, i)) { if (IsPreviousCR(Glyphs, i)) { goto last; } else { newx = destX; newy += lineHeight; goto mks; } } kerning = GetKerning(Glyphs, font, i); mks: g.SetDrawXY((newx + kerning).Round(), newy.Round()); minX = Math.Min(g.DrawX, minX); minY = Math.Min(g.DrawY, minY); newx = g.DrawX + g.Bounds.Width; right = Math.Max(newx, right); bottom = Math.Max(bottom, g.DrawY + g.Bounds.Height); last: start = false; } IRectangleF Area = Factory.RectangleFFromLTRB(minX, minY, ++right, ++bottom); //IAreaF PenArea = Factory.AreaFFromLTRB(destX, destY, right, bottom); if (DrawStyle.Angle.Valid) { var glyphs = new IGlyph[Glyphs.Count]; Glyphs.CopyTo(glyphs, 0); for (int i = 0; i < glyphs.Length; i++) { glyphs[i].Rotate(DrawStyle.Angle.AssignCenter(Area.Center())); } Area = Factory.newRhombus(glyphs[0].Bounds, DrawStyle.Angle, Area.Width); return(GlyphsData.Create(null, Area, glyphs as IList <IGlyph>, minHBY, DrawStyle.Angle)); } return(GlyphsData.Create(null, Area, Glyphs, minHBY)); }