赞 | 12 |
VIP | 107 |
好人卡 | 6 |
积分 | 4 |
经验 | 31122 |
最后登录 | 2024-6-29 |
在线时间 | 1606 小时 |
Lv2.观梦者 傻♂逼
- 梦石
- 0
- 星屑
- 374
- 在线时间
- 1606 小时
- 注册时间
- 2007-3-13
- 帖子
- 6562
 
|
找到了
class Bitmap
# 取得点(x,y)的颜色(Color)
def get_pixel_plus(x, y)
data = "rgba"
nth = ((height - 1 - y) * width + x) * data.length
RtlMoveMemory_pi.call(data, address + nth, data.length)
clr_ary = data.unpack('c*')
return Color.new(clr_ary[2],clr_ary[1],clr_ary[0],clr_ary[3])
end
# 设定点(x,y)的颜色为 color(Color)
def set_pixel_plus(x, y, color)
data = [color.blue,color.green,color.red,color.alpha].pack('c*')
nth = ((height - 1 - y) * width + x) * data.length
RtlMoveMemory_ip.call(address + nth, data, data.length)
return self
end
end |
|