Viewing is open to everyone. Downloading and starring need a GitHub sign-in.
Sign in with GitHub
Frames.cs
v0.1.0-build.85
Latest
Commit ede38f5
Sign in with GitHub to download. Each download is recorded with your GitHub username.
| 1 | namespace OpenCKey.Tests |
| 2 | { |
| 3 | internal static class Frames |
| 4 | { |
| 5 | /// <summary>Places a gray symbol on a larger white frame, with row padding.</summary> |
| 6 | internal static byte[] Embed(CKeyGrayImage symbol, int width, int height, int stride, int left, int top) |
| 7 | { |
| 8 | var frame = new byte[stride * height]; |
| 9 | for (int i = 0; i < frame.Length; i++) frame[i] = 255; |
| 10 | for (int y = 0; y < symbol.Height; y++) |
| 11 | System.Array.Copy(symbol.Gray, y * symbol.Width, frame, (top + y) * stride + left, symbol.Width); |
| 12 | return frame; |
| 13 | } |
| 14 | |
| 15 | internal static byte[] Frame(CKeySymbol symbol, out int width, out int height, out int stride, int size = 320) |
| 16 | { |
| 17 | width = 640; |
| 18 | height = 480; |
| 19 | stride = 704; |
| 20 | return Embed(symbol.RenderGray(size), width, height, stride, 150, 80); |
| 21 | } |
| 22 | } |
| 23 | } |