-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomBitmapRenderer.cs
More file actions
44 lines (37 loc) · 1.15 KB
/
CustomBitmapRenderer.cs
File metadata and controls
44 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Drawing;
using ZXing;
using ZXing.Common;
using ZXing.Rendering;
namespace nqrgen
{
public class CustomBitmapRenderer : BitmapRenderer
{
public override Bitmap Render(BitMatrix matrix, BarcodeFormat format, string content, EncodingOptions options)
{
for (int i = 0; i < matrix.Width; i++)
{
for (int j = 0; j < matrix.Height; j++)
{
if (matrix[j, i])
{
Console.BackgroundColor = ConsoleColor.DarkBlue;
Console.ForegroundColor = ConsoleColor.White;
}
else
{
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Black;
}
Console.Write(" ");
}
Console.ResetColor();
Console.WriteLine();
}
Console.ResetColor();
Console.WriteLine(content);
Console.WriteLine();
return null;
}
}
}