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:
[C#]
NameAtom type = io.Resolve(Atom.GetItem(io.Atom, "Type")) as NameAtom;
[Visual Basic]
Dim type As NameAtom = io.Resolve(Atom.GetItem(io.Atom, "Type"))
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:
[C#]
NumAtom num = io.Resolve(Atom.GetItem(atom, 2)) as NumAtom;
[Visual Basic]
Dim num As NumAtom = io.Resolve(Atom.GetItem(atom, 2))
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):
[C#]
StreamObject stream = io.ResolveObj(Atom.GetItem(io.Atom, "FontFile2")) as StreamObject;
[Visual Basic]
Dim stream As StreamObject = io.ResolveObj(Atom.GetItem(io.Atom, "FontFile2"))
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 maniplate the value:
[C#]
StringAtom str = (StringAtom)Atom.SetItem(io.Atom, "V", new StringAtom());
[Visual Basic]
Dim str As 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:
[C#]
Atom.SetItem(io.Atom, "Border", Atom.FromString("[ 0 0 1 ]"));
[Visual Basic]
Atom.SetItem(io.Atom, "Border", Atom.FromString("[ 0 0 1 ]"))
|