generateRectWithBleedingPixel method

void generateRectWithBleedingPixel(
  1. Vector2 position,
  2. Vector2 size
)

Implementation

void generateRectWithBleedingPixel(
  Vector2 position,
  Vector2 size,
) {
  double bleendingPixel = max(size.x, size.y) * 0.03;
  if (bleendingPixel > 2) {
    bleendingPixel = 2;
  }
  this.position = Vector2(
    position.x - (position.x % 2 == 0 ? (bleendingPixel / 2) : 0),
    position.y - (position.y % 2 == 0 ? (bleendingPixel / 2) : 0),
  );
  this.size = Vector2(
    size.x + (position.x % 2 == 0 ? bleendingPixel : 0),
    size.y + (position.y % 2 == 0 ? bleendingPixel : 0),
  );
}