PreviousNext
Help > Programming in Vital Pixels > SemiCode Programing
SemiCode Programing

In SemiCode method you don't need to know every thinks about C# programming such as its structures, namespaces and classes. Following code shows you basic form of SemiCode. After running this program make your input image to grey style.

for (int y = 0; y < InputImage.Height; y++)

{

    for (int x = 0; x < InputImage.Width; x++)

       

    {

 

        Color c = ((Bitmap) InputImage).GetPixel(x, y);

       

         int luma = ((c.R)+(c.B)+(c.G))/3;

 

         OutputImage.SetPixel(x, y, Color.FromArgb(luma, luma, luma));

    } 

}       

 

argMessage = "Output Message";

 

In SemiCode you have three basic parameter:

1-      InputImage as Image (Image is a type in C#). Input image is implemented in InputImage and with this parameter you have access to any pixels of input image. You can use GetPixel(x,y) to get Color of any pixels. For example:

Color c = ((Bitmap) InputImage).GetPixel(x, y);

 

2-      OutputImage as Image. Every pixels that you set in OutputImage will be implemented in output image. You can use SetPixel(x,y, Color) to set color of output image in (x,y).

OutputImage.SetPixel(x, y, Color.Red);

 

3-      argMessage as String; If you want to calculate or send a message to user you can use this parameter and you should set a value for it. If you set a value for argMessage, Vital Pixels will should its value in a Message Box and in property grid.

Other parameters and syntaxes are same as C#. In SemiCode you cannot define methods and classes. Because it is not real environment for C#.  If you need to define another class or method you can develop it in Visual Studio and import it into Vital Pixels as a reference or you should use FullCode.

For starting SemiCode you can use "Sample Code" button on the "Welcome Window" or click "File->New" and choose SemiCode (Fig 7-3).

SemiCode will be save with "vp" extension.

 

Figure 7‑3. Create new C# SemiCode