InkDrawingAttributes InkDrawingAttributes InkDrawingAttributes InkDrawingAttributes InkDrawingAttributes Class

Definition

Provides properties associated with the drawing of an InkStroke.

public : sealed class InkDrawingAttributes : IInkDrawingAttributes, IInkDrawingAttributes2, IInkDrawingAttributes3, IInkDrawingAttributes4
struct winrt::Windows::UI::Input::Inking::InkDrawingAttributes : IInkDrawingAttributes, IInkDrawingAttributes2, IInkDrawingAttributes3, IInkDrawingAttributes4
public sealed class InkDrawingAttributes : IInkDrawingAttributes, IInkDrawingAttributes2, IInkDrawingAttributes3, IInkDrawingAttributes4
Public NotInheritable Class InkDrawingAttributes Implements IInkDrawingAttributes, IInkDrawingAttributes2, IInkDrawingAttributes3, IInkDrawingAttributes4
var inkDrawingAttributes = new inkDrawingAttributes();
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

The following example demonstrates how to set a default drawing attribute for all strokes managed by an InkManager object (inkManager).


var inkManager = new Windows.UI.Input.Inking.InkManager();
var drawingAttributes = 
     new Windows.UI.Input.Inking.InkDrawingAttributes();
// True is the Default value for fitToCurve.
drawingAttributes.fitToCurve = false;
// Set color to red (default is black).
drawingAttributes.color = 
     Windows.UI.ColorHelper.fromArgb(255, 255, 0, 0); 
inkManager.setDefaultDrawingAttributes(drawingAttributes);
// Create the InkManager instance.
Windows.UI.Input.Inking.InkManager inkManager = 
  new Windows.UI.Input.Inking.InkManager();
Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes = 
  new Windows.UI.Input.Inking.InkDrawingAttributes();
// True is the Default value for fitToCurve.
drawingAttributes.FitToCurve = false;
// Set color to red (default is black).
drawingAttributes.Color = Windows.UI.Colors.CornflowerBlue;
inkManager.SetDefaultDrawingAttributes(drawingAttributes);

The following example demonstrates how to set a drawing attribute for a specific stroke.

Note

You cannot set the DrawingAttributes property of the stroke directly. You must create a copy of the InkDrawingAttributes of the stroke, set the desired values for that InkDrawingAttributes object, and then assign the new InkDrawingAttributes to the DrawingAttributes of the stroke, as shown here.

inkManager.getStrokes().forEach(function (stroke)
{
  var drawingAttributes = stroke.drawingAttributes;
  drawingAttributes.penTip = 
       Windows.UI.Input.Inking.PenTipShape.rectangle;
  stroke.drawingAttributes = drawingAttributes;
}

// Get the InkStroke objects.
IReadOnlyList<InkStroke> inkStrokes = inkManager.GetStrokes();
Windows.UI.Input.Inking.InkStroke cloneStroke = 
  inkStrokes.GetAt(index).Clone();
Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes = 
  cloneStroke.DrawingAttributes;
drawingAttributes.PenTip = Windows.UI.Input.Inking.PenTipShape.Rectangle;
cloneStroke.DrawingAttributes = drawingAttributes;

For the complete example, see Ink App sample.

Remarks

InkDrawingAttributes can be set globally through the SetDefaultDrawingAttributes method of an InkManager object or an InkStrokeBuilder object. They can also be set on an individual InkStroke object through the DrawingAttributes property.

Note

: This class is not agile, which means that you need to consider its threading model and marshaling behavior. For more info, see Threading and Marshaling (C++/CX) and Using Windows Runtime objects in a multithreaded environment (.NET).

Constructors

InkDrawingAttributes() InkDrawingAttributes() InkDrawingAttributes() InkDrawingAttributes() InkDrawingAttributes()

Creates a new InkDrawingAttributes object that is used to specify InkStroke attributes.

Properties

Color Color Color Color Color

Gets or sets a value that indicates the color of an InkStroke.

DrawAsHighlighter DrawAsHighlighter DrawAsHighlighter DrawAsHighlighter DrawAsHighlighter

Gets or sets a value that indicates whether the InkStroke is rendered as a highlighter overlay. The stroke is typically set to a bright color, such as yellow.

FitToCurve FitToCurve FitToCurve FitToCurve FitToCurve

Gets or sets a value that indicates whether a Bezier curve or a collection of straight line segments is used to draw an InkStroke.

IgnorePressure IgnorePressure IgnorePressure IgnorePressure IgnorePressure

Gets or sets a value that indicates whether the pressure of the contact on the digitizer surface is ignored when you draw an InkStroke.

IgnoreTilt IgnoreTilt IgnoreTilt IgnoreTilt IgnoreTilt

Gets or sets a value that indicates whether the tilt (tiltx, tilty ) of the contact on the digitizer surface is ignored when you draw an InkStroke.

Kind Kind Kind Kind Kind

Gets the InkDrawingAttributes that describe the characteristics of a specific type of InkStroke.

ModelerAttributes ModelerAttributes ModelerAttributes ModelerAttributes ModelerAttributes

Gets an instance of a ModelerAttributes object for accessing modeler properties of an ink stroke.

PencilProperties PencilProperties PencilProperties PencilProperties PencilProperties

Gets an instance of an InkDrawingAttributesPencilProperties object for setting properties characteristic to a pencil stroke.

PenTip PenTip PenTip PenTip PenTip

Gets or sets a value that indicates the shape of the pen tip when you draw an InkStroke.

PenTipTransform PenTipTransform PenTipTransform PenTipTransform PenTipTransform

Gets or sets an affine transformation matrix applied to the PenTipShape used for an InkStroke.

Size Size Size Size Size

Gets or sets a value that indicates the dimensions of the pen tip (PenTip ) used to draw an InkStroke.

Methods

CreateForPencil() CreateForPencil() CreateForPencil() CreateForPencil() CreateForPencil()

Creates an InkDrawingAttributes object for rendering an ink stroke with pencil characteristics.

See Also