public BitmapGlyph(DBitmap bmp, DGlyphPosition pos) { this.bmp = bmp; Position = pos; }
protected DRect GetRect(DGlyphPosition pos, DRect figureRect, double scale) { DPoint pt = GetXYPosition(pos, figureRect, scale); return new DRect(pt.X, pt.Y, Width * scale, Height * scale); }
protected DPoint GetXYPosition(DGlyphPosition pos, DRect figureRect, double scale) { double x = 0, y = 0; switch (pos) { case DGlyphPosition.TopRight: x = figureRect.Right - Width * scale; y = figureRect.Top; break; case DGlyphPosition.BottomLeft: x = figureRect.Left; y = figureRect.Bottom - Height * scale; break; case DGlyphPosition.Center: x = figureRect.Center.X - Width / 2 * scale; y = figureRect.Center.Y - Height / 2 * scale; break; case DGlyphPosition.CenterStack: x = figureRect.Center.X - Width / 2 * scale; y = figureRect.Center.Y - Height / 2 * scale; double stackX = centerStackIndex * Width * scale; x += stackX; break; } return new DPoint(x, y); }
public void CenterStack(int total, int index) { if (total == 1) pos = DGlyphPosition.Center; else { centerStackTotal = total; centerStackIndex = index; pos = DGlyphPosition.CenterStack; } }