<font color=black><i>怎样获得位图文件某象素点的值(2进制,8,16,10进制<u>数值</u&g

  • 主题发起人 主题发起人 cat.yy
  • 开始时间 开始时间
C

cat.yy

Unregistered / Unconfirmed
GUEST, unregistred user!
<font color=black><i>怎样获得位图文件某象素点的值(2进制,8,16,10进制<u>数值</u>都行)</i></font>(50分)<br />
 
IntToStr(GetRValue(Form1.Canvas.Pen.Color));
IntToStr(GetGValue(Form1.Canvas.Pen.Color));
IntToStr(GetBValue(Form1.Canvas.Pen.Color));
 
GetRValue,GetGValue,GetBValue 其实就是得到了
 
呵呵, 错了吧,
aBitmap.Canvas.Pixels[aX, aY],
 
要比pixels快一点可以用bitmap.scanline
 
The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.

COLORREF GetPixel(

HDC hdc, // handle of device context
int XPos, // x-coordinate of pixel
int nYPos // y-coordinate of pixel
);


Parameters

hdc

Identifies the device context.

nXPos

Specifies the logical x-coordinate of the pixel to be examined.

nYPos

Specifies the logical y-coordinate of the pixel to be examined.



Return Values

If the function succeeds, the return value is an RGB value. If the pixel is outside of the current clipping region, the return value is CLR_INVALID.

Remarks

The pixel must be within the boundaries of the current clipping region.
Not all devices support GetPixel. An application should call GetDeviceCaps to determine whether a specified device supports this function.
 
用windows API 的函数GetPixelv(x,y)或 GetPixel(x,y)这个函数就是取像素,然后用GetRGB.
 
你好,请你写信来给我,我就给你几个函数,全部搞定!!不信,你可以到我的老主页看看
我的Getit   cgh0717@sina.com http://go.163.com/~baif
 
多人接受答案了。
 
后退
顶部