二十讲SRGP图形包使用实例ppt课件.ppt
《二十讲SRGP图形包使用实例ppt课件.ppt》由会员分享,可在线阅读,更多相关《二十讲SRGP图形包使用实例ppt课件.ppt(20页珍藏版)》请在三一文库上搜索。
1、第二十讲:SRGP图形包使用实例,SRGP简介基本绘图函数,点、线、面 SRGP_defPoint(int x, int y); SRGP_lineCoord(int x1, int y1, int x2, int y2); SRGP_line(point pt1, point pt2); SRGP_polyLine(int vert_count, point *vertices); 绘图属性 SRGP_setLineStyle SRGP_setLineWidth 文本 SRGP_text(point pt, char *text); 颜色、字体 SRGP_setColor(int value
2、); SRGP_loadColorTable(int start, int count, ush *red, ush *green, ush *blue); SRGP_setFont(int value); SRGP_inquireTextExtent(char*text, int *width, int *height, int* descent); /见书P14, 本API有错,SRGP简介基本绘图函数,颜色的处理 #define BLACK 0 #define WHITE 1 #define RED 2 #define GREEN 3 #define BLUE 4 #define YEL
3、LOW 5 const int MaxColor = 15; unsigned short red = 0, 255, 255, 0, 0, 255, 255, 0, 192, 114, 240, 130, 225, 10, 255; unsigned short green = 0, 255, 0, 255, 0, 255, 0, 255, 192, 114, 240, 130, 225, 10, 255; unsigned short blue = 0, 255, 0, 0, 255, 0, 255, 255, 192, 114, 240, 130, 225, 140, 230; SRGP
4、_loadColorTable(0, MaxColor, red, green, blue); /装载颜色表 SRGP_setColor(RED); /设置为红色 RGB(255, 0, 0) SRGP_setColor(YELLOW); /设置为黄色 RGB(255, 255,0),SRGP简介基本交互处理,设置设备模式 SRGP_setInputMode(LOCATOR, SAMPLE); 定位设备的测量 locator_measure Mouse; do SRGP_sampleLocator(,采样模式,设置设备模式 SRGP_setInputMode(KEYBOARD, EVENT);
5、 主事件循环 do SRGP_waitEvent(-1); /阻塞,直至某事件发生。 SRGP_getKeyboard(,事件模式,SRGP简介基本交互处理,SRGP简介基本交互处理,/Srgppublic.h typedef enum UP, DOWN buttonStatus; typedef struct point postion; buttonStatus button_chord3; int button_of_last_transition; locator_measure;,SRGP_sampleLocator( /鼠标信息采样 1. if ( Mouse.buttonChor
6、d0=DOWN ) /左键按下 2. if ( Mouse.buttonChord0=UP ) /左键弹起 3. if ( Mouse.buttonChord1=DOWN ) /右键按下,鼠标状态,SRGP简介应用说明,void UserMain() SRGP_begin(“COOL Drawing V1.0“, width, height, 4, FALSE); SRGP_setInputMode(LOCATOR, SAMPLE); do /主处理循环 SRGP_sampleLocator( ,SRGP简介与Windows SDK结合使用,1. 取得设备的DC HDC hdc = GetDC
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 二十讲 SRGP 图形 使用 实例 ppt 课件
链接地址:https://www.31doc.com/p-3182155.html