Creating a 'blank' Bitmap in Portable Accord.Net

359 views Asked by At

I'm trying to create a blank Bitmap object in the Portable Accord.Net/Aforge.Net library (https://github.com/cureos/aforge), but I'm having trouble as the constructors don't get exposed, and I can't find another object to cast from.

I just want to create a bitmap of size x*y with a solid colour.

The only way I've figured out how to do it so far is to clone the bitmap, and then apply a filter to it to fill the whole bitmap with the same colour.

CanvasFill filter = new CanvasFill(new Rectangle(0, 0, img.Width, img.Height), Color.FromArgb(255, 0, 0, 0));
filter.ApplyInPlace(img);

Surely there has to be a better way?

0

There are 0 answers