// TODO: currently we take only scale into account,
// but depending on joint style, cap style, etc. we need to take
// the whole matrix into account as well as examine every line segment.
if (stroke == null)
{
return new Rect(0, 0, 0 , 0);
}
int xMin, xMax, yMin, yMax;
// Stroke with weight 0 or scaleMode "none" is always drawn
// at "hairline" thickness, which is exactly one pixel.
int lineWidth = ls.getWidth();
if (lineWidth == 0)
{
xMin = (int)StrictMath.rint(-0.5 * TWIPS_PER_PIXEL);
xMax = (int)StrictMath.rint(0.5 * TWIPS_PER_PIXEL);
yMin = (int)StrictMath.rint(-0.5 * TWIPS_PER_PIXEL);
yMax = (int)StrictMath.rint(0.5 * TWIPS_PER_PIXEL);
}
else
{
xMin = (int)StrictMath.rint(-lineWidth * 0.5);
xMax = (int)StrictMath.rint(lineWidth * 0.5);
yMin = (int)StrictMath.rint(-lineWidth * 0.5);
yMax = (int)StrictMath.rint(lineWidth * 0.5);
}
return new Rect(xMin, xMax, yMin, yMax);
}