surface_getpixel_ext


语法:

surface_getpixel_ext(surface_id, x, y);

参数 描述
surface_id 使用的表面ID。
x 表面上的x坐标,用于获取对应的像素。
y 表面上的y坐标,用于获取对应的像素。


返回:

Real(实数)


描述

With this function you can get the full abgr 32bit value of any pixel of a (previously created) surface.

NOTE: This function is slow and so should only be used when absolutely necessary.


例如:

col = surface_getpixel_ext(mouse_x, mouse_y);
alpha = (col >> 24) & 255;
blue = (col >> 16) & 255;
green = (col >> 8) & 255;
red = col & 255;

上述代码将获取鼠标位置的32位真颜色,提取它的分量值,储存到不同的变量上。