Skip to content

Commit

Permalink
Merge pull request #6 from Robson/dev
Browse files Browse the repository at this point in the history
New glitch type: Error Bars
  • Loading branch information
Robson authored Oct 8, 2021
2 parents d859cf3 + cc79c9e commit 92ae2ff
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
3 changes: 2 additions & 1 deletion GlitchGenerator/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ internal static List<Glitch> GetAllGlitches()
new Glitch("File Corrupt", "Delete", Glitches.FileCorruptDelete),
new Glitch("File Corrupt", "Noise", Glitches.FileCorruptNoise),
new Glitch("Horizontal", "Mirror", Glitches.HorizontalMirror),
new Glitch("Horizontal", "Error Bars", Glitches.HorizontalErrorBars),
new Glitch("Horizontal", "Noise, Binary", Glitches.HorizontalBinaryNoise),
new Glitch("Horizontal", "Noise, Colour", Glitches.HorizontalColourNoise),
new Glitch("Horizontal", "Noise, Monochrome", Glitches.HorizontalMonochromeNoise),
new Glitch("Horizontal", "Offset, All, Random", Glitches.HorizontalOffsetAllRandom),
new Glitch("Horizontal", "Offset, All, Wavey", Glitches.HorizontalOffsetAllWavey),
new Glitch("Horizontal", "Offset, Partial", Glitches.HorizontalOffsetSingle),
new Glitch("Horizontal", "Offset, Partial", Glitches.HorizontalOffsetSingle),
new Glitch("Horizontal Freeze", "Fixed", Glitches.HorizontalFreezeFixed),
new Glitch("Horizontal Freeze", "Random", Glitches.HorizontalFreezeRandom),
new Glitch("Horizontal Freeze", "Waves Bumpy", Glitches.HorizontalFreezeWavesBumpy),
Expand Down
Binary file modified GlitchGenerator/Examples/Lillian.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions GlitchGenerator/Glitches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,42 @@ internal static Bitmap HorizontalMirror(Bitmap bitmap)
return bitmap;
}

internal static Bitmap HorizontalErrorBars(Bitmap bitmap)
{
var graphics = Graphics.FromImage(bitmap);
var colour = RNG.Random.NextDouble() > 0.5 ? Brushes.Black : Brushes.White;

for (int y = RNG.Random.Next(50, 150); y < bitmap.Height + 500; y+=RNG.Random.Next(100, 300))
{
var heightBlock = RNG.Random.Next(25, 75);
var heightRandom = RNG.Random.Next(5, 15);
var width = 25 * RNG.Random.Next(1, 5);
var startY = y + (3 * heightRandom);

graphics.FillRectangle(colour, new RectangleF(0, startY, bitmap.Width, heightBlock));
if (RNG.Random.NextDouble() > 0.5)
{
for (int x = 0; x < bitmap.Width + width; x += width)
{
var height = heightRandom * RNG.Random.Next(0, 3);
graphics.FillRectangle(colour, new RectangleF(x, startY - height, width, height));
}
}

if (RNG.Random.NextDouble() > 0.5)
{
for (int x = 0; x < bitmap.Width + width; x += width)
{
var height = heightRandom * RNG.Random.Next(0, 3);
graphics.FillRectangle(colour, new RectangleF(x, startY + heightBlock, width, height));
}
}
}

return bitmap;
}


internal static Bitmap HorizontalColourNoise(Bitmap bitmap)
{
var height = RNG.Random.Next(5, 100);
Expand Down
2 changes: 1 addition & 1 deletion GlitchGenerator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Glitch Generator")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down

0 comments on commit 92ae2ff

Please sign in to comment.