generateRectWithBleedingPixel method
Implementation
Vector2Rect generateRectWithBleedingPixel(
Vector2 position,
double width,
double height, {
double offsetX = 0,
double offsetY = 0,
}) {
double sizeMax = max(width, height);
double blendingPixel = sizeMax * 0.05;
if (blendingPixel > 2) {
blendingPixel = 2;
}
return Rect.fromLTWH(
(position.x * width) -
(position.x % 2 == 0 ? (blendingPixel / 2) : 0) +
offsetX,
(position.y * height) -
(position.y % 2 != 0 ? (blendingPixel / 2) : 0) +
offsetY,
width + (position.x % 2 == 0 ? blendingPixel : 0),
height + (position.y % 2 != 0 ? blendingPixel : 0),
).toVector2Rect();
}