Accessing Pixels of the Image

 

Use GetDIBPixelColor of the BiDIB DLL/OCX for retrieving the color of the specific pixel.

 

[C++]

 

/* Retrieving the color of a specific pixel from an image file*/

 

#include “BiDIB.h”

 

BOOL bRet;

COLORREF color;

 

/* 1. parameter: Handle of the DIB

   2. parameter: X coordinate of the pixel

   3. parameter: Y coordinate of the pixel

   4. parameter: Color value

 

bRet = GetDIBPixelColor(hDib, 20, 50, &color);

 

if (!bRet)

{

            // Error

}

 

[C#]

 

/* Retrieving the color of a specific pixel from an image file*/

 

bool bRes;

int lColor;

 

lColor = 0;

bRes = BiDIB.GetDIBPixelColor(hDib, 20, 50, ref lColor);

 

if (!bRes)

{

            // Error

}