GraphicsExtensionMethods
Provides extension methods for the Eto graphics object.
Fields
Methods
Add noise to an entire control.
public static void AddNoise()
this Context
context,
Graphics context.
flavour,
Flavour of noise.
strength
Strength of noise in the (0, 1) range.
Fill a region with noise.
public static void AddNoise()
this Graphics
graphics,
Graphics object to draw with.
flavour,
Flavour of noise.
strength,
Strength of noise in the (0, 1) range.
region
Region to fill.
Fill a region with noise.
public static void AddNoise()
this Graphics
graphics,
Graphics object to draw with.
flavour,
Flavour of noise.
strength,
Strength of noise in the (0, 1) range.
GraphicsPath
region
Region to fill.
Fill a region with noise.
public static void AddNoise()
this Graphics
graphics,
Graphics object to draw with.
flavour,
Flavour of noise.
strength,
Strength of noise in the (0, 1) range.
RectangleF
region
Region to fill.
Clear the graphics using black-based transparent.
public static void Clear()
this Graphics
graphics
Draw text whose anchor is at a specific location.
public static RectangleF DrawAnchoredText()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to use.
Color
colour,
Colour of text.
text,
Text.
anchor,
Anchor point.
PointF
point
Location.
Draw text at a point along a direction. This method automatically aligns and rotates text to keep it as upright as possible.
public static void DrawAngledText()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to use.
Color
colour,
Colour of text.
text,
Text.
PointF
point,
Location.
SizeF
direction
Text base line vector.
Draw rotated text.
public static void DrawAngledText()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to use.
Color
colour,
Colour of text.
text,
Text.
anchor,
Anchor point.
PointF
point,
Location.
angle
Rotation angle.
Draw an arc.
Draw an arc.
public static void DrawArc()
Draw an arrow.
Draw an arrow.
Draw an arrow at both ends of a line segment.
Draw a set of three dimples hinting at a draggable area.
public static void DrawArrowDimples()
this Graphics
graphics,
Graphics object to draw with.
PointF
centre,
Centre coordinate of dimples.
direction
Arrow direction (0=up, 1=down, s=left, 3=right)
Draw a balloon with a text label.
public static void DrawBalloonLabel()
this Graphics
graphics,
Graphics object to draw with.
PointF
tip,
Balloon tip.
text,
Text to draw.
Font
font = null,
Font to use.
shade = null,
Balloon shading.
SizeF?
size = null,
Size override, handy for keeping consecutive balloon drawings the same size while the content changes.
scale = 1
Scaling factor for entire shape.
public static void DrawBalloonLabel()
Draw a set of five dimples hinting at a draggable area.
public static void DrawBarDimples()
this Graphics
graphics,
Graphics object to draw with.
PointF
centre,
Centre coordinate of dimples.
vertical
If true, the dimples will be ordered in two columns. If false, two rows.
Draw a bezier segment.
public static void DrawBezier()
Draw the edges of a box.
public static void DrawBox()
this Graphics
graphics,
Graphics object to draw with.
box,
Box to draw.
Pen
edges
Pen for all edges.
Draw the edges of a box.
public static void DrawBox()
this Graphics
graphics,
Graphics object to draw with.
box,
Box to draw.
Pen
silhouette,
Optional edge for box outline.
Pen
interior,
Optional edge for interior visible edges.
Pen
hidden
Optional edge for hidden edges.
Draw the edges of a box.
public static void DrawBox()
this Graphics
graphics,
Graphics object to draw with.
box,
Box to draw.
Pen
visible,
Optional edge for visible edges.
Pen
hidden
Optional edge for hidden edges.
Draw a bracketed label underneath some anchor points.
public static void DrawBracketLabel()
this Graphics
graphics,
Graphic object.
Font
font,
Font to use.
Color
colour,
Colour of text and bracket.
PointF
left,
Anchor point for left edge of bracket.
PointF
right,
Anchor point for right edge of bracket.
text
Label text.
Draw centered text.
public static void DrawCenteredText()
this Graphics
graphics,
Graphics objects to draw with.
PointF
centre,
Centre point.
Font
font,
Font to draw with.
Brush
fill,
Text fill.
text
Text to draw.
Draw centered text.
public static void DrawCenteredText()
this Graphics
graphics,
Graphics objects to draw with.
PointF
centre,
Centre point.
Font
font,
Font to draw with.
Color
colour,
Text colour.
text
Text to draw.
Draw a circle.
Draw a circle.
public static void DrawCircle()
Draw the standard pivot shape at the given location.
public static void DrawColourPivot()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Pivot colour.
PointF
point,
Pivot location.
radius
Pivot radius.
Draw a quarter-circle shadow radiating outward from a single point, darkest at the point and fading with radial distance. Use this to round off the corners where two DrawEdgeShadow strips meet. The pixel radius and peak opacity match the straight edges of the same ShadowSize.
public static void DrawCornerShadow()
this Graphics
graphics,
Graphics object to draw with.
PointF
point,
Point the shadow radiates from (the rectangle corner).
corner,
Which corner this is, i.e. the quadrant the shadow fans into.
Preset shadow size.
Draw a quarter-circle shadow as DrawCornerShadow(Graphics, PointF, ShadowCorner, ShadowSize), but faded to the given opacity.
public static void DrawCornerShadow()
this Graphics
graphics,
Graphics object to draw with.
PointF
point,
Point the shadow radiates from (the rectangle corner).
corner,
Which corner this is, i.e. the quadrant the shadow fans into.
size,
Preset shadow size.
opacity
Opacity multiplier (0.0 ~ 1.0) applied to the whole shadow.
Draw the wireframe of a cylinder.
public static void DrawCylinder()
this Graphics
graphics,
Graphics object to draw with.
cylinder,
Cylinder to draw.
Pen
edges
Pen for the edges.
Draw the wireframe of a cylinder.
public static void DrawCylinder()
this Graphics
graphics,
Graphics object to draw with.
cylinder,
Cylinder to draw.
Pen
silhouette,
Optional edge for outline edges.
Pen
interior,
Optional edge for outline edges.
Pen
hidden,
Optional edge for hidden edges.
fromAbove
If true, the top face of the cylinder is assumed to face the viewer.
Draw the wireframe of a cylinder.
public static void DrawCylinder()
this Graphics
graphics,
Graphics object to draw with.
cylinder,
Cylinder to draw.
Pen
visible,
Pen for visible edges.
Pen
hidden,
Optional edge for hidden edges.
fromAbove
If true, the top face of the cylinder is assumed to face the viewer.
Draw a dotted debug box handy while writing layout code.
public static void DrawDebugBox()
this Graphics
graphics,
RectangleF
box,
Color
colour
Draw a set of dimples hinting at a draggable area.
Draw a standard disabled control motif.
public static void DrawDisabledMotif()
this Graphics
graphics,
Control
control
Draw a standard disabled control motif.
public static void DrawDisabledMotif()
this Graphics
graphics,
RectangleF
bounds
Draw an ellipse.
Draw an ellipse.
public static void DrawEllipse()
Draw an arc which fades to transparency at both ends.
Draw an arc which fades to a different colour at both ends.
Draw a vertical block with fade-in and fade-out regions.
Draw a line which fades to another colour at both ends.
public static void DrawFadingLine()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Colour in middle of line.
Color
colourTip,
Colour at line extremes.
PointF
p0,
Start point of line.
PointF
p1,
End point of line.
width
Thickness of line.
Draw a line which fades to transparency at both ends.
public static void DrawFadingLine()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Colour in middle of line.
PointF
p0,
Start point of line.
PointF
p1,
End point of line.
width
Thickness of line.
Draw a frame with a title.
Draw a frame with a title.
Draw a frame with a title.
Draw a frame with a title.
public static void DrawFrame()
this Graphics
graphics,
Graphics object to draw with.
Rectangle
rectangle,
Frame rectangle.
Color
colour,
Frame and text colour.
text
Frame text.
Draw a function within a frame.
Draw an image into a circle.
Draw an image into a rectangle.
Draw an inset shadow inside a rectangle, darkest along the specified edge(s) and fading toward the rectangle's interior. The pixel width and peak opacity for each preset are defined in ShadowPixelSize(ShadowSize) and ShadowPixelAlpha(ShadowSize).
public static void DrawInsideShadow()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
area,
Rectangle to draw the shadow inside.
edges,
Which edge(s) of
area are darkest. Combine with bitwise OR.Preset shadow size.
Draw an inset shadow as DrawInsideShadow(Graphics, RectangleF, ShadowEdge, ShadowSize), but faded to the given opacity.
public static void DrawInsideShadow()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
area,
Rectangle to draw the shadow inside.
edges,
Which edge(s) of
area are darkest. Combine with bitwise OR.size,
Preset shadow size.
opacity
Opacity multiplier (0.0 ~ 1.0) applied to the whole shadow.
Draw a list of key-value items.
public static void DrawKeyValueList()
this Graphics
graphics,
Graphics object.
RectangleF
frame,
Frame for items.
Font
fontKey,
Font to use for drawing keys.
Font
fontValue,
Font to use for drawing values.
Color
colourKey,
Colour of keys.
Color
colourValue,
Colour of values.
items
Collection of items.
Draw a line.
Draw a line.
public static void DrawLine()
Draw a line through a box.
Draw a line through a box.
Draw a line through a box.
public static void DrawLineThroughBox()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
box,
Box to include.
Color
colour,
Colour of line.
PointF
point0,
First point on line.
PointF
point1
Second point on line.
Draw a line through a box.
public static void DrawLineThroughBox()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
box,
Box to include.
Pen
pen,
Pen of line.
PointF
point0,
First point on line.
PointF
point1
Second point on line.
Draw a circle and arrow around a target box.
public static void DrawMarker()
this Graphics
graphics,
Graphics object. Ideally this is 1:1 screen scaling, i.e. control graphics.
colour,
Colour of marker shapes.
RectangleF
target,
Target of marker.
RectangleF
framing
Frame bounds. This controls where the pointing arrow is located. Provide the target rectangle again to prevent arrows from being drawn.
Draw a matrix within a rectangle.
Draw a matrix within a rectangle.
public static void DrawMatrix()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to draw with.
Color
colour,
Colour of matrix text and brackets.
RectangleF
frame,
Rectangular frame.
double[][]
matrix
Matrix to draw,
Draw a matrix within a rectangle.
public static void DrawMatrix()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to draw with.
Color
colour,
Colour of matrix text and brackets.
RectangleF
frame,
Rectangular frame.
int[][]
matrix
Matrix to draw,
Draw a matrix within a rectangle.
public static void DrawMatrix()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to draw with.
Color
colour,
Colour of matrix text and brackets.
RectangleF
frame,
Rectangular frame.
string[][]
matrix
Matrix to draw.
Draw a drop shadow outside a rectangle, darkest along the rectangle's perimeter and fading outward. The shadow always wraps the entire rectangle: all four edges plus rounded corners. The pixel width and peak opacity for each preset are defined in ShadowPixelSize(ShadowSize) and ShadowPixelAlpha(ShadowSize).
public static void DrawOutsideShadow()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
area,
Rectangle to draw the shadow around.
Preset shadow size.
Draw a drop shadow as DrawOutsideShadow(Graphics, RectangleF, ShadowSize), but faded to the given opacity.
public static void DrawOutsideShadow()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
area,
Rectangle to draw the shadow around.
size,
Preset shadow size.
opacity
Opacity multiplier (0.0 ~ 1.0) applied to the whole shadow.
Draw an arrow pointing at a location.
public static void DrawPointer()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Colour of pointer.
PointF
target,
Location being pointed at.
size,
Size (length) of pointer in graphics units.
angle,
Angle of pointer in degrees. Angle=0 means the shape is pointing to the right.
offset
Offset distance between target and pointer tip.
Draw an arrow pointing at a location.
Draw ruled paper with custom colours.
public static IEnumerable<GraphicsExtensionMethods.RuledPaperLine> DrawRuledPaper()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
boundary,
Paper boundary.
marginX,
X coordinate of vertical margin.
lineY,
Y coordinate of one of the lines.
lineSpacing,
Vertical spacing between the lines.
Color
marginColour,
The colour of the double margin line.
Color
lineColour
The colour of the horizontal rules.
Draw ruled paper with default colours.
public static IEnumerable<GraphicsExtensionMethods.RuledPaperLine> DrawRuledPaper()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
boundary,
Paper boundary.
marginX,
X coordinate of vertical margin.
lineY,
Y coordinate of one of the lines.
lineSpacing
Vertical spacing between the lines.
Draw ruled paper with custom colours.
public static IEnumerable<GraphicsExtensionMethods.RuledPaperLine> DrawRuledPaper()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
boundary,
Paper boundary.
marginX,
X coordinate of vertical margin.
float[]
lineY,
Y coordinates of all lines.
Color
marginColour,
The colour of the double margin line.
Color
lineColour
The colour of the horizontal rules.
Draw ruled paper with default colours.
public static IEnumerable<GraphicsExtensionMethods.RuledPaperLine> DrawRuledPaper()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
boundary,
Paper boundary.
marginX,
X coordinate of vertical margin.
float[]
lineY
Y coordinates of all lines.
Draw a balloon using the specified colour.
Draw a balloon using the specified skin colours.
Draw a disc using the specified colour.
Draw a disc using the specified skin colours.
Draw a slab using the specified colour.
Draw a slab using the specified skin colours.
Draw a triangle using the specified colour.
Draw a triangle using the specified skin colours.
Draw the background layers of a slab.
Draw the background layers of a slab.
Draw a default balloon label.
Draw a solid balloon around a text, with the tip at the local origin. The balloon is drawn in the current transform and is meant to be placed via a translation to the tip and a scale to control coordinates.
Draw a solid balloon around a text, with the tip at the local origin. The balloon is drawn in the current transform and is meant to be placed via a translation to the tip and a scale to control coordinates.
public static void DrawSolidBalloon()
this Graphics
graphics,
Graphics object to draw with.
text,
Text inside the balloon.
Color
fill,
Solid balloon colour.
Color
textColour
Colour of the text, ought to contrast with the fill.
Draw sunken centered text.
public static void DrawSunkenText()
this Graphics
graphics,
Graphics to draw with.
PointF
centre,
Centre of text.
Font
font,
Font to use.
Color
colour,
Colour of text, should not contain an alpha component.
text
Text to draw.
Draw trimmed and unwrapped text into the vertical centre of a frame.
public static void DrawTextInFrame()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to use.
Brush
colour,
Foreground colour.
text,
Text to draw.
RectangleF
frame,
Bounding frame.
TextAlignment
horizontal
Horizontal alignment.
Draw trimmed and unwrapped text into the vertical centre of a frame.
public static void DrawTextInFrame()
this Graphics
graphics,
Graphics object to draw with.
Font
font,
Font to use.
Color
colour,
Foreground colour.
text,
Text to draw.
RectangleF
frame,
Bounding frame.
TextAlignment
horizontal
Horizontal alignment.
Fill an arc.
public static void FillArc()
Fill an arc.
public static void FillArc()
Draw the shading on a box using custom settings.
Draw the shading on a box using default settings.
public static void FillBox()
Draw the shading on the visible faces of a box using custom colours.
public static void FillBox()
this Graphics
graphics,
Graphics object to draw with.
box,
Box to draw.
Color
front,
Colour of front face.
Color
right,
Colour of right face.
Color
top
Colour of top face.
Draw the shading on the visible faces of a box using custom colours.
public static void FillBox()
this Graphics
graphics,
Graphics object to draw with.
box,
Box to draw.
params Color[]
faceColours
Array of six colours, one for each face. The order is {bottom, left, back, top, right, front}.
Fill a circle.
public static void FillCircle()
Fill a circle.
public static void FillCircle()
Draw the shading of a cylinder.
public static void FillCylinder()
this Graphics
graphics,
cylinder,
Color
cap,
Color
sideLeft,
Color
sideRight,
fromAbove
If true, the top face of the cylinder is assumed to face the viewer.
Draw the shading of a cylinder.
public static void FillCylinder()
this Graphics
graphics,
Graphics object to draw with.
cylinder,
Cylinder.
Color
colour,
Cylinder colour.
fromAbove
If true, the top face of the cylinder is assumed to face the viewer.
Draw the shading of a cylinder.
public static void FillCylinder()
this Graphics
graphics,
cylinder,
Color
colour,
shading,
fromAbove
If true, the top face of the cylinder is assumed to face the viewer.
Fill a diamond.
Fill a diamond.
public static void FillDiamond()
this Graphics
graphics,
Graphics object to draw with.
Brush
brush,
Fill brush.
PointF
centre,
Centre of diamond.
radius
Radius of diamond (centre to corner).
Fill a diamond.
Fill a diamond.
public static void FillDiamond()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Fill colour.
PointF
centre,
Centre of diamond.
radius
Radius of diamond (centre to corner).
Fill an ellipse.
public static void FillEllipse()
Fill an ellipse.
public static void FillEllipse()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Fill colour.
ellipse
Ellipse.
Fill the left half of a circle.
public static void FillLeftSemiCircle()
Fill the left half of a circle.
public static void FillLeftSemiCircle()
Fill a region with a motif pattern.
public static void FillMotif()
this Graphics
graphics,
Graphics object to draw with.
GraphicsPath
region,
Region to fill.
motif
Motif pattern.
Fill a region with a hatch pattern.
public static void FillMotif()
this Graphics
graphics,
Graphics object to draw with.
GraphicsPath
region,
Region to fill.
flavour,
Hatch flavour.
strength,
Hatch strength.
Color
colour
Hatch colour.
Fill a region with a motif pattern.
public static void FillMotif()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
region,
Region to fill.
motif
Motif pattern.
Fill a region with a hatch pattern.
public static void FillMotif()
this Graphics
graphics,
Graphics object to draw with.
RectangleF
region,
Region to fill.
flavour,
Hatch flavour.
strength,
Hatch strength.
Color
colour
Hatch colour.
Fill a diamond.
public static void FillPartialDiamond()
this Graphics
graphics,
Graphics object to draw with.
Brush
brush,
Fill brush.
portion,
Diamond portion to fill.
centre,
Centre of diamond.
radius
Radius of diamond (centre to corner).
Fill a diamond.
public static void FillPartialDiamond()
this Graphics
graphics,
Graphics object to draw with.
Brush
brush,
Fill brush.
portion,
Diamond portion to fill.
PointF
centre,
Centre of diamond.
radius
Radius of diamond (centre to corner).
Fill a diamond.
public static void FillPartialDiamond()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Fill colour.
portion,
Diamond portion to fill.
centre,
Centre of diamond.
radius
Radius of diamond (centre to corner).
Fill a diamond.
public static void FillPartialDiamond()
this Graphics
graphics,
Graphics object to draw with.
Color
colour,
Fill colour.
portion,
Diamond portion to fill.
PointF
centre,
Centre of diamond.
radius
Radius of diamond (centre to corner).
Fill the right half of a circle.
public static void FillRightSemiCircle()
Fill the right half of a circle.
public static void FillRightSemiCircle()
Gets the colour to be used for drawing focus region outlines.
public static Color FocusEdge()
this Graphics
graphics
Gets the colour to be used for filling focus regions.
public static Color FocusFill()
this Graphics
graphics
Gets the colour to be used for drawing hover region outlines.
public static Color HoverEdge()
this Graphics
graphics
Gets the colour to be used for filling hover regions.
public static Color HoverFill()
this Graphics
graphics
Determine the bounds of each character within a string.
Determine the bounds of each character within a string.
public static RectangleF[] MeasureCharacterRanges()
Measure the sizes of each character within a string.
Determine the bounds of each grapheme cluster within a string, laid out left to right from an anchor. Unlike MeasureCharacterRanges(Font, string, PointF) this returns one box per user-perceived character (base + combining marks, whole surrogate pairs), so it aligns with a grapheme-indexed caret.
Determine the bounds of each grapheme cluster within a string, aligned inside a frame. The per-grapheme equivalent of MeasureCharacterRanges(Font, string, RectangleF, TextAlignment).
public static RectangleF[] MeasureGraphemeRanges()