'打开图形画面(320 * 240,32位)
ScreenRes 320, 240, 32
Dim As Any Ptr img
Dim As Integer x, y
'使图像的透明度和颜色不同
img = ImageCreate(64, 64)
For x = 0 To 63
For y = 0 To 63
PSet img, (x, y), RGBA(x * 4, 0, y * 4, (x + y) * 2)
Next y
Next x
Circle img, (31, 31), 25, RGBA(0, 127, 192, 192), ,,, F '半透明蓝色圆圈
Line img, (26, 20)-(38, 44), RGBA(255, 255, 255, 0), BF '透明白色矩形
'画一个背景(斜线白线)
For x = -240 To 319 Step 10
Line (x, 0)-Step(240, 240), RGB(255, 255, 255)
Next
Line (10, 10)-(310, 37), RGB(127, 0, 0), BF '文本红色框
Line (10, 146)-(310, 229), RGB(0, 127, 0), BF '绿色的盒子放在
'用PSET绘制图像和一些文本
Draw String(64, 20), "PSet"
Put(48, 48), img, PSet
Put(48, 156), img, PSet
'用ALPHA绘制图像和一些文本
Draw String (220, 20), "Α"
Put(208, 48), img, Alpha
Put(208, 156), img, Alpha
'释放图像内存
ImageDestroy img
'保持窗户打开,直到用户按下一个键
Sleep
''设置和检索红色,绿色,蓝色和Alpha值
#define RGBA_R( c ) ( CUInt( c ) Shr 16 And 255 )
#define RGBA_G( c ) ( CUInt( c ) Shr 8 And 255 )
#define RGBA_B( c ) ( CUInt( c ) And 255 )
#define RGBA_A( c ) ( CUInt( c ) Shr 24 )
Dim As UInteger r, g, b, a
Dim As UInteger col = RGBA(255, 192, 64, 128)
Print Using "颜色:_ &H \\ \\"; Hex(col, 8)
r = RGBA_R( col )
g = RGBA_G( col )
b = RGBA_B( col )
a = RGBA_A( col )
Print
Print Using "红色:_ &H \\\\ = ###"; Hex(r, 2); r
Print Using "绿色:_ &H \\\\ = ###"; Hex(g, 2); g
Print Using "蓝色:_ &H \\\\ = ###"; Hex(b, 2); b
Print Using "Alpha:_ &H \\\\ = ###"; Hex(a, 2); a