Beispiel #1
0
 protected bool AdjustCoordinates(ref int x, ref int y, ImageBoundaryMode boundaryMode = ImageBoundaryMode.None)
 {
     if (IsOutOfBounds(x, y))
     {
         if (boundaryMode == ImageBoundaryMode.Wrap)
         {
             x %= Width;
             y %= Height;
         }
         else if (boundaryMode == ImageBoundaryMode.Repeat)
         {
             x = MathUtils.Clamp(x, 0, Width - 1);
             y = MathUtils.Clamp(y, 0, Height - 1);
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #2
0
 public override Color32 GetPixel(int x, int y, ImageBoundaryMode boundaryMode = ImageBoundaryMode.None)
 {
     if (!AdjustCoordinates(ref x, ref y, boundaryMode))
     {
         return(default);