public static Image GetImage(Properties attributes) {
String value;
value = attributes[ElementTags.URL];
if (value == null)
throw new ArgumentException("The URL of the image is missing.");
Image image = Image.GetInstance(value);
value = attributes[ElementTags.ALIGN];
int align = 0;
if (value != null) {
if (Util.EqualsIgnoreCase(ElementTags.ALIGN_LEFT, value))
align |= Image.ALIGN_LEFT;
else if (Util.EqualsIgnoreCase(ElementTags.ALIGN_RIGHT, value))
align |= Image.ALIGN_RIGHT;
else if (Util.EqualsIgnoreCase(ElementTags.ALIGN_MIDDLE, value))
align |= Image.ALIGN_MIDDLE;
}
if (Util.EqualsIgnoreCase("true", attributes[ElementTags.UNDERLYING]))
align |= Image.UNDERLYING;
if (Util.EqualsIgnoreCase("true", attributes[ElementTags.TEXTWRAP]))
align |= Image.TEXTWRAP;
image.Alignment = align;
value = attributes[ElementTags.ALT];
if (value != null) {
image.Alt = value;
}
String x = attributes[ElementTags.ABSOLUTEX];
String y = attributes[ElementTags.ABSOLUTEY];
if ((x != null) && (y != null)) {
image.SetAbsolutePosition(float.Parse(x, System.Globalization.NumberFormatInfo.InvariantInfo),
float.Parse(y, System.Globalization.NumberFormatInfo.InvariantInfo));
}
value = attributes[ElementTags.PLAINWIDTH];
if (value != null) {
image.ScaleAbsoluteWidth(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
}
value = attributes[ElementTags.PLAINHEIGHT];
if (value != null) {
image.ScaleAbsoluteHeight(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
}
value = attributes[ElementTags.ROTATION];
if (value != null) {
image.Rotation = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
return image;
}