making PaintAttributes Externalizable rather than just Serializable.
Also, added auxiliary functions to handle the serialization.