Net.Processing  1.2
 Tout Classes Espaces de nommage Fonctions Variables Énumérations Valeurs énumérées Propriétés Pages
Net.Processing by Michel Michaud

A .NET library, based on Processing

Main reference (NetProcessing.Sketch class, in French).

Quick Reference with links to Processing pages. (in English)

Download Net.Processing.


Sorry, only this page and the Quick Reference are in English for now.

Net.Processing (pronounced net processing) is a simple graphical library using the model offered by Processing (, but adapted to C#/.NET standards. Net.Processing is really similar and Processing documentation ( can be used to learn more about the possibilities of Net.Processing (see also the quick reference guide). Net.Processing was developped mainly to be used by computer science students, in a first or second programming course.

The main difference from Processing is that Net.Processing mostly use integer parameters for positions and sizes (Processing uses float, but does not need the f suffix for litteral value, that would be necessary, and annoying, in C#).

Most of the time, the programs deal with pixels, so integers are more natural and simpler. However, in many calculations, conversions and rounding (mostly from doubles) will be necessary. It's something that must be learned properly and that's one of the reasons why Net.Processing intentionaly uses integers. An "all double" version of Net.Processing is also planned.

The other important difference is that, in Net.Processing, identifiers follow .NET convention of using a capital initial letter in properties, methods, etc., whereas Processing use a lowercase letter. So Net.Processing offers FrameCount, Rect(), Size(), etc., instead of frameCount, rect(), size(), etc. The uppercase constant names (CENTER, LEFT, PIE, ARROW, etc.) do exist in Net.Processing, but other more natural names, in enum types, can also be used (Parameter.Center, Parameter.Left, ArcStyle.Pie, MouseCursor.Arrow, etc.).

Other permanent differences, because of technical aspects of C#/.NET:

Other differences, that could change in the next versions of Net.Processing :

Net.Processing adds the MouseDoubleClicked() method, that can be overriden to detect double-clicks..

Contrary to Processing, Net.Processing can completely interact with the user through a standard console (Console.ReadLine(), Console.Write(), etc.) by creating a console application. So a console is normally opened at startup, along with the graphical window. It is brought to front whenever there is an input operation (Console.ReadLine() for example). It can be hidden using the HideConsole() method, but it will be shown at startup and reopened if there is an input operation. The console can be completely eliminated by changing to a Windows Application project.

To help getting started, Net.Processing adds the ReadConsoleInt(), ReadConsoleDouble() and ReadConsoleChar() methods to read (and validate) values from the console.

Creation (version 1.2) : Michel Michaud, december 2013 - june 2014
Copyright ©Michel Michaud

Preparation and use

To use Net.Processing :

  1. Download Net.Processing here. Unzip the file (it contains two files: NetProcessing.dll and NetProcessing.xml).
  2. Create a console application.
  3. Copy NetProcessing.dll and NetProcessing.xml in the project folder (where the .csproj project file is located).
  4. Add a reference to the NetProcessing.dll file (right-click on References, Add Reference, Browse).
  5. A using NetProcessing; can be added but many programs will only refer once to the NetProcessing namespace.
  6. Derive the Program class from NetProcessing.Sketch: "class Program: NetProcessing.Sketch" (or class Program: Sketch if using NetProcessing was used).
  7. In Main(), call Start(): new Program().Start();.
    • For a program without animation
      Override the NPMain() method: type override than a space, than choose NPMain(). The general application code (that would be globally written in Processing) can now be written in the NPMain() method...
    • For a program with animation
      Override the Draw() method (see above). That method will be called repeatedly. The Setup() method can also be overridden, it will be called only once, before the calls to Draw().
    • In all cases, the base class calls (base.NPMain(), base.Draw() ou base.Setup()) should be removed.
  8. Run the program in non debugging mode (Start Without Debugging, Ctrl+F5).
  9. Classes can be added to the program. Most of Net.Processing elements are static and can be called outside the Program class. However, by adding the new classes inside the Program class, using the Sketch. (or NetProcessing.Sketch.) prefix won't be necessary, so it will be more like normal Processing code.

Net.Processing example

Original Processing program and Net.Processing/C# version (the basic usings are omitted):

/**                                                                       namespace Pointillism
 * Pointillism                                                            {
 * by Daniel Shiffman.                                                        class Program : NetProcessing.Sketch
 *                                                                            {
 * Mouse horizontal location controls size of dots.                               static void Main(string[] args)
 * Creates a simple pointillist effect using ellipses colored                     {
 * according to pixels in an image.                                                   new Program().Start();
 */                                                                               }
PImage img;                                                                       PImage img;
int smallPoint, largePoint;                                                       int smallPoint, largePoint;
void setup() {                                                                    public override void Setup() 
  size(640, 360);                                                                 {
  img = loadImage("moonwalk.jpg");                                                    Size(640, 360);
  smallPoint = 4;                                                                     img = LoadImage("moonwalk.jpg");
  largePoint = 40;                                                                    smallPoint = 4;
  imageMode(CENTER);                                                                  largePoint = 40;
  noStroke();                                                                         ImageMode(CENTER);  // Or ImageMode(Parameter.Center);
  background(255);                                                                    NoStroke();
}                                                                                     Background(255);
void draw() {                                                                     public override void Draw() 
  float pointillize = map(mouseX, 0, width, smallPoint, largePoint);              {
  int x = int(random(img.width));                                                     int pointillize = (int)Map(MouseX, 0, Width, smallPoint, largePoint);
  int y = int(random(img.height));                                                    int x = (int)Random(img.Width);
  color pix = img.get(x, y);                                                          int y = (int)Random(img.Height);
  fill(pix, 128);                                                                     Color pix = img.Get(x, y);
  ellipse(x, y, pointillize, pointillize);                                            Fill(pix, 128);
}                                                                                     Ellipse(x, y, pointillize, pointillize);

Net.Processing 1.0, par Michel Michaud ©2014 (documentation version Mardi 18 Février 2014)