How do I localize a change in the graphics state to a single Element?

Q: We are using PDFNet SDK for some PDF content editing (mainly text/
path recoloring etc). As a starting point I used ElementEdit sample
project (http://www.pdftron.com/net/samplecode.html#ElementEdit).

A curious thing that we have observed is that when an attribute is
modified in the grapohics state it affects not just one particular
element but a block of elements. What is the reason for this and how
can I apply the change to a single element?
---------
A: Changing anything in the graphics state will affect subsequent
content. In case you would that a specific change in the graphics
state affects only a given element you should surround the element
with e_group_begin/e_group_end. These elements correspond to 'q' and
'Q' page description operators in PDF. For example:

// Save the graphics state
writer.WriteElement(builder.CreateGroupBegin());

element.GetGState().SetFillColorSpace(ColorSpace.CreateDeviceRGB());
element.GetGState().SetFillColor(new ColorPt(0, 0, 0));
writer.WriteElement(element);

// Restore the graphics state
writer.WriteElement(builder.CreateGroupEnd());

A shorter way to accomplish the same effect is to use
writer.WritePlacedElement(element) :

element.GetGState().SetFillColorSpace(ColorSpace.CreateDeviceRGB());
element.GetGState().SetFillColor(new ColorPt(0, 0, 0));
writer.WriteElement(element);