How do I set the blend mode of an Ink annotation

Q:

I am trying to set the blend mode of the path of an ink annotation but cannot find any methods that allow me to do this.I am using PDFViewCtrl for WinRT.

Is there a way I can change the behaviour of the path so that it is not additive ? I have achieved this our canvas by setting to Darken?

A:

To change the blend mode you will need to modify the appearance stream. In the FreehandCreate.cs file, in the Finish method, you would add the following code. See ElementEdit sample for the basis of the code below.

ink.RefreshAppearance(); // start with this existing line of code in Finish() method...

Obj appObj = ink.GetAppearance()
ElementReader reader = new ElementReader()
ElementWriter writer = new ElementWriter()
reader.Begin(appObj)
writer.Begin(appObj, true);
Element element;
while ((element = reader.Next()) != null))

{
	if(Element.Type.e_path == element.GetType())
	{
		GState gs = element.GetGState();
		gs.SetBlendMode(x);
	}
	writer.WriteElement(element);
}
reader.End();
writer.End();
ink.SetAppearance(appObj);

An alternative to the above, is to instead of editing the existing path elements, is to wrap all the existing elements, in a ElementBuilder.CreateGroup[Begin|End] and set the group blend mode. Essentially the same code above, but with the if(e_path) conditional removed.