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

}

 

[VB]

 

‘ Retrieving the color of a specific pixel

 

Dim bRes As Boolean

Dim BiDIBobj as Object

Dim lColor as Long

 

Set BiDIBobj = CreateObject("BIDIB.BIDIBCtrl.1")

 

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

 

Set BiDIBobj = Nothing

 

If Not bRes Then

            ‘ Error

End If

 

[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

}