grid: to prevent possible index out of bounds errors.
agg2d: DoSetTextColor() mistakenly ignored the Alpha channel value.