Returns the number of components of the image.
Declaring type: EventOutSFImage
Namespace: Vrml.EAI.Field
Assembly: VrmlEAI.NET
Collapse/Expand Syntax
C#
public abstract int GetComponents ()
Return Value
The number of components. This is a number between 1 and 4, inclusively. Greyscale images have one component (intensity). Greyscale images with an alpha channel have two components (intensity and alpha). Color images have three components (red, green and blue). Color images with an alpha channel have 4 components (red, green, blue and alpha).
Collapse/Expand Example
The following example demonstrates how to get the number of color components of an image:
C#
Vrml.EAI.Node pixelTexture = ...;
Vrml.EAI.Field.EventOutSFImage image_changed = (Vrml.EAI.Field.EventOutSFImage)pixelTexture.GetEventOut("image_changed");
switch (image_changed.GetComponents())
{
    case 1:
        System.Console.WriteLine("components = 1 (intensity)");
        break;
    case 2:
        System.Console.WriteLine("components = 2 (intensity, alpha)");
        break;
    case 3:
        System.Console.WriteLine("components = 3 (red, green, blue)");
        break;
    case 4:
        System.Console.WriteLine("components = 4 (red, green, blue, alpha)");
        break;
}