I have a .NET (3.5 SP1) library (DLL) written in C#. I have to extend this library by a class method which will have the following signature:
public byte[] CreateGridImage(int maxXCells, int maxYCells,
int cellXPosition, int cellYPosition)
{
...
}
This method is supposed to do the following:
- Input parameters
maxXCells
andmaxYCells
define the size of a grid of cells in X and Y direction.maxXCells
andmaxYCells
is the number of cells in each direction. The individual cells are square-shaped. (So it's kind of an asymmetric chess board.) - Input parameters
cellXPosition
andcellYPosition
identify one special cell within this grid and this cell has to be filled with a cross. - No fancy graphics are necessary, really only black grid lines on a white background and a X in one of the cells.
- The resulting graphic must have jpg format.
- Creation of this graphic must happen in memory and nothing should be stored in a file on disk nor painted on the screen.
- The method returns the generated image as a
byte[]
I'm very unfamiliar with graphics functions in .NET so my questions are:
- Is this possible at all with .NET 3.5 SP1 without additional third-party libraries (which I would like to avoid)?
- What are the basic steps I have to follow and what are the important .NET namespaces, classes and methods I need to know to achieve this goal (epecially to draw lines and other simple graphical elements "in memory" and convert the result into an byte array in jpg format)?
Thank you for suggestions in advance!