Skip to content

Commit

Permalink
New initial image type: random monochrome squares
Browse files Browse the repository at this point in the history
  • Loading branch information
Robson committed Jul 23, 2020
1 parent 894199d commit 4b790a6
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions GlitchGenerator/InitialImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal List<IInitialImage> GetInitialImageTypes()
new InitialImageNoiseBinary(),
new InitialImageNoiseColour(),
new InitialImageNoiseMonochrome(),
new InitialImageNoiseMonochromeSquares(),
new InitialImageShapes(),
};
}
Expand Down Expand Up @@ -119,7 +120,7 @@ internal class InitialImageNoiseColour : IInitialImage
{
public string GetName()
{
return "Noise, Colour";
return "Noise, Pixels, Colour";
}

public bool IsPossible()
Expand All @@ -137,7 +138,7 @@ internal class InitialImageNoiseMonochrome : IInitialImage
{
public string GetName()
{
return "Noise, Monochrome";
return "Noise, Pixels, Monochrome";
}

public bool IsPossible()
Expand All @@ -151,6 +152,32 @@ public Bitmap GenerateImage(int width, int height, bool isPreview)
}
}

internal class InitialImageNoiseMonochromeSquares : IInitialImage
{
public string GetName()
{
return "Noise, Squares, Monochrome";
}

public bool IsPossible()
{
return true;
}

public Bitmap GenerateImage(int width, int height, bool isPreview)
{
var bitmap = new Bitmap(width, height);
for (int y = 0; y < height;)
{
var h = 16 * (isPreview ? RNG.Random.Next(2, 4) : RNG.Random.Next(2, 6));
Glitches.GenerateMonochromeSquareNoiseAtLocation(bitmap, new Rectangle(0, y, width, h));
y += h;
}

return bitmap;
}
}

internal class InitialImageShapes : IInitialImage
{
public string GetName()
Expand Down

0 comments on commit 4b790a6

Please sign in to comment.