ADD
- 来源: https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgAddGfx
- 最后更新: 2016-02-10
Put 图形语句的参数,用于选择加法作为位图传输方法
语法
Put [ target, ] [ STEP ] ( x,y ), source [ ,( x1,y1 )-( x2,y2 ) ], Add[ ,multiplier ]参数
Add
必填。
multiplier
可选值,范围 0 到 255。源像素在相加前会预乘以 (multiplier / 256)。如果省略,默认值为 255。
说明
Add 选择加法作为图像缓冲区的位图传输方法。对于每个源像素和目标像素,各自对应分量的值相加后作为结果输出。
加法是饱和运算——即如果两个值之和为 256 或更大,则会被截断为 255。
此方法适用于所有颜色模式。遮罩颜色(索引图像中的颜色 0,全彩图像中的品红色 RGB(255, 0, 255))将被跳过,但全彩颜色值为 0(RGBA(0, 0, 0, 0))同样不会产生效果。
示例
start GeSHi
vb
''open a graphics window
ScreenRes 320, 200, 16
''create a sprite containing a circle
Const As Integer r = 32
Dim c As Any Ptr = ImageCreate(r * 2 + 1, r * 2 + 1, 0)
Circle c, (r, r), r, RGB(255, 255, 192), , , 1, f
''put the sprite at three different multipier
''levels, overlapping each other in the middle
Put (146 - r, 108 - r), c, add, 64
Put (174 - r, 108 - r), c, add, 128
Put (160 - r, 84 - r), c, add, 192
''free the memory used by the sprite
ImageDestroy c
''pause the program before closing
Sleepend GeSHi
与 QB 的区别
- FreeBASIC 新增
另请参阅
TransAlphaCustomPut (Graphics)
返回 目录