In This Article

Glyph Class

Defines the base requirements for a glyph.

public abstract class Glyph
Inheritance:
object object
Derived:
XamlGlyph

Remarks

For internal use only.

Constructors

Glyph()

Initializes an instance of the class.

protected Glyph()

Methods

Draw(Graphics, Point, Color, SizeF)

Draws the glyph at the given location.

public void Draw(Graphics g, Point location, Color color, SizeF scaleFactor)
Parameter Type Description
g Graphics

The Graphics object used to paint.

location Point

The location of the top-left corner of the glyph.

color Color

The color used to paint.

scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

Draw(Graphics, Rectangle, Color, SizeF)

Draws the glyph at the given location.

public void Draw(Graphics g, Rectangle bounds, Color color, SizeF scaleFactor)
Parameter Type Description
g Graphics

The Graphics object used to paint.

bounds Rectangle

The bounds where the glyph will be painted, centered horizontally and vertically.

color Color

The color used to paint.

scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

DrawCore(Graphics, Point, Color, SizeF)

Performs the core painting of the glyph at the given location.

protected abstract void DrawCore(Graphics g, Point location, Color color, SizeF scaleFactor)
Parameter Type Description
g Graphics

The Graphics object used to paint.

location Point

The location of the top-left corner of the glyph.

color Color

The color used to paint.

scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

DrawPolygon(Graphics, Point, PointF[], Color?, Color?, SizeF)

Draws a polygon at the given location using inset pen alignment for the border.

protected void DrawPolygon(Graphics g, Point location, PointF[] points, Color? borderColor, Color? fillColor, SizeF scaleFactor)
Parameter Type Description
g Graphics

The Graphics object used to paint.

location Point

The location of the top-left corner of the polygon.

points PointF[]

An array of points whose coordinates are relative to the given location.

borderColor Color?

The color, if any, used to paint the polygon border.

fillColor Color?

The color, if any, used to paint the polygon background.

scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

DrawPolygon(Graphics, Point, PointF[], Color?, Color?, SizeF, PenAlignment)

Draws a polygon at the given location.

protected void DrawPolygon(Graphics g, Point location, PointF[] points, Color? borderColor, Color? fillColor, SizeF scaleFactor, PenAlignment borderPenAlignment)
Parameter Type Description
g Graphics

The Graphics object used to paint.

location Point

The location of the top-left corner of the polygon.

points PointF[]

An array of points whose coordinates are relative to the given location.

borderColor Color?

The color, if any, used to paint the polygon border.

fillColor Color?

The color, if any, used to paint the polygon background.

scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

borderPenAlignment PenAlignment

One of the PenAlignment values to use when configuring the border pen.

DrawRectangle(Graphics, Point, Rectangle, Color?, Color?, SizeF)

Draws a rectangle at the given location using inset pen alignment for the border.

protected void DrawRectangle(Graphics g, Point location, Rectangle rect, Color? borderColor, Color? fillColor, SizeF scaleFactor)
Parameter Type Description
g Graphics

The Graphics object used to paint.

location Point

The location of the top-left corner of the rectangle.

rect Rectangle

The bounds of the rectangle relative to the given location.

borderColor Color?

The color, if any, used to paint the rectangle border.

fillColor Color?

The color, if any, used to paint the rectangle background.

scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

DrawRectangle(Graphics, Point, RectangleF, Color?, Color?, SizeF)

Draws a rectangle at the given location using inset pen alignment for the border.

protected void DrawRectangle(Graphics g, Point location, RectangleF rect, Color? borderColor, Color? fillColor, SizeF scaleFactor)
Parameter Type Description
g Graphics

The Graphics object used to paint.

location Point

The location of the top-left corner of the rectangle.

rect RectangleF

The bounds of the rectangle relative to the given location.

borderColor Color?

The color, if any, used to paint the rectangle border.

fillColor Color?

The color, if any, used to paint the rectangle background.

scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

GetScaledSize(SizeF)

Gets the actual size of the glyph when scaled by the given scale factor.

public Size GetScaledSize(SizeF scaleFactor)
Parameter Type Description
scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

Returns

Size:

The size of the the glyph after it is scaled.

GetUnscaledSize(SizeF)

Gets the original size of the glyph before scaling to the given scale factor.

protected abstract Size GetUnscaledSize(SizeF scaleFactor)
Parameter Type Description
scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

Returns

Size:

The size of the the glyph after it is scaled.

IsHighDpi(SizeF)

Tests if the given scale factor is considered high DPI.

protected static bool IsHighDpi(SizeF scaleFactor)
Parameter Type Description
scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

Returns

bool:

true if the scale factor is high DPI; otherwise, false.

ShouldUseAntiAlias(SizeF)

Tests if AntiAlias should be used when painting the glyph at the given scale factor.

protected virtual bool ShouldUseAntiAlias(SizeF scaleFactor)
Parameter Type Description
scaleFactor SizeF

The scale factor to apply when painting (e.g. 1.0 for original size and 2.0 for double size).

Returns

bool:

true if AntiAlias should be used when painting; otherwise, false. By default, anti-alias is used only with high DPI scale factors.

TransformAndScalePoints(Point, PointF[], SizeF)

Transforms all points to the given location and scaled by the given scale factor.

protected static PointF[] TransformAndScalePoints(Point location, PointF[] points, SizeF scaleFactor)
Parameter Type Description
location Point

The offset to be applied to each point.

points PointF[]

The points to be transformed and scaled, where each point is based on origin 0,0.

scaleFactor SizeF

The scale factor to be applied to each point.

Returns

PointF[]:

A new PointF[] with transform and scale applied.

Inherited Members