convert VB to C#
This commit is contained in:
20
Pilz.Drawing/BitmapExtensions.cs
Normal file
20
Pilz.Drawing/BitmapExtensions.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using global::System.Drawing;
|
||||
|
||||
namespace Pilz.Drawing
|
||||
{
|
||||
public static class BitmapExtensions
|
||||
{
|
||||
public static void InvertColors(this Bitmap bmp)
|
||||
{
|
||||
for (int y = 0, loopTo = bmp.Height - 1; y <= loopTo; y++)
|
||||
{
|
||||
for (int x = 0, loopTo1 = bmp.Width - 1; x <= loopTo1; x++)
|
||||
{
|
||||
var inv = bmp.GetPixel(x, y);
|
||||
inv = Color.FromArgb(inv.A, byte.MaxValue - inv.R, byte.MaxValue - inv.G, byte.MaxValue - inv.B);
|
||||
bmp.SetPixel(x, y, inv);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user