PreviousNext
Help > Programming in Vital Pixels > FullCode Programming
FullCode Programming

In FullCode programming you can write your program same as C#. But following rules must be done.

1-      Main namespace is VPPlugin

2-      Main class MyPlugin

3-      Main method must be defined such as following line:

public Image OutPlugin(Image argImage,out string argMessage)
 

If you use more argument as double, Vital Pixels will define those as input parameters and you can use those for analyzing and flexibility.  For example if you define OutPlugin as following line:

public Image OutPlugin(Image argImage,out string argMessage ,
double alpha)

After running as a plugin, Vital Pixels ask the value of Alpha parameter (Fig 7-4).

Figure 7‑4. Run plugin with more parameters

4-      If you return any Image in OutPlugin, Vital Pixels will show it as output image and calculate necessary parameters or it.

5-      In FullCode you can define another method and class.

6-      In FullCode you should define all of necessary namespaces with "using" keyword. Some namespaces is necessary for any Vital Pixels program.

They are:

using System.Reflection;

using System.Drawing;

using System.Drawing.Imaging;

using System.Drawing.Drawing2D;

using System;

using System.Collections.Generic;

using System.Text;

using System.Threading.Tasks;

 

For example:

using System.Reflection;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
   
namespace VPPlugin
{
   public class MyPlugin
   {
     public Image OutPlugin(Image argImage,out string argMessage)
     {
              
          Bitmap OutputImage = new Bitmap(argImage.Width, argImage.Height);
         /// TO DO Program
     
        for (int y = 0; y < OutputImage.Height; y++)
        { 
            for (int x = 0; x < OutputImage.Width; x++)
                
            {
                Color c = ((Bitmap) argImage).GetPixel(x, y);
                
                 int luma = ((c.R)+(c.B)+(c.G))/3;
                 
                    OutputImage.SetPixel(x, y, 
                       Color.FromArgb(luma, luma, luma)); 
            }  
        }        
         argMessage = "Output"; // TO DO External Message
         return (Image)OutputImage;
     }
 
   }
}