|
Common Operations.
Get a named property from the dictionary of an IndirectObject.
In the example below we use the Type property which is typically a
name but the principles are similar for other entries of other
types:
NameAtom type = io.Resolve(Atom.GetItem(io.Atom, "Type")) as NameAtom;
Get an value out of an array atom. In the the event that the
atom is not an array or does not have sufficient entries then the
return value will be null. In the example below we are looking for
entry two - this is the third entry since entries are zero
based:
NumAtom num = io.Resolve(Atom.GetItem(atom, 2)) as NumAtom;
Get a stream referenced from a property of an IndirectObject. In
the example below we use the FontFile2 property (a reference to an
embedded TrueType font):
StreamObject stream = io.ResolveObj(Atom.GetItem(io.Atom, "FontFile2")) as StreamObject;
Add a named entry to an IndirectObject. In the example below we
add a V entry which is a string. We keep the returned StringAtom so
we can manipulate the value:
StringAtom str = (StringAtom)Atom.SetItem(io.Atom, "V", new StringAtom());
Add a named entry to an IndirectObject. In the example below we
add an array entry to specify a border array. Rather than creating
an ArrayAtom and specifying the individual values we just specify
the raw string value of the object:
Atom.SetItem(io.Atom, "Border", Atom.FromString("[ 0 0 1 ]"));
|