generateRectWithBleedingPixel method

Vector2Rect generateRectWithBleedingPixel(
  1. Vector2 position,
  2. double width,
  3. double height
)

Implementation

Vector2Rect generateRectWithBleedingPixel(
  Vector2 position,
  double width,
  double height,
) {
  double bleendingPixel = (width > height ? width : height) * 0.03;
  if (bleendingPixel > 2) {
    bleendingPixel = 2;
  }
  return Vector2Rect.fromRect(
    Rect.fromLTWH(
      position.x - (position.x % 2 == 0 ? (bleendingPixel / 2) : 0),
      position.y - (position.y % 2 == 0 ? (bleendingPixel / 2) : 0),
      width + (position.x % 2 == 0 ? bleendingPixel : 0),
      height + (position.y % 2 == 0 ? bleendingPixel : 0),
    ),
  );
}