Raptor运算符号、函数、子过程介绍大全 联系客服

发布时间 : 星期五 文章Raptor运算符号、函数、子过程介绍大全更新完毕开始阅读bdd3a4fb28ea81c758f57880

Drawing Operations画图操作

可以绘制指定颜色的指定形状。 Keyboard Operations键盘操作

用于确定是否有键输入。例如输入字符串ASCII编码 Mouse Operations鼠标操作 可以返回当前鼠标位置。 Window Operations窗口操作

用于更新和设置窗口属性。Freeze_Graph_Window and Update_Graph_Window 调用可以平滑动画显示。

注:窗口必须打开才能进行相应操作,否则将出现run-time error

Window Operations窗口操作

Close_Graph_Window

Close_Graph_Window 关闭窗口过程

例:Close_Graph_Window

Get_Max_Height

variable <- Get_Max_Height

返回窗口的高度像素值。事实上,该过程常在Open_Graph_Window调用前使用。其值可用来作为打开窗口的参数。

Open_Graph_Window(Get_Max_Width,Get_Max_Height)

Get_Max_Width

variable <- Get_Max_Width 类同上

Get Window Height

variable <- Get_Window_Height 返回窗口高度。图窗口必须先打开。

例:

Get Window Width

variable <- Get_Window_Width 类同上

Is_Open

Is_Open

用于判断窗口是否打开,返回值为Yes (True) 或No (False)。常用于判断。

例:

Open_Graph_Window

Open_Graph_Window(X_Size, Y_Size) 例:Open_Graph_Window(500, 300)

opens a 500 pixel (wide) by 300 pixel (high) graphics window.

Set_Window_Title

Set_Window_Title(Title) 改变或设置窗口标题。

例:Set_Window_Title(\

Smoothing Animations平滑绘制图形

Freeze_Graph_Window及Update_Graph_Window常用于平滑动画显示 不用Freeze_Graph_Window将使每次描画变得明显而导致动画很愣。

Freeze_Graph_Window is called (and before Unfreeze_Graph_Window is called), this buffer is used for all graphics calls. That is, the objects being drawn by the graphics calls are not drawn to the screen, but instead to the screen buffer. When the programmer has drawn the desired objects to the screen buffer, the Update_Graph_Window call is used to almost instantaneously move the screen buffer to the viewable graphics screen. An animation normally repeats the following steps:

1) Draw desired objects (to the screen buffer) using normal graphics calls (例如Draw_Circle, Draw_Line, etc.) 2) 调用Update_Graph_Window使描画迅速可见

结束动画描画时,用Unfreeze_Graph_Window过程,将screen buffer数据更新屏幕使动画立即描画。例:

Colors颜色

Black, Blue, Green, Cyan青,Red, Magenta紫, Brown, Light_Gray浅灰, Dark_Gray深灰, Light_Blue浅蓝, Light_Green浅绿, Light_Cyan浅青, Light_Red浅红, Light_Magenta浅紫, Yellow, White 或用序号0~15(0-黑, 1-蓝,15-白) 例:

Draw_Box(X1, Y1, X2, Y2, BoxColor, Filled) Draw_Box(X1, Y1, X2, Y2, Green, Filled) Draw_Box(X1, Y1, X2, Y2, 2, Filled) 色值可达241,当大于15时,将为扩充色。

Filled——值为True(or Yes) or False (or No)。True则用指定颜色填充,否则无色。

Closest_Color

color <- Closest_Color(Red, Green, Blue)

一个函数,返回值0~241之间的某值(接近RGB颜色模式中),在0~ 255间或显示run-time error。

例:Color <- Closest_Color(50, 30, 110)具有RGB色值为50,30,110

Generating Random Colors产生随机颜色

Random_Color

返回0~15 (Black, Blue, Green, Cyan, Red, Magenta, Brown, Light_Gray, Dark_Gray, Light_Blue, Light_Green, Light_Cyan, Light_Red, Light_Magenta, Yellow, White)的一个随机色。

例:Display_Text(100,100,\Random_Color)

Random_Extended_Color

返回0~241间随机色

例:Display_Number(100,100,Score,Random_Extended_Color)

画图操作

Clear_Window

Clear_Window(Color)

例:Clear_Window(Red)——清屏且填充红色

Draw_Arc绘制弧

Draw_Arc(X1, Y1, X2, Y2, Startx, Starty, Endx, Endy, Color) 含8个参数,在指定的(X1, Y1, X2, Y2)矩形中绘制椭圆。 (X1,Y1) and (X2,Y2) 为矩形中的对角坐标。从坐标(Startx,Starty)开始,到(Endx,Endy)结束。

注:必须先打开图窗口,否则将run-time error 例:Draw_Arc(1,100,200,1,250,50,2,2,black) 在以下300x300 window中:

Draw_Bitmap

Draw_Bitmap(Bitmap, X, Y, Width, Height) 一个含5个参数的调用,用于在图窗口中绘制图像。