Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ERROR: Buffer size is not sufficient. I think it's my stride
- static void Main(string[] args)
- {
- List<System.Windows.Media.Color> colors = new List<System.Windows.Media.Color>();
- colors.Add(System.Windows.Media.Colors.Red);
- BitmapPalette palette = new BitmapPalette(colors);
- PixelFormat pf = PixelFormats.Indexed1;
- int width = 16;
- int height = 14;
- int stride = width/pf.BitsPerPixel;
- byte[] pixels = new byte[28] { 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00 };
- BitmapSource image = BitmapSource.Create(width, height, 96, 96, pf, palette, pixels, stride);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement