Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeRasterCanvas

OfficeIMO.Drawing

Namespace
OfficeIMO.Drawing
Assembly
OfficeIMO.Core
Source revision
ba882f6b0d07 with working tree changes
Modifiers
sealed

Dependency-free drawing canvas for an OfficeRasterImage.

Inheritance

  • object
  • OfficeRasterCanvas

Usage

Explore 4 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 4

Constructors

OfficeRasterCanvas 4 overloads
public OfficeRasterCanvas(OfficeRasterImage image, OfficeTrueTypeFont? font = null, OfficeFontFaceCollection? fonts = null) #

Creates a canvas over the supplied image.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
font OfficeIMO.Drawing.OfficeTrueTypeFont? = null optional
fonts OfficeIMO.Drawing.OfficeFontFaceCollection? = null optional
public OfficeRasterCanvas(OfficeRasterImage image, OfficeTrueTypeFont? font, OfficeFontFaceCollection? fonts, IOfficeTextShapingProvider? textShapingProvider = null, string? textShapingLanguage = null, ICollection<OfficeImageExportDiagnostic>? diagnosticSink = null, string? diagnosticSource = null, CancellationToken cancellationToken = default) #

Creates a canvas with complex-text shaping and fidelity diagnostics.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
font OfficeIMO.Drawing.OfficeTrueTypeFont? required
fonts OfficeIMO.Drawing.OfficeFontFaceCollection? required
textShapingProvider OfficeIMO.Drawing.IOfficeTextShapingProvider? = null optional
textShapingLanguage string? = null optional
diagnosticSink System.Collections.Generic.ICollection<OfficeIMO.Drawing.OfficeImageExportDiagnostic>? = null optional
diagnosticSource string? = null optional
cancellationToken System.Threading.CancellationToken = default optional
public OfficeRasterCanvas(OfficeRasterRenderTarget target, OfficeTrueTypeFont? font = null, OfficeFontFaceCollection? fonts = null) #

Creates a canvas over the supplied supersampled render target.

Parameters

target OfficeIMO.Drawing.OfficeRasterRenderTarget required
font OfficeIMO.Drawing.OfficeTrueTypeFont? = null optional
fonts OfficeIMO.Drawing.OfficeFontFaceCollection? = null optional
public OfficeRasterCanvas(OfficeRasterRenderTarget target, OfficeTrueTypeFont? font, OfficeFontFaceCollection? fonts, IOfficeTextShapingProvider? textShapingProvider = null, string? textShapingLanguage = null, ICollection<OfficeImageExportDiagnostic>? diagnosticSink = null, string? diagnosticSource = null, CancellationToken cancellationToken = default) #

Creates a supersampled canvas with complex-text shaping and fidelity diagnostics.

Parameters

target OfficeIMO.Drawing.OfficeRasterRenderTarget required
font OfficeIMO.Drawing.OfficeTrueTypeFont? required
fonts OfficeIMO.Drawing.OfficeFontFaceCollection? required
textShapingProvider OfficeIMO.Drawing.IOfficeTextShapingProvider? = null optional
textShapingLanguage string? = null optional
diagnosticSink System.Collections.Generic.ICollection<OfficeIMO.Drawing.OfficeImageExportDiagnostic>? = null optional
diagnosticSource string? = null optional
cancellationToken System.Threading.CancellationToken = default optional

Methods

DrawAffineImage 2 overloads
public void DrawAffineImage(OfficeRasterImage image, OfficeTransform transform, double opacity, OfficeBlendMode blendMode) #

Draws an affine image with managed opacity and blend-mode compositing.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
transform OfficeIMO.Drawing.OfficeTransform required
opacity double required
blendMode OfficeIMO.Drawing.OfficeBlendMode required
public void DrawAffineImage(OfficeRasterImage image, OfficeTransform transform, double opacity = 1) #

Draws an image through an arbitrary destination-space affine transform, snapshotting a canvas-image source.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
transform OfficeIMO.Drawing.OfficeTransform required
opacity double = 1 optional
public void DrawArc(double centerX, double centerY, double radiusX, double radiusY, double startDegrees, double endDegrees, OfficeColor color, double thickness = 1, double rotationDegrees = 0, double rotationCenterX = 0, double rotationCenterY = 0) #

Draws an elliptical arc using center/radius coordinates and optional rotation.

Parameters

centerX double required
centerY double required
radiusX double required
radiusY double required
startDegrees double required
endDegrees double required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
rotationDegrees double = 0 optional
rotationCenterX double = 0 optional
rotationCenterY double = 0 optional
public void DrawDashedEllipse(double centerX, double centerY, double radiusX, double radiusY, OfficeColor color, double thickness = 1, double dashLength = 6, double gapLength = 4, double rotationDegrees = 0, double rotationCenterX = 0, double rotationCenterY = 0, int segments = 72, bool resetDashPatternForEachSegment = false) #

Draws a dashed elliptical outline using center/radius coordinates and optional rotation.

Parameters

centerX double required
Ellipse center X coordinate.
centerY double required
Ellipse center Y coordinate.
radiusX double required
Horizontal ellipse radius.
radiusY double required
Vertical ellipse radius.
color OfficeIMO.OfficeColor required
Stroke color.
thickness double = 1 optional
Stroke thickness in canvas pixels.
dashLength double = 6 optional
Visible dash length in canvas pixels.
gapLength double = 4 optional
Transparent gap length in canvas pixels.
rotationDegrees double = 0 optional
Clockwise rotation in degrees.
rotationCenterX double = 0 optional
Rotation center X coordinate.
rotationCenterY double = 0 optional
Rotation center Y coordinate.
segments int = 72 optional
Number of line segments used to approximate the ellipse.
resetDashPatternForEachSegment bool = false optional
Whether the dash pattern should restart for every approximation segment.
public void DrawDashedLine(double x1, double y1, double x2, double y2, OfficeColor color, double thickness = 1, double dashLength = 6, double gapLength = 4) #

Draws a dashed line segment.

Parameters

x1 double required
y1 double required
x2 double required
y2 double required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
dashLength double = 6 optional
gapLength double = 4 optional
DrawDashedPolyline 2 overloads
public void DrawDashedPolyline(IReadOnlyList<ValueTuple<double, double>> points, OfficeColor color, double thickness = 1, double dashLength = 6, double gapLength = 4, bool resetDashPatternForEachSegment = false) #

Draws a dashed polyline through tuple points.

Parameters

points System.Collections.Generic.IReadOnlyList<System.ValueTuple<double, double>> required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
dashLength double = 6 optional
gapLength double = 4 optional
resetDashPatternForEachSegment bool = false optional
public void DrawDashedPolyline(IReadOnlyList<OfficePoint> points, OfficeColor color, double thickness = 1, double dashLength = 6, double gapLength = 4, bool resetDashPatternForEachSegment = false) #

Draws a dashed polyline through the supplied points.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
Polyline points in canvas coordinates.
color OfficeIMO.OfficeColor required
Stroke color.
thickness double = 1 optional
Stroke thickness in canvas pixels.
dashLength double = 6 optional
Visible dash length in canvas pixels.
gapLength double = 4 optional
Transparent gap length in canvas pixels.
resetDashPatternForEachSegment bool = false optional
Whether the dash pattern should restart for every segment.
DrawEllipse 2 overloads
public void DrawEllipse(double x, double y, double width, double height, OfficeColor color, double thickness = 1) #

Draws an ellipse outline bounded by the supplied rectangle.

Parameters

x double required
y double required
width double required
height double required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
public void DrawEllipse(double centerX, double centerY, double radiusX, double radiusY, OfficeColor fill, OfficeColor stroke, double thickness = 1, double rotationDegrees = 0, double rotationCenterX = 0, double rotationCenterY = 0) #

Draws a filled and/or stroked ellipse using center/radius coordinates and optional rotation.

Parameters

centerX double required
centerY double required
radiusX double required
radiusY double required
fill OfficeIMO.OfficeColor required
stroke OfficeIMO.OfficeColor required
thickness double = 1 optional
rotationDegrees double = 0 optional
rotationCenterX double = 0 optional
rotationCenterY double = 0 optional
public void DrawHatchPatternRectangle(double x, double y, double width, double height, OfficeColor color, double step, double lineWidth, OfficeHatchPatternKind pattern) #

Draws a shared hatch pattern over the supplied rectangle.

Parameters

x double required
y double required
width double required
height double required
color OfficeIMO.OfficeColor required
step double required
lineWidth double required
pattern OfficeIMO.Drawing.OfficeHatchPatternKind required
DrawImage 7 overloads
public void DrawImage(OfficeRasterImage image, double x, double y, double width, double height) #

Draws an image scaled into the supplied rectangle, snapshotting it when it is also the canvas image.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
x double required
y double required
width double required
height double required
public void DrawImage(OfficeRasterImage image, OfficeImageProjection projection) #

Draws an image using a shared projection that carries placement, source crop, rotation, and flips.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
Image to draw.
projection OfficeIMO.Drawing.OfficeImageProjection required
Shared image projection.
public void DrawImage(OfficeRasterImage image, OfficeImageProjection projection, bool interpolate) #

Draws an image using a shared projection and the requested sampling behavior.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
projection OfficeIMO.Drawing.OfficeImageProjection required
interpolate bool required
public void DrawImage(OfficeRasterImage image, double x, double y, double width, double height, double sourceLeft, double sourceTop, double sourceWidth, double sourceHeight) #

Draws a source rectangle from an image scaled into the supplied destination rectangle. Source coordinates are normalized, where 0 is the left/top edge and 1 is the right/bottom edge.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
x double required
y double required
width double required
height double required
sourceLeft double required
sourceTop double required
sourceWidth double required
sourceHeight double required
public void DrawImage(OfficeRasterImage image, double x, double y, double width, double height, double rotationDegrees, double rotationCenterX, double rotationCenterY) #

Draws an image scaled and rotated around the supplied rotation center.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
x double required
y double required
width double required
height double required
rotationDegrees double required
rotationCenterX double required
rotationCenterY double required
public void DrawImage(OfficeRasterImage image, double x, double y, double width, double height, double sourceLeft, double sourceTop, double sourceWidth, double sourceHeight, double rotationDegrees, double rotationCenterX, double rotationCenterY, bool flipHorizontal, bool flipVertical) #

Draws a source rectangle from an image into the supplied destination rectangle with optional rotation and flips. Source coordinates are normalized, where 0 is the left/top edge and 1 is the right/bottom edge.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
x double required
y double required
width double required
height double required
sourceLeft double required
sourceTop double required
sourceWidth double required
sourceHeight double required
rotationDegrees double required
rotationCenterX double required
rotationCenterY double required
flipHorizontal bool required
flipVertical bool required
public void DrawImage(OfficeRasterImage image, double x, double y, double width, double height, double sourceLeft, double sourceTop, double sourceWidth, double sourceHeight, double rotationDegrees, double rotationCenterX, double rotationCenterY, bool flipHorizontal, bool flipVertical, bool interpolate) #

Draws a transformed image with explicit scaling interpolation behavior.

Parameters

image OfficeIMO.Drawing.OfficeRasterImage required
x double required
y double required
width double required
height double required
sourceLeft double required
sourceTop double required
sourceWidth double required
sourceHeight double required
rotationDegrees double required
rotationCenterX double required
rotationCenterY double required
flipHorizontal bool required
flipVertical bool required
interpolate bool required
public void DrawLine(double x1, double y1, double x2, double y2, OfficeColor color, double thickness = 1) #

Draws a line segment.

Parameters

x1 double required
y1 double required
x2 double required
y2 double required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
public void DrawParallelStyledLine(double x1, double y1, double x2, double y2, OfficeColor color, double thickness, double separation, OfficeStrokeDashStyle dashStyle = Solid) #

Draws two parallel line segments using a shared Office stroke dash style.

Parameters

x1 double required
Source line start X coordinate.
y1 double required
Source line start Y coordinate.
x2 double required
Source line end X coordinate.
y2 double required
Source line end Y coordinate.
color OfficeIMO.OfficeColor required
Stroke color.
thickness double required
Stroke thickness.
separation double required
Distance between the two parallel line centers.
dashStyle OfficeIMO.Drawing.OfficeStrokeDashStyle = Solid optional
Stroke dash style.
public void DrawPatternedEllipse(double centerX, double centerY, double radiusX, double radiusY, OfficeColor color, double thickness, IReadOnlyList<double>? dashPattern, double rotationDegrees = 0, double rotationCenterX = 0, double rotationCenterY = 0, int segments = 72) #

Draws an elliptical outline using an alternating dash and gap pattern.

Parameters

centerX double required
Ellipse center X coordinate.
centerY double required
Ellipse center Y coordinate.
radiusX double required
Horizontal ellipse radius.
radiusY double required
Vertical ellipse radius.
color OfficeIMO.OfficeColor required
Stroke color.
thickness double required
Stroke thickness in canvas pixels.
dashPattern System.Collections.Generic.IReadOnlyList<double>? required
Alternating dash and gap lengths in canvas pixels.
rotationDegrees double = 0 optional
Clockwise rotation in degrees.
rotationCenterX double = 0 optional
Rotation center X coordinate.
rotationCenterY double = 0 optional
Rotation center Y coordinate.
segments int = 72 optional
Number of line segments used to approximate the ellipse.
public void DrawPatternedLine(double x1, double y1, double x2, double y2, OfficeColor color, double thickness, IReadOnlyList<double>? dashPattern) #

Draws a line segment using an alternating dash and gap pattern.

Parameters

x1 double required
y1 double required
x2 double required
y2 double required
color OfficeIMO.OfficeColor required
thickness double required
dashPattern System.Collections.Generic.IReadOnlyList<double>? required
DrawPatternedPolyline 2 overloads
public void DrawPatternedPolyline(IReadOnlyList<ValueTuple<double, double>> points, OfficeColor color, double thickness, IReadOnlyList<double>? dashPattern, bool resetDashPatternForEachSegment = false, double dashOffset = 0) #

Draws connected line segments through tuple points using an alternating dash and gap pattern.

Parameters

points System.Collections.Generic.IReadOnlyList<System.ValueTuple<double, double>> required
color OfficeIMO.OfficeColor required
thickness double required
dashPattern System.Collections.Generic.IReadOnlyList<double>? required
resetDashPatternForEachSegment bool = false optional
dashOffset double = 0 optional
public void DrawPatternedPolyline(IReadOnlyList<OfficePoint> points, OfficeColor color, double thickness, IReadOnlyList<double>? dashPattern, bool resetDashPatternForEachSegment = false, double dashOffset = 0) #

Draws connected line segments through the supplied points using an alternating dash and gap pattern.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
Polyline points in canvas coordinates.
color OfficeIMO.OfficeColor required
Stroke color.
thickness double required
Stroke thickness in canvas pixels.
dashPattern System.Collections.Generic.IReadOnlyList<double>? required
Alternating dash and gap lengths in canvas pixels.
resetDashPatternForEachSegment bool = false optional
Whether the dash pattern should restart for every segment.
dashOffset double = 0 optional
Distance into the dash pattern at which stroking begins.
public void DrawPolygon(IReadOnlyList<OfficePoint> points, OfficeColor color, double thickness = 1) #

Strokes a polygon outline.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
DrawPolyline 2 overloads
public void DrawPolyline(IReadOnlyList<ValueTuple<double, double>> points, OfficeColor color, double thickness = 1) #

Draws connected line segments through tuple points in canvas coordinates.

Parameters

points System.Collections.Generic.IReadOnlyList<System.ValueTuple<double, double>> required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
public void DrawPolyline(IReadOnlyList<OfficePoint> points, OfficeColor color, double thickness = 1) #

Draws connected line segments through the supplied points.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
Polyline points in canvas coordinates.
color OfficeIMO.OfficeColor required
Stroke color.
thickness double = 1 optional
Stroke thickness in canvas pixels.
public void DrawRectangle(double x, double y, double width, double height, OfficeColor color, double thickness = 1) #

Draws a rectangle outline.

Parameters

x double required
y double required
width double required
height double required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
public void DrawStyledEllipse(double centerX, double centerY, double radiusX, double radiusY, OfficeColor fill, OfficeColor stroke, double thickness = 1, OfficeStrokeDashStyle dashStyle = Solid, double rotationDegrees = 0, double rotationCenterX = 0, double rotationCenterY = 0, int segments = 72) #

Draws a filled and/or stroked ellipse using a shared Office stroke dash style.

Parameters

centerX double required
Ellipse center X coordinate.
centerY double required
Ellipse center Y coordinate.
radiusX double required
Horizontal ellipse radius.
radiusY double required
Vertical ellipse radius.
fill OfficeIMO.OfficeColor required
Fill color.
stroke OfficeIMO.OfficeColor required
Stroke color.
thickness double = 1 optional
Stroke thickness in canvas pixels.
dashStyle OfficeIMO.Drawing.OfficeStrokeDashStyle = Solid optional
Shared Office stroke dash style.
rotationDegrees double = 0 optional
Clockwise rotation in degrees.
rotationCenterX double = 0 optional
Rotation center X coordinate.
rotationCenterY double = 0 optional
Rotation center Y coordinate.
segments int = 72 optional
Number of line segments used to approximate dashed outlines.
public void DrawStyledLine(double x1, double y1, double x2, double y2, OfficeColor color, double thickness = 1, OfficeStrokeDashStyle dashStyle = Solid) #

Draws a line segment using a shared Office stroke dash style.

Parameters

x1 double required
y1 double required
x2 double required
y2 double required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
dashStyle OfficeIMO.Drawing.OfficeStrokeDashStyle = Solid optional
DrawStyledPolygon 2 overloads
public void DrawStyledPolygon(IReadOnlyList<ValueTuple<double, double>> points, OfficeColor color, double thickness = 1, OfficeStrokeDashStyle dashStyle = Solid, bool resetDashPatternForEachSegment = false) #

Strokes a polygon outline through tuple points using a shared Office stroke dash style.

Parameters

points System.Collections.Generic.IReadOnlyList<System.ValueTuple<double, double>> required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
dashStyle OfficeIMO.Drawing.OfficeStrokeDashStyle = Solid optional
resetDashPatternForEachSegment bool = false optional
public void DrawStyledPolygon(IReadOnlyList<OfficePoint> points, OfficeColor color, double thickness = 1, OfficeStrokeDashStyle dashStyle = Solid, bool resetDashPatternForEachSegment = false) #

Strokes a polygon outline through points using a shared Office stroke dash style.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
dashStyle OfficeIMO.Drawing.OfficeStrokeDashStyle = Solid optional
resetDashPatternForEachSegment bool = false optional
DrawStyledPolyline 2 overloads
public void DrawStyledPolyline(IReadOnlyList<ValueTuple<double, double>> points, OfficeColor color, double thickness = 1, OfficeStrokeDashStyle dashStyle = Solid, bool resetDashPatternForEachSegment = false) #

Draws connected line segments through tuple points using a shared Office stroke dash style.

Parameters

points System.Collections.Generic.IReadOnlyList<System.ValueTuple<double, double>> required
color OfficeIMO.OfficeColor required
thickness double = 1 optional
dashStyle OfficeIMO.Drawing.OfficeStrokeDashStyle = Solid optional
resetDashPatternForEachSegment bool = false optional
public void DrawStyledPolyline(IReadOnlyList<OfficePoint> points, OfficeColor color, double thickness = 1, OfficeStrokeDashStyle dashStyle = Solid, bool resetDashPatternForEachSegment = false) #

Draws connected line segments through the supplied points using a shared Office stroke dash style.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
Polyline points in canvas coordinates.
color OfficeIMO.OfficeColor required
Stroke color.
thickness double = 1 optional
Stroke thickness in canvas pixels.
dashStyle OfficeIMO.Drawing.OfficeStrokeDashStyle = Solid optional
Shared Office stroke dash style.
resetDashPatternForEachSegment bool = false optional
Whether the dash pattern should restart for every segment.
DrawText 2 overloads
public void DrawText(string? text, double x, double y, double width, double height, OfficeColor color, OfficeFontInfo font, OfficeTextAlignment alignment = Left) #

Draws text using the font's numeric face attributes and text decorations.

Parameters

text string? required
x double required
y double required
width double required
height double required
color OfficeIMO.OfficeColor required
font OfficeIMO.Drawing.OfficeFontInfo required
alignment OfficeIMO.Drawing.OfficeTextAlignment = Left optional
public void DrawText(string? text, double x, double y, double width, double height, OfficeColor color, double fontSize = 12, OfficeTextAlignment alignment = Left, OfficeFontStyle style = Regular, string? fontFamily = null) #

Draws text inside a rectangle using a managed TrueType font when available.

Parameters

text string? required
x double required
y double required
width double required
height double required
color OfficeIMO.OfficeColor required
fontSize double = 12 optional
alignment OfficeIMO.Drawing.OfficeTextAlignment = Left optional
style OfficeIMO.Drawing.OfficeFontStyle = Regular optional
fontFamily string? = null optional
DrawTextLine 2 overloads
public void DrawTextLine(string? text, double anchorX, double top, double height, OfficeColor color, bool bold = false, bool italic = false, OfficeTextAlignment alignment = Center, double rotationDegrees = 0, double rotationCenterX = 0, double rotationCenterY = 0, bool underline = false, bool strikethrough = false, string? fontFamily = null, bool flipHorizontal = false, bool flipVertical = false) #

Draws a single anchored text line with optional bold, italic, alignment, and rotation.

Parameters

text string? required
Text to render.
anchorX double required
Horizontal anchor. Left, center, or right interpretation depends on alignment.
top double required
Top coordinate of the text line box.
height double required
Text line height in canvas pixels.
color OfficeIMO.OfficeColor required
Text color.
bold bool = false optional
Whether to simulate bold rendering.
italic bool = false optional
Whether to simulate italic rendering.
alignment OfficeIMO.Drawing.OfficeTextAlignment = Center optional
Horizontal alignment relative to anchorX.
rotationDegrees double = 0 optional
Clockwise rotation in degrees.
rotationCenterX double = 0 optional
Rotation center X coordinate.
rotationCenterY double = 0 optional
Rotation center Y coordinate.
underline bool = false optional
Whether to draw an underline using the measured text width.
strikethrough bool = false optional
Whether to draw a strikethrough using the measured text width.
fontFamily string? = null optional
Requested font family fallback list.
flipHorizontal bool = false optional
Whether to mirror the rendered line horizontally around the rotation center before rotation.
flipVertical bool = false optional
Whether to mirror the rendered line vertically around the rotation center before rotation.
public void DrawTextLine(string? text, double anchorX, double top, double height, OfficeColor color, bool bold, bool italic, OfficeTextAlignment alignment, double rotationDegrees, double rotationCenterX, double rotationCenterY, bool underline, bool strikethrough, string? fontFamily, bool flipHorizontal, bool flipVertical, OfficeTextDecorationStyle underlineStyle, OfficeTextDecorationStyle strikethroughStyle, OfficeColor? decorationColor = null) #

Draws a single anchored text line with independent underline and strikethrough patterns.

Parameters

text string? required
Text to render.
anchorX double required
Horizontal anchor. Left, center, or right interpretation depends on alignment.
top double required
Top coordinate of the text line box.
height double required
Text line height in canvas pixels.
color OfficeIMO.OfficeColor required
Text color.
bold bool required
Whether to simulate bold rendering.
italic bool required
Whether to simulate italic rendering.
alignment OfficeIMO.Drawing.OfficeTextAlignment required
Horizontal alignment relative to anchorX.
rotationDegrees double required
Clockwise rotation in degrees.
rotationCenterX double required
Rotation center X coordinate.
rotationCenterY double required
Rotation center Y coordinate.
underline bool required
Whether to draw an underline using the measured text width.
strikethrough bool required
Whether to draw a strikethrough using the measured text width.
fontFamily string? required
Requested font family fallback list.
flipHorizontal bool required
Whether to mirror the rendered line horizontally around the rotation center before rotation.
flipVertical bool required
Whether to mirror the rendered line vertically around the rotation center before rotation.
underlineStyle OfficeIMO.Drawing.OfficeTextDecorationStyle required
Underline pattern. A non-none value takes precedence over underline.
strikethroughStyle OfficeIMO.Drawing.OfficeTextDecorationStyle required
Strikethrough pattern. A non-none value takes precedence over strikethrough.
decorationColor OfficeIMO.OfficeColor? = null optional
Optional underline and strikethrough color. Null uses color.
public void DrawTextLineTransformed(string? text, double anchorX, double top, double height, OfficeColor color, OfficeTransform transform, bool bold = false, bool italic = false, OfficeTextAlignment alignment = Center, bool underline = false, bool strikethrough = false, string? fontFamily = null) #

Draws a single text line through an arbitrary affine transform.

Parameters

text string? required
Text to draw.
anchorX double required
Untransformed text anchor X coordinate.
top double required
Untransformed top coordinate.
height double required
Untransformed text height.
color OfficeIMO.OfficeColor required
Text fill color.
transform OfficeIMO.Drawing.OfficeTransform required
Affine transform applied to text contours.
bold bool = false optional
Whether to draw a bold approximation.
italic bool = false optional
Whether to skew text contours before applying the transform.
alignment OfficeIMO.Drawing.OfficeTextAlignment = Center optional
Anchor alignment.
underline bool = false optional
Whether to draw an underline.
strikethrough bool = false optional
Whether to draw a strikethrough.
fontFamily string? = null optional
Requested font family fallback list.
public void FillEllipse(double x, double y, double width, double height, OfficeColor color) #

Fills an ellipse bounded by the supplied rectangle.

Parameters

x double required
y double required
width double required
height double required
color OfficeIMO.OfficeColor required
public void FillLinearGradientPolygon(IReadOnlyList<OfficePoint> points, OfficeLinearGradient gradient) #

Fills a polygon with a linear gradient fitted to the polygon bounds.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
gradient OfficeIMO.Drawing.OfficeLinearGradient required
public void FillLinearGradientRectangle(double x, double y, double width, double height, OfficeLinearGradient gradient) #

Fills a rectangle with a linear gradient.

Parameters

x double required
y double required
width double required
height double required
gradient OfficeIMO.Drawing.OfficeLinearGradient required
FillPolygon 2 overloads
public void FillPolygon(IReadOnlyList<OfficePoint> points, OfficeColor color) #

Fills a polygon.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
color OfficeIMO.OfficeColor required
public void FillPolygon(IReadOnlyList<ValueTuple<double, double>> points, OfficeColor color) #

Fills a polygon described by tuple points.

Parameters

points System.Collections.Generic.IReadOnlyList<System.ValueTuple<double, double>> required
color OfficeIMO.OfficeColor required
FillPolygonsEvenOdd 2 overloads
public void FillPolygonsEvenOdd(IReadOnlyList<IReadOnlyList<OfficePoint>> contours, OfficeColor color) #

Fills multiple polygon contours using the even-odd fill rule.

Parameters

contours System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint>> required
color OfficeIMO.OfficeColor required
public void FillPolygonsEvenOdd(IReadOnlyList<IReadOnlyList<ValueTuple<double, double>>> contours, OfficeColor color) #

Fills multiple tuple-point polygon contours using the even-odd fill rule.

Parameters

contours System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IReadOnlyList<System.ValueTuple<double, double>>> required
color OfficeIMO.OfficeColor required
public void FillPolygonsNonZero(IReadOnlyList<IReadOnlyList<OfficePoint>> contours, OfficeColor color) #

Fills multiple polygon contours using the non-zero winding fill rule.

Parameters

contours System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint>> required
color OfficeIMO.OfficeColor required
public void FillRadialGradientPolygon(IReadOnlyList<OfficePoint> points, OfficeRadialGradient gradient) #

Fills a polygon with a radial gradient.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
gradient OfficeIMO.Drawing.OfficeRadialGradient required
public void FillRadialGradientRectangle(double x, double y, double width, double height, OfficeRadialGradient gradient) #

Fills a rectangle with a radial gradient.

Parameters

x double required
y double required
width double required
height double required
gradient OfficeIMO.Drawing.OfficeRadialGradient required
public void FillRectangle(double x, double y, double width, double height, OfficeColor color) #

Fills a rectangle.

Parameters

x double required
y double required
width double required
height double required
color OfficeIMO.OfficeColor required
MeasureText 4 overloads
public double MeasureText(string? text, OfficeFontInfo font) #

Measures text using exact face attributes and the same fallback plan as painting.

Parameters

text string? required
font OfficeIMO.Drawing.OfficeFontInfo required

Returns

double
public double MeasureText(string? text, double fontSize = 12) #

Measures text width with the managed font fallback used by this canvas.

Parameters

text string? required
fontSize double = 12 optional

Returns

double
public double MeasureText(string? text, double fontSize, string? fontFamily) #

Measures text width with the requested font family when it can be resolved without platform font APIs.

Parameters

text string? required
fontSize double required
fontFamily string? required

Returns

double
public double MeasureText(string? text, double fontSize, string? fontFamily, OfficeFontStyle style) #

Measures text width with a requested family and bold/italic scoped face when available.

Parameters

text string? required
fontSize double required
fontFamily string? required
style OfficeIMO.Drawing.OfficeFontStyle required

Returns

double
public IDisposable PushClipPolygon(IReadOnlyList<OfficePoint> points) #

Restricts subsequent raster drawing to the supplied polygon until the returned scope is disposed. Nested clips are intersected with the current clip.

Parameters

points System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint> required
Polygon points in canvas coordinates.

Returns

IDisposable A disposable scope that restores the previous clip.
public IDisposable PushClipPolygonsEvenOdd(IReadOnlyList<IReadOnlyList<OfficePoint>> contours) #

Restricts subsequent raster drawing to the supplied even-odd contours until the returned scope is disposed. Nested clips are intersected with the current clip.

Parameters

contours System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint>> required
Closed contours in canvas coordinates.

Returns

IDisposable A disposable scope that restores the previous clip.
public IDisposable PushClipPolygonsNonZero(IReadOnlyList<IReadOnlyList<OfficePoint>> contours) #

Restricts subsequent raster drawing to the supplied non-zero winding contours until the returned scope is disposed. Nested clips are intersected with the current clip.

Parameters

contours System.Collections.Generic.IReadOnlyList<System.Collections.Generic.IReadOnlyList<OfficeIMO.Drawing.OfficePoint>> required
Closed contours in canvas coordinates.

Returns

IDisposable A disposable scope that restores the previous clip.
public IDisposable PushClipRectangle(double x, double y, double width, double height) #

Restricts subsequent raster drawing to the supplied rectangular bounds until the returned scope is disposed. Nested clips are intersected with the current clip.

Parameters

x double required
Left edge of the clipping rectangle.
y double required
Top edge of the clipping rectangle.
width double required
Width of the clipping rectangle.
height double required
Height of the clipping rectangle.

Returns

IDisposable A disposable scope that restores the previous clip.

Properties

public int Width { get; } #

Canvas width in pixels.

public int Height { get; } #

Canvas height in pixels.