上海交通大学:Basic Raster Graphics Algorithms for Drawing 2D Primitives

Basic Raster Graphics Algorithms for Drawing 2D Primitives Prof Lizhuang Ma Shanghai Jiao Tong University
Basic Raster Graphics Algorithms for Drawing 2D Primitives Prof. Lizhuang Ma Shanghai Jiao Tong University

Contents Architecture of a Raster Display Scan Converting lines Filling Rectangles Filling Polygons Clipping lines Clipping Polygons Antialiasing
Contents • Architecture of a Raster Display • Scan Converting Lines • Filling Rectangles • Filling Polygons • Clipping Lines • Clipping Polygons • Antialiasing

Architecture of a Raster display Video Interface with host computer (Display commands)(Interaction data) Display controller Keyboard (DC) Mouse 0000000000000000000111000 000000000000000011100000 000o00000000000001100000 000000000000000000011000 000000000001110000000000 0000ooo011111111111000000 00111111111111111111111 Video controller 0001111111000000011111110 0001111111111111111111110 001111111110001111111110 001111111110001111111110 001111111110001111111110 001111111110001111111110 0001111111111111111111110 Refresh buffer
Architecture of a Raster Display Video

Definitions Pixel: a screen consists ofn x m pixels Bilevel=monochrome, 1 bit/pixel · Color:RGB/ CYK/LU∨ Bitmap / pixmap Frame buffer: an array of data in memory mapped to screen
Definitions • Pixel: a screen consists of N x M pixels • Bilevel = monochrome, 1 bit / pixel • Color: RGB/CYK/LUV… • Bitmap / pixmap • Frame buffer: an array of data in memory mapped to screen

Scan Converting line A scan-converted line showing intensified pixels as black circles
Scan Converting Line • A scan-converted line showing intensified pixels as black circles

The Basic Incremental algorithm Desired line (X; +1, Round (y +m) (X,y) (x+1,y+ (x, Round(yi)) Val=mx +B=m(x+Ar)+b=y, mAr A scan-converted line showing intensified pixels as black circles
The Basic Incremental Algorithm • A scan-converted line showing intensified pixels as black circles

The Basic Incremental Algorithm void Line(into, intyo, intx1, inty 1, value)i Int x Float dy, dx, y, m; dy=y1-y0: dxex1-XO m≡dydx; y=y0; for(X=X0; X<=X1; X++)i WritePixel(x, (int floor(y+0. 5), value +=m y
The Basic Incremental Algorithm void Line (intx0, inty0, intx1, inty1, value) { Int x; Float dy, dx, y, m; dy=y1-y0; dx=x1-x0; m=dy/dx; y=y0; for(x=x0; x<=x1; x++) { WritePixel(x, (int)floor(y+0.5), value); y+=m; } }

Midpoint line algorithm d y y=x+B LNE dx F(x,y)=dy.x-dx y+B dx=0 M a·x+by+c 。.● →F(M)=F(xp+1,yp+)=d Previous Choices for Choices for pixel current pixel next pixel
Midpoint Line Algorithm

Midpoint line algorithm dold= F(xp +l,yp +o=a(xp+l)+b(p+)+c F(xp +2,yp +o=a(xp+2)+b(p +o)+c forE new F(xp +2, yp +x=a(xp +2)+b(p +x)+c forNE I d old +a forE +a+b forNe
Midpoint Line Algorithm

Midpoint line algorithm void midpointLine (into, intyO, intx1, inty 1, value) int dx, dy, incrE, incrNE, d, x, y dy=y1y0;dX=×1-×0;d=dy*2-dX incrE=dy *2; incrNE=(dy-dx) *2 XEX0; y=yO: WritePixel(x, y, value) while(X<x1)i if(d<=0)d+=incrE; X++ else d+=incrNE, X++; y++ Write Pixel(x, y, value)
Midpoint Line Algorithm void MidpointLine(intx0, inty0, intx1, inty1, value) { int dx, dy, incrE, incrNE, d, x, y; dy=y1-y0;dx=x1-x0;d=dy*2-dx; incrE=dy*2;incrNE=(dy-dx)*2; x=x0;y=y0; WritePixel(x, y, value); while(x<x1) { if(d<=0) {d+=incrE;x++; } else {d+=incrNE;x++;y++; } WritePixel(x, y, value); } }
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- Transport Layer Identification of P2P Traffic.ppt
- 复旦大学:《数据库基础与应用》课程PPT教学课件(Access案例教程)第1章 数据库基础知识.pptx
- 香港科技大学:Advanced Topics in NextGeneration Wireless Networks.ppt
- 《编译原理》课程教学资源(PPT课件讲稿)第五章 语法分析——自下而上分析.ppt
- 香港城市大学:Introduction to Real-Time Systems(Design and Analysis of Algorithms).pptx
- 《网站设计与建设 Website design and developments》课程教学资源(PPT课件讲稿)第一部分 Web基础知识 第3章 图形与Web设计.ppt
- 《汇编语言》课程PPT教学课件:第三章 80x86寻址方式和指令系统.ppt
- 清华大学:高校信息门户建设(PPT讲稿).ppt
- 《计算机辅助设计 Computer Aided Design》课程PPT教学课件:第一篇 CAD技术 第一章 几何造型方法介绍和分类.ppt
- 西安电子科技大学:《操作系统 Operating Systems》课程教学资源(PPT课件讲稿)Chapter 02 进程和线程 Processes and Threads.ppt
- 《数字图像处理 Digital Image Processing》课程教学资源(PPT课件讲稿)第2章 图像的基本知识及运算.ppt
- 江苏海洋大学(淮海工学院):《Java面向对象程序设计》课程教学资源(PPT课件讲稿)第3章 Java 面向对象编程 3.1 面向对象软件开发概述.pptx
- 利用NetRiver实验系统实现IP协议交互和TCP协议交互.ppt
- 《软件工程简介》课程PPT教学课件(可行性研究、需求分析、总体设计、详细设计).ppt
- ARM Tachnology:Chapter 3 STM32 Clock and Configuration.ppt
- 《汇编语言程序设计》课程教学资源(PPT课件讲稿)循环与分支程序设计.ppt
- 香港科技大学:Latent Tree Models.pptx
- Network and System Security Risk Assessment(PPT讲稿)Introduction.ppt
- 复旦大学:Trapping in scale-free networks with hierarchical organization of modularity.pptx
- 电子工业出版社:《计算机网络》课程教学资源(第五版,PPT课件讲稿)第十章 下一代因特网.ppt
- 《编译原理》课程教学资源(PPT课件讲稿)第七章 中间代码生成.ppt
- 《MATLAB应用基础》课程教学资源(PPT课件讲稿)第4章 MATLAB的数值计算.ppt
- 安徽广播影视职业技术学院:《ASP动态网页设计实用教程》课程教学资源(PPT讲稿)第1章 ASP基础(贾海陶).ppt
- 白城师范学院:《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第六章 关系数据理论.pptx
- 中国科学技术大学:《数据结构及其算法》课程电子教案(PPT课件讲稿)第三章 栈和队列.pps
- 北京大学SAS俱乐部:SAS软件会员培训(PPT讲稿)SAS编程语言入门.ppt
- 泛型编程 Generic Programming(PPT讲稿)Templates.ppt
- 西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 9 Service and Broadcast Receiver.pptx
- 计算机问题求解(PPT讲稿)算法在计算机科学中的地位(算法的效率).pptx
- 《计算机组装与维修》课程教学资源(PPT讲稿)第7章 显示器.ppt
- 《Java语言程序设计》课程教学资源(PPT课件讲稿)第四章 Applet及其应用.ppt
- 《编译原理实践》课程教学资源(PPT讲稿)词法分析程序的自动生成器LEX.ppt
- 华中科技大学:《面向对象程序设计》课程PPT教学课件(Visual C++ 编程)第2讲 Visual C++ 6.0开发环境.ppt
- 东南大学:《泛型编程 Generic Programming》课程教学资源(PPT课件讲稿)Chapter 14 Templates.ppt
- Coded Caching under Arbitrary Popularity Distributions.pptx
- Distributed Systems and Networking Programmin(SOAP – Introduction).ppt
- 北京师范大学现代远程教育:《计算机应用基础》课程教学资源(PPT课件讲稿)第5章 Microsoft Excel 2010.pptx
- 图形处理及多媒体应用(PPT课件讲稿).pps
- Vitebi 译码.ppt
- 香港城市大学:Rank Aggregation in MetaSearch.ppt