ImageGear v26.5 - Updated
ImageGear.Core Assembly / ImageGear.Core Namespace / ImGearPixel Class
Members Example




In This Topic
    ImGearPixel Class
    In This Topic
    Encapsulates all attributes and operations for an image pixel.
    Object Model
    ImGearPixel ClassImGearPixel Class
    Syntax
    'Declaration
     
    <DefaultMemberAttribute("Item")>
    Public NotInheritable Class ImGearPixel 
    'Usage
     
    Dim instance As ImGearPixel
    [DefaultMember("Item")]
    public sealed class ImGearPixel 
    [DefaultMember("Item")]
    public __gc __sealed class ImGearPixel 
    [DefaultMember("Item")]
    public ref class ImGearPixel sealed 
    Remarks
    This class encapsulates an image pixel and represents the color store for each channel value.

    For simplicity, ImGearPixel does not contain any information about channels depths and color space. Therefore pixels that are identical in structure (ImGearPixel constructor parameters) may belong to images with significantly different channels, structure and color space.

    NOTE: for initialization of pixel value for using it with bitonal images, i.e. Run-Ends DIBs, please use 0 value for black color, and 1 value for white color.

    Example
    // Create a pixel for an image with an 8bit palette.
    ImGearPixel igPixelIndexed = new ImGearPixel(1, 8);
    // Assign the pixel palette position 176.
    igPixelIndexed[0] = 176;
    // Create a 512x512 8bit indexed image.
    ImGearPage igPageIndex = new ImGearRasterPage(512, 512,
        new ImGearColorSpace(ImGearColorSpaceIDs.I),
        new int[] { 8 }, true);
    // Allocate a new palette
    igPageIndex.DIB.Palette = new ImGearRGBQuad[256];
    // Set the 176th palette entry to green.
    igPageIndex.DIB.Palette[176].Red = 0;
    igPageIndex.DIB.Palette[176].Green = 127;
    igPageIndex.DIB.Palette[176].Blue = 0;
    // Update the full image with this pixel.
    for (int height = 0; height < igPageIndex.DIB.Height; height++)
        for (int width = 0; width < igPageIndex.DIB.Width; width++)
            igPageIndex.DIB.UpdatePixelFrom(width, height, igPixelIndexed);
    
    // Create a pixel for a 32bit CMYK image.
    ImGearPixel igPixelCMYK = new ImGearPixel(4, 8);
    // Assign the pixel a blue color.
    igPixelCMYK[0] = 255;
    igPixelCMYK[1] = 255;
    igPixelCMYK[2] = 0;
    igPixelCMYK[3] = 127;
    // Creates a 512x512 32bit CMYK image.
    ImGearPage igPageCMYK = new ImGearRasterPage(512, 512,
        new ImGearColorSpace(ImGearColorSpaceIDs.CMYK),
        new int[] { 8, 8, 8, 8 }, true);
    for (int height = 0; height < igPageCMYK.DIB.Height; height++)
        for (int width = 0; width < igPageCMYK.DIB.Width; width++)
            igPageCMYK.DIB.UpdatePixelFrom(width, height, igPixelCMYK);
    Inheritance Hierarchy

    System.Object
       ImageGear.Core.ImGearPixel

    See Also