首页 基于VC++的图形实现-简单的图形编辑程序—免费毕业设计论文

基于VC++的图形实现-简单的图形编辑程序—免费毕业设计论文

举报
开通vip

基于VC++的图形实现-简单的图形编辑程序—免费毕业设计论文基于VC++的图形实现-简单的图形编辑程序—免费毕业设计论文 毕业设计(论文) 学 院: 专 业: 班 级: 姓 名: 毕业设计题目 简单的图形编辑程序 指导教师 20XX 年 3 月 21 日 摘要 该文以计算机图形学及图像处理的理论为基础,提出了图像分析与处理的一些基本功能;文中给出了大量图形生成函数,有Windows封装的,有自定义的,突出了图形处理的编程实现。 本文还较深入的研究了WINDOWS下绘图,算法,图形的保存方法,bmp文件的转换。利用visualc++6.0开发工具实现了绘...

基于VC++的图形实现-简单的图形编辑程序—免费毕业设计论文
基于VC++的图形实现-简单的图形编辑程序—免费毕业 设计 领导形象设计圆作业设计ao工艺污水处理厂设计附属工程施工组织设计清扫机器人结构设计 论文 政研论文下载论文大学下载论文大学下载关于长拳的论文浙大论文封面下载 毕业设计(论文) 学 院: 专 业: 班 级: 姓 名: 毕业设计 快递公司问题件快递公司问题件货款处理关于圆的周长面积重点题型关于解方程组的题及答案关于南海问题 目 简单的图形编辑程序 指导教师 20XX 年 3 月 21 日 摘要 该文以计算机图形学及图像处理的理论为基础,提出了图像分析与处理的一些基本功能;文中给出了大量图形生成函数,有Windows封装的,有自定义的,突出了图形处理的编程实现。 本文还较深入的研究了WINDOWS下绘图,算法,图形的保存方法,bmp文件的转换。利用visualc++6.0开发工具实现了绘制直线,圆弧,圆,矩形,图形的自定义文件 格式 pdf格式笔记格式下载页码格式下载公文格式下载简报格式下载 保存,通过对图形算法的研究,实现了矢量图形的保存。 关键词:图形学;算法, vc++ 目 录 摘要 ...........................................................................................................................2 第一章 绪论..............................................................................................................4 1.1 项目背景 .....................................................................................................4 1.2目的和意义 ..................................................................................................4 1.3系统设计思想 ..............................................................................................4 第二章 系统原理和开发工具 ...................................................................................5 2.1 VC++概述 .....................................................................................................5 2.1.1 编辑器方面的新特性 .......................................................................5 2.1.2、编译器、连接器和调试器方面的改进 ..........................................5 2.2 windows绘图概述 ......................................................................................6 第三章 系统算法设计 ..............................................................................................8 3.1 软件结构设计 .............................................................................................8 3.2 基本图元算法 .............................................................................................8 ..............................................................................................8 3.2.1 直线类 3.2.2 方形类 ..............................................................................................9 3.2.3 圆形类 ............................................................................................ 10 3.2.4 B曲线类 ......................................................................................... 11 3.2.5 多边形类 ........................................................................................ 11 第四章 系统详细设计 ............................................................................................ 12 4.1 界面设计 ................................................................................................... 12 4.2 存储结构设计 ........................................................................................... 12 第五章 系统测试 .................................................................................................... 13 5.1 测试原则 ................................................................................................... 13 5.1.1 80—20原则.................................................................................... 13 5.1.2全程测试 ......................................................................................... 13 5.1.3测试具有免疫性 .............................................................................. 14 5.2 模块测试结果 ........................................................................................... 14 5.2.1画图测试 ......................................................................................... 14 5.2.2缩放选择测试 .................................................................................. 15 第六章 结论............................................................................................................ 15 参考文献 ................................................................................................................. 16 致 谢 ..................................................................................................................... 16 第一章 绪论 1.1 项目背景 1950年,第一台图形 示器作为美国麻省理工学院旋风l号)计算机的附件诞生了。在整个50年代,只有电子管计算机,用机器语言编程,主要应用于科学计算,为这些计算机配置的图形设备仅具有输出功能。计算机图形学处于准备和酝酿时期,开称之为:“被动式”图形学。到50年代朱期,MIT的林肯实验室在“旋风”计算机上开发SAGE空中防御体系,操作者可以用笔在屏幕上指出被确定的目标。它预示着文瓦式计算机图形学的诞生。 l962年,MIT林肯实验室的Ivail(E (Sutherland发 关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf 了1篇题为“Sketchpad:一个人机交( 通信的图形系统”的博士论文,他在论文中首次使用了计算机图形学“Computer Graphics”这个术语,证明交互计算机图形学是一个可行的、有用的研究领域,从而确定交互计算机图形学作为一个崭新的科学分支的独 地位。同在60年代早期,法国雷诺汽车公司的工程师Pierre Bezier发展了1套傲后人称为Bezier曲线、曲面的理论,成功地用于几何外形设计,并开发了用于汽车外形设计的UNISUI F系统。2O世纪7O年代,计算机图形学另外两个重要进展是真实感图形学和实体造型技术的产生。另外,从1973年开始,相继出现了英国剑桥大学CAD小组的Build系统、美国罗彻斯特大学的PADI T系统等实体造 系统。 1980年Whitted提出了一个光透视模型——whitted模型,并第一次给出光线跟踪算法的范例,实现whjtted模型;1984年,美国Corne~大学和日本广 岛大学的学者分别将热辐射工程中的辐射度的方法引入到计算机图形学中,用辐射度方法成功地模拟,理想漫反射表面问的多重漫反射效果;光线跟踪算法和辐射度算法的提出,标志着真实感图形的显示算法已逐渐成熟。从20世纪80年代中期以来,超大规模集成电路的发展,为图形学的飞速发展奠定了物质基础。计算机的运算能力的提高,图形处理速度的加快,使得图形学的各个研究方向得到充分发展,图形学已广泛应用于动画、科学计算可视化、CAD,CAM、影视娱乐等各个领域。 1.2目的和意义 本系统设计的目的就是要设计一个系统软件,实现基本的图形作图,并且实现对图元函数的操作主要是选择和缩放功能。通过本系统的实现,力求使得做出比画图程序功能更加强大。 1.3系统设计思想 一个方便用户使用的软件应该具备软件体积小,操作界面友好,基本功能稳定,运行速度较快,通过计算机技术及网络技术结合开发出客户端与服务器端,以便方便快捷清晰的进行数据传输,和简易通讯功能。 实用性:系统以用户需求为目标,以方便用户为原则。根据用户实际的需求情况,度身订造一套先进的局域网数据传输,从用户角度出发尽可能的方便用户使用,满足基本的用户需要,成为公司学校等通用的软件。 先进性:本设计将充分应用现有成熟的计算机技术、网络技术、软件开发技术。以VC6.0为主要开发环境,其优秀的编码体制和强大的编译器是此系统的强力支柱。 高可靠性:一个实用的系统同时必须是可靠的,本设计通过合理而先进的网络设计以及软、硬件的优化选型,可保证系统数据传输的正确性。 高安全性:在设计中,将充分利用网络软、硬件提供的各种安全措施,既可以保证用户共享资源,同时也可保证关键数据的安全性。 采用标准技术:本系统的所有设计遵循国际上现行的标准进行,以提高系统的开放性。 可维护性:系统的设计要求方便维护,包括硬件的维护,软件的维护(更改,升级等)和网络的维护。 可扩展性及灵活性:系统的设计以方便未来业务的扩展和系统扩充为目标,系统要求能够方便的升级,充分保护系统的投资。 第二章 系统原理和开发工具 2.1 VC++概述 Visual C++是当今最被广泛使用的可视化编程环境,为我们提供了一种方便、快捷的Windows 应用程序开发工具。它使用了Microsoft Windows 图形用户界面的许多先进特性和设计思想,采用了弹性可重复利用的完整的面向对象程序语言(Object-Oriented Language)、当今世界上最快的编辑器、最为领先的数据库技术。Visual C++ 6.0 是Visual C++系列的最新版本,是为Windows 98 或Windows 2000 等32 位操作系统开发应用程序用的编程工具,功能强大,界面友好,操作方便。 与Visual C++系列以前的版本相比而言,VC6.0 提供了许多新的特性,大致可以分为以下几方面。 2.1.1 编辑器方面的新特性 VC6.0 在集成开发环境的编辑器做了一些改进,以方便用户快速准确地编辑代码和资源,这些新特性主要包括: 1)自动完成语句功能:在用户编辑代码时,编辑器根据光标当前位置判断作用的类或对象,在一个下拉列表中显示相应的内容,如类的成员、函数原型、标识符定义等等。自动完成语句功能减轻了用户在输入长的类名或成员对象名时的繁 琐工作,方便了用户的使用。 2)快速宏录制:用户可以将集成开发环境中特定的连续操作定义为宏,在需要再次使用类似操作的时候只需调用已录制好的宏即可。 3)支持IE5 新控件的资源编辑器:新版本的资源编辑器支持IE5 提供的四种新控件,在资源编辑器中可以方便地将这些新控件添加到工具栏或者对话框中。 2.1.2、编译器、连接器和调试器方面的改进 VC6.0 在集成开发环境的编译器、连接器和调试器方面也做了大的改进,其目的就是使 得用户的应用程序运行起来更快、更稳定,调试起来更方便。 1) 编译器方面的改进:包括新添加的“_assume”关键字、增强对内联函数的控制、新增并更新了警告、加强了运行时刻的错误检测等内容。 2)连接器方面的改进:包括延迟加载外部支持、增添了新的连接选项和修正了外部函数的接口以减小文件尺寸等内容。 3)调试器方面的改进:包括改善了反汇编输出、改善了指针对象的显示、支持进程中的远程过程调用等内容。 2.2 windows绘图概述 Windows应用程序绘制图形时使用的是一种逻辑单位,每个逻辑单位的大小由映射模式决定, 这个逻辑单位既可以与设备单位(屏幕或打印机上的一个像素点)相同,也可以是一种物理单 位(如毫米),还可以是用户自定义的一种单位。在Windows应用程序中,只要与输出有关系,都 要使用映射模式。 当Windows应用程序在其客户区绘制图形时,必须给出在客户区的位置,其位置用x和y 两个坐标表示,x表示横坐标,y表示纵坐标。在所有的GDI绘制函数中,这些坐标使用的是一 种"逻辑单位"。当GDI函数将输出送到某个物理设备上时,Windows将逻辑坐标 转换成设备坐标(如屏幕或打印机的像素点)。逻辑坐标和设备坐标的转换是由映射模式决 定的。映射模式被储存在设备环境中。GetMapMode函数用于从设备环境得到当前的映射模 式,SetMapMode函数用于设置设备环境的映射模式。 1.逻辑坐标 逻辑坐标是独立于设备的,它与设备点的大小无关。使用逻辑单位,是实现"所见即所得"的基础。当程序员在调用一个画线的GDI函数LineTo,画出25.4mm(1英寸) 长的线时,他并不需要考虑输出的是何种设备。若设备是VGA显示器,Windows自动将其转化为96个像素点;若设备是一个300dpi的激光打印机,Windows自动将其转化为300个像素点。 2.设备坐标 Windows将GDI函数中指定的逻辑坐标映射为设备坐标,在所有的设备坐标系统中,单位以像素点为准,水平值从左到右增大,垂直值从上到下增大。 Windows中包括以下3种设备坐标,以满足各种不同需要: (1)客户区域坐标,包括应用程序的客户区域,客户区域的左上角为(0,0)。 (2)屏幕坐标,包括整个屏幕,屏幕的左上角为(0,0)。屏幕坐标用在WM_MOVE消息中(对于非子窗口)以及下面的Windows函数中:CreateWindow和MoveWindow(都对于非子窗口)、GetMessage、GetCursorPos、GetWindowRect、WindowFromPoint和SetBrushOrg中。用函数ClientToScreen和ScreenToClient可以将客户区域坐标转换成屏幕区域坐标,或反之。 (3)全窗口坐标,包括一个程序的整个窗口,包括标题条、菜单、滚动条和窗口框,窗口的左上角为(0,0)。使用GetWindowDC得到的窗口设备环境,可以将逻辑单位转换成窗口坐标。 3.逻辑坐标与设备坐标的转换方式 映射方式定义了Windows如何将GDI函数中指定的逻辑坐标映射为设备坐标。要继续讨论映射方式我们要介绍Windows有关映射模式的一些术语:我们将逻辑坐标所在的坐标系称为"窗口",将设备坐标所在的坐标系称为"视口"。 "窗口"依赖于逻辑坐标,可以是像素点、毫米或程序员想要的其他尺度。 "视口"依赖于设备坐标(像素点)。通常,视口和客户区域等同。但是,如果程序员用GetWindowDC或CreateDC获取了一个设备环境,则视口也可以指全窗口坐标或屏幕坐标。 点(0,0)是客户区域的左上角。x的值向右增加,y的值向上增加。 对于所有映射模式,Windows都用下面两个公式将窗口坐标转换成视口坐标: xViewport=(xWindow-xWinOrg)*(xViewExt/xWinExt)+xViewOrg yViewport=(yWindow-yWinOrg)*(yViewExt/yWinExt)+yViewOrg 其中,(xWindow,yWindows)是待转换的逻辑点,(xViewport,yViewport)是转换后的设备点。如果设备坐标是客户区域坐标或全窗口坐标,则Windows在画一个对象前,还必须将这些坐标转换成屏幕坐标。 这两个公式使用了分别指定窗口和视口原点的点:(xWinOrg,yWinOrg)是逻辑坐标的窗口原点;(xViewOrg,yViewOrg)是设备坐标的视口原点。在缺省的设备环境中,这两个点均设置为(0,0),但它们可以改变。此公式意味着,逻辑点(xWinOrg,yWinOrg)总被映射为设备点(xViewOrg,yViewOrg)。 Windows还能将视口(设备)坐标转换为窗口(逻辑)坐标: xWindow=(xViewport-xViewOrg)*(xWinExt/xViewExt)+xWinOrg yWindow=(yViewport-yViewOrg)*(yWinExt/yViewExt)+yWinOrg 可以使用Windows提供的两个函数DPtoLP和LPtoDP在设备坐标及逻辑坐标之间互相转换。 实际应用中,遇到一些与显示模式有关的问题。例如OLEServer中映射模式 的设置、如何减少逻辑坐标与设备坐标间相互转换的误差等。下面,笔者就讨论一下这两个 问题的解决方法。 1.映射模式的设置方法 开发应用程序时,如果直接调用SetMapMode函数将映射模式设置成度量映射方式中的一种后,在Windows95/98上程序会正常运行,但在WindowsNT上对象显示的大小比边框小。经过研究后,发现WindowsNT上使用基于逻辑英寸的映射方式。在讨论如何设置基于逻辑英寸的映射方式前,我们先介绍一下逻辑英寸的概念。 Windows在显示时以"逻辑英寸"为单位,逻辑英寸比实际的英寸要大。如果Windows程序使用实际英寸,则普通的10磅文本在显示器上就会小到几乎难以辨认,因此Windows使用放大了的"逻辑英寸"来表示文本。逻辑英寸只影响显示,而不影响打印。 使用GetDeviceCaps函数可得到当前设备的各种能力,其第一个参数nIndex指示要获取信息的类型。当nIndex为HORZSIZE和VERTSIZE时,可得到显示区域的宽度和高度;当nIndex 为HORZRES和VERTRES时,可得到每个水平和垂直方向的像素数即分辨率;当nIndex的值为LOGPIXELSX 和LOGPIXELSY时,可得到水平和垂直方向每逻辑英寸所含像素数。 在介绍了逻辑英寸的知识以后,很容易将OLEServer设置为基于逻辑英寸的映射模式。如果程序员仅仅调用SetMapMode(hdc,MM_LOENGLISH)来设置映射模式,当前的映射模式为物理英寸,而不是逻辑英寸。设置逻辑英寸必须自定义窗口和视口的范围,使 xViewExt/xWinExt =0.01逻辑英寸中水平像素的点数,当 xViewExt=LOGPIXELSX,xWinExt=100时,其比值正好满足上述要求。 以下是设置映射模式的代码。 intxLogPixPerInch=GetDeviceCaps(hdc,LOGPIXELSX); intyLogPixPerInch=GetDeviceCaps(hdc,LOGPIXELSY); SetMapMode(MM_ANISOTROPIC); SetWindowExt(100,100); SetViewportExt(xLogPixPerInch,yLogPixPerInch); 上述代码中调用SetMapMode函数将映射模式设置为自定义的,该调用必须位于SetWindowExt 和SetViewportExt调用之前,否则设置将会无效。 上述代码实际上将映射模式设置成逻辑MM_LOENGLISH,若程序员需要设置逻辑MM_LOMETRIC、MM_HIMETRIC、MM_HIENGLISH 或MM_TWIPS,只需修改上述代码中的SetWindowExt的参数,该参数实际上是每英寸所包含的各种映射模式下的单位数。根据表,中各映射模式的参数,可得到表,中每英寸所对应的各逻辑单位的个数。 例如,要设置逻辑MM_TWIPS,函数SetWindowExt中的参数为应1440。 当我们将映射模式设置成基于逻辑英寸的MM_LOMETRIC时,窗口的范围设为256,视口的范围设为96(在VGA显示器下LOGPIXELSX的值),约2.6个逻辑单位对应1个像素,这显然会造成不小的误差,它会表现在应用程序的各个方面:客户区的一个部分没有被刷新;对象之间本来没有间距,却显示出有间距;对象在屏幕的不同位置上会缩小或增大一个像素等问题。 可以采取以下两个步骤避免转换误差。(1)尽量选择窗口范围和视口范围比可以整除的映射方式,例如基于逻辑英寸的MM_TWIPS其窗口范围和视口范围比1440/96,可简化为15/1,从设备坐标转化为逻辑坐标时没有误差,从消除误差角度看,MM_TWIPS比其他几个映射模式都要好。(2)窗口范围和视口范围比不能整除时,也尽量将其简化,例如,当采用0.3900mm 中的将1个逻辑单位映射成1/64英寸的映射方式时,其窗口范围和视口范围比值为64/96,可简化为2/3。如果我们将逻辑单位的值都取为2的倍数,设备单位的值都取为3的倍数,转换后就没有精度的丢失了。 综上所述,如果我们能够根据映射模式值的特点,逻辑坐标和设备坐标都取经简化的窗口和视口范围值的倍数,则逻辑坐标和设备坐标间的转化将没有误差 第三章 系统算法设计 3.1 软件结构设计 MFC 框架中最容易被程序员和用户两者都见到的部分就是文档和视图。你在利用应用框架编写程序时的大部分工作是编写你的视图类和文档类。因此,我们有必要详细了解文档/视图结构。文档/视图结构是基于MFC 库的应用的一个重要特性。它将的实质就是将数据本身与用户对数据的观察和操作分离开来。所有的数据变化都在文档类中进行管理,同时它为视图对它的访问提供一个接口。视图调用两者间的接口来响应用户的操作,进行数据的修改,并且不断更新对文档的显示。这样就允许对同一数据可以有多个视图。 本软件使用文档视图结构,采用多文档的结构方式。 3.2 基本图元算法 3.2.1 直线类 直线类的继承结构如图:CObject->CUnit->CDline,直线类名为:CDline,主要结构如下: class CDLine:public CUnit { public: virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual BOOL IsInRgn(CPoint point); virtual void ShowSelectPoint(CDC*pDC); virtual void Circumrotate(CPoint first,CPoint second); virtual int IsOnMarginPoint(CPoint point); virtual void Initial(); virtual CRgn* GetRgn(); CDLine(); virtual void DrawStatic(CDC*pDC); DECLARE_SERIAL(CDLine) }; 主要画图的算法如下: CPen m_pen; m_pen.CreatePen(m_PenStyle,m_PenWidth,m_PenColor); CPen* pen=(CPen*)pDC->SelectObject(&m_pen); COLORREF OldColor=pDC->SetBkColor(m_BackgroundColor); int OldBkMode=pDC->SetBkMode(m_BkMode); pDC->MoveTo(m_FirstPoint); pDC->LineTo(m_SecondPoint); pDC->SelectObject(pen); pDC->SetBkMode(m_BkMode); 3.2.2 方形类 class CRectangle:public CUnit { public: virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual void ShowSelectPoint(CDC *pDC); virtual BOOL IsInRgn(CPoint point); virtual int IsOnMarginPoint(CPoint point); CRectangle(); virtual void Serialize(CArchive &ar); virtual void DrawStatic(CDC*pDC); DECLARE_SERIAL(CRectangle) }; 画图算法如下: CPen m_pen; CBrush m_brush; m_pen.CreatePen(m_PenStyle,m_PenWidth,m_PenColor); CPen* pen=(CPen*)pDC->SelectObject(&m_pen); LOGBRUSH brushlog; brushlog.lbColor=m_BrushColor; brushlog.lbHatch=m_BrushHatch; brushlog.lbStyle=m_BrushStyle; m_brush.CreateBrushIndirect(&brushlog); SetBrushOrg(pDC,&m_brush); CBrush*brush=(CBrush*)pDC->SelectObject(&m_brush); int OldBkMode=pDC->SetBkMode(m_BkMode); COLORREF OldColor=pDC->SetBkColor(m_BackgroundColor); pDC->Rectangle(CRect(m_FirstPoint,m_SecondPoint)); pDC->SelectObject(brush); pDC->SelectObject(pen); pDC->SetBkMode(OldBkMode); pDC->SetBkColor(OldColor); 3.2.3 圆形类 class CRound:public CUnit { DECLARE_SERIAL(CRound) public: void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual void ShowSelectPoint(CDC *pDC); virtual void Serialize(CArchive &ar); virtual int IsOnMarginPoint(CPoint point); virtual BOOL IsInRgn(CPoint point); virtual int ComputRadious(CPoint centerPoint, CPoint movingPoint); virtual void DrawStatic(CDC*pDC); CRound(); }; 3.2.4 B曲线类 class CPolyBezier:public CUnit { DECLARE_SERIAL(CPolyBezier) public: virtual void OnContextMenu(CWnd *pWnd, CPoint point); virtual void Serialize(CArchive& ar); virtual void OnMenuitemOk(CDC *pDC, CEastDrawView *pView); virtual BOOL IsInRgn(CPoint point); virtual int IsOnMarginPoint(CPoint point); void DrawMaskPoint(CDC*pDC); virtual void ShowSelectPoint(CDC*pDC); virtual void DrawStatic(CDC*pDC); virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); CPolyBezier(); CPoint*m_PointList; BOOL m_HaveDrawFirst; }; 3.2.5 多边形类 class CPolygon:public CUnit { DECLARE_SERIAL(CPolygon) public: virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual void ShowSelectPoint(CDC *pDC); virtual void ExchangeDraw(CDC *pDC, CPoint point); virtual BOOL IsInRgn(CPoint point); virtual int IsOnMarginPoint(CPoint point); virtual void DrawEnd(CDC*pDC,CPoint point); CPolygon(); virtual void DrawMask(CDC*pDC,CPoint point); virtual void DrawStatic(CDC*pDC); virtual void Initial(); void Serialize(CArchive &ar); }; 第四章 系统详细设计 4.1 界面设计 4.2 存储结构设计 存储格式包括两种,一种是位图结构,一种是矢量图结构。位图结构的保存代码设计为: CEastDrawView*pView; POSITION pos=GetFirstViewPosition(); pView=(CEastDrawView*)GetNextView(pos); return pView->SaveDIB(NULL,file); 矢量图格式存储代码设计为: if (ar.IsStoring()) { ar<>this->m_TotalSize; ar>>m_CenterPoint; // TODO: add loading code here } m_DLineArray.Serialize(ar); m_CurveArray.Serialize(ar); m_RectangleArray.Serialize(ar); m_PolygonArray.Serialize(ar); m_RoundRectangleArray.Serialize(ar); m_RoundArray.Serialize(ar); m_EllipseArray.Serialize(ar); m_LiEllipseArray.Serialize(ar); m_RoundArcArray.Serialize(ar); m_PolyBezierArray.Serialize(ar); m_TextArray.Serialize(ar); m_EllipseArcArray.Serialize(ar); 第五章 系统测试 5.1 测试原则 5.1.1 80—20原则 80,的软件缺陷常常生存在软件20,的控件里。这个原则告诉我们,如果你想使软件测试有效地话,记住常常光临其“高危多发”地段 。在那里发现软件缺陷的可能性会大的多。这一原则对软件测试人员提高测试效率及缺陷发现串有着重大的意义。 5.1.2全程测试 如果单纯的将程序设计阶段后的阶段称之为软件测试的话,需求阶段和设计阶段的缺陷产生的放大效应会加大。这非常不利于保址软件质最。需求缺陷、设计缺陷也是软件缺陷,记住“软件缺陷具有生育能力”。软件测试跨越整个软件开发流程。需求验证(自检)和设计验证(白检)也可以算作软件测试的一种。软件测试应该是一个泛型概念,涵盖整个软什生命周期,这样才能确保周期的每个阶段禁得起考验软件测试是提高软件产品质量的必要条件而非充分条件,软件测试是提高产品质量最直接、最快捷的手段,但决不是一个根本于段。 5.1.3测试具有免疫性 软件缺陷与病毒一样具有可怕的”免疫性” ,测试人员对 采用的测试越多,其免疫能力就越强,寻找更多软什缺陷就更加困难。在软件测试中采用单一的方法不能高效和完全的针对所有软件缺陷, 此软件测试应该尽可能的多采用多种途径进行测试。 5.2 模块测试结果 5.2.1画图测试 5.2.2缩放选择测试 第六章 结论 通过实际使用,我们感觉这套系统的优势是: 1(具备一定的绘图功能(使我们可以很好的作图,在很大程度上掌握了工作的主动性,提高了效率; 2(方便的图形保存,,使用起来方便快捷; 3(界面设计合理,使用美观,方便。 通过毕业设计我收获不少主要是以下几个方面:一是对软件工程知识进行了系统的学习,在实践中丰富了自己,提高了自己。通过模块分析设计,系统的选择与设计,进一步加深了所学习的知识。二是对于VC编程有了一点的实践能力。通过对数据库系统的设计,提高了自己的编程能力。在VC编程有了很大的提高。三是学会了自主学习。通过不断的学习查找资料,我深深体会到学习的重要性。 同时我也感到了自身的不足,一是知识有限,需要不断的加强学习,在新技术不断涌现的今天要不断提高自身的知识水平。二是理论和实践还有一定的差距,需要在今后的工作中不断提高理论和实践的水平。 参考文献 [1] 胡晓军,邓波,高宏伟等《Visual C++高级开发范例解析》,电子工业出版社,2002 [2] David J.Kruglinski,潘爱民 译《Visual C++技术内幕》,人民邮电出版社,2004 [3] 吴文奎 《最流行图像格式实用参考手册》,电子工业出版社,1998 [4] 徐慧,《Visual C++数字图像实用工程案例精选》,人民邮电出版社,2004 [5] 胡峪《Visual C++++编程技巧与示例》,西安电子科技大学出版,2002 [6] 袁峰《Windows图形编程》,人民邮电出版社,2004 致 谢 当这篇论文最终完成的时候,我要向给予过我热情帮助和悉心指导的老师和师兄们致以真诚的谢意。 首先,我要感谢我的导师,感谢他带给我来学习的机会,感谢他对我学术上的悉心指导,感谢他对我生活上的关怀和体贴。老师是不仅是我学业上的导师,更是生活中让我敬佩的学者、长者。给我留下深刻印象的,是他知识的渊博、治学态度的严谨、诲人不倦的学者风范,是他谦逊待人、处处关心别人的长者风度,是他勤奋忘我的工作态度、精益求精的治学作风。特别是老师做大事的风范和气度,尤其让我钦佩。 毕业设计(论文) 学 院: 专 业: 班 级: 姓 名: 毕业设计题目 简单的图形编辑程序 指导教师 20XX 年 3 月 21 日 摘要 该文以计算机图形学及图像处理的理论为基础,提出了图像分析与处理的一些基本功能;文中给出了大量图形生成函数,有Windows封装的,有自定义的,突出了图形处理的编程实现。 本文还较深入的研究了WINDOWS下绘图,算法,图形的保存方法,bmp文件的转换。利用visualc++6.0开发工具实现了绘制直线,圆弧,圆,矩形,图形的自定义文件格式保存,通过对图形算法的研究,实现了矢量图形的保存。 关键词:图形学;算法, vc++ 目 录 摘要 ...........................................................................................................................2 第一章 绪论..............................................................................................................4 1.1 项目背景 .....................................................................................................4 1.2目的和意义 ..................................................................................................4 1.3系统设计思想 ..............................................................................................4 第二章 系统原理和开发工具 ...................................................................................5 2.1 VC++概述 .....................................................................................................5 2.1.1 编辑器方面的新特性 .......................................................................5 2.1.2、编译器、连接器和调试器方面的改进 ..........................................5 2.2 windows绘图概述 ......................................................................................6 第三章 系统算法设计 ..............................................................................................8 3.1 软件结构设计 .............................................................................................8 3.2 基本图元算法 .............................................................................................8 ..............................................................................................8 3.2.1 直线类 3.2.2 方形类 ..............................................................................................9 3.2.3 圆形类 ............................................................................................ 10 3.2.4 B曲线类 ......................................................................................... 11 3.2.5 多边形类 ........................................................................................ 11 第四章 系统详细设计 ............................................................................................ 12 4.1 界面设计 ................................................................................................... 12 4.2 存储结构设计 ........................................................................................... 12 第五章 系统测试 .................................................................................................... 13 5.1 测试原则 ................................................................................................... 13 5.1.1 80—20原则.................................................................................... 13 5.1.2全程测试 ......................................................................................... 13 5.1.3测试具有免疫性 .............................................................................. 14 5.2 模块测试结果 ........................................................................................... 14 5.2.1画图测试 ......................................................................................... 14 5.2.2缩放选择测试 .................................................................................. 15 第六章 结论............................................................................................................ 15 参考文献 ................................................................................................................. 16 致 谢 ..................................................................................................................... 16 第一章 绪论 1.1 项目背景 1950年,第一台图形 示器作为美国麻省理工学院旋风l号)计算机的附件诞生了。在整个50年代,只有电子管计算机,用机器语言编程,主要应用于科学计算,为这些计算机配置的图形设备仅具有输出功能。计算机图形学处于准备和酝酿时期,开称之为:“被动式”图形学。到50年代朱期,MIT的林肯实验室在“旋风”计算机上开发SAGE空中防御体系,操作者可以用笔在屏幕上指出被确定的目标。它预示着文瓦式计算机图形学的诞生。 l962年,MIT林肯实验室的Ivail(E (Sutherland发表了1篇题为“Sketchpad:一个人机交( 通信的图形系统”的博士论文,他在论文中首次使用了计算机图形学“Computer Graphics”这个术语,证明交互计算机图形学是一个可行的、有用的研究领域,从而确定交互计算机图形学作为一个崭新的科学分支的独 地位。同在60年代早期,法国雷诺汽车公司的工程师Pierre Bezier发展了1套傲后人称为Bezier曲线、曲面的理论,成功地用于几何外形设计,并开发了用于汽车外形设计的UNISUI F系统。2O世纪7O年代,计算机图形学另外两个重要进展是真实感图形学和实体造型技术的产生。另外,从1973年开始,相继出现了英国剑桥大学CAD小组的Build系统、美国罗彻斯特大学的PADI T系统等实体造 系统。 1980年Whitted提出了一个光透视模型——whitted模型,并第一次给出光线跟踪算法的范例,实现whjtted模型;1984年,美国Corne~大学和日本广 岛大学的学者分别将热辐射工程中的辐射度的方法引入到计算机图形学中,用辐射度方法成功地模拟,理想漫反射表面问的多重漫反射效果;光线跟踪算法和辐射度算法的提出,标志着真实感图形的显示算法已逐渐成熟。从20世纪80年代中期以来,超大规模集成电路的发展,为图形学的飞速发展奠定了物质基础。计算机的运算能力的提高,图形处理速度的加快,使得图形学的各个研究方向得到充分发展,图形学已广泛应用于动画、科学计算可视化、CAD,CAM、影视娱乐等各个领域。 1.2目的和意义 本系统设计的目的就是要设计一个系统软件,实现基本的图形作图,并且实现对图元函数的操作主要是选择和缩放功能。通过本系统的实现,力求使得做出比画图程序功能更加强大。 1.3系统设计思想 一个方便用户使用的软件应该具备软件体积小,操作界面友好,基本功能稳定,运行速度较快,通过计算机技术及网络技术结合开发出客户端与服务器端,以便方便快捷清晰的进行数据传输,和简易通讯功能。 实用性:系统以用户需求为目标,以方便用户为原则。根据用户实际的需求情况,度身订造一套先进的局域网数据传输,从用户角度出发尽可能的方便用户使用,满足基本的用户需要,成为公司学校等通用的软件。 先进性:本设计将充分应用现有成熟的计算机技术、网络技术、软件开发技术。以VC6.0为主要开发环境,其优秀的编码体制和强大的编译器是此系统的强力支柱。 高可靠性:一个实用的系统同时必须是可靠的,本设计通过合理而先进的网络设计以及软、硬件的优化选型,可保证系统数据传输的正确性。 高安全性:在设计中,将充分利用网络软、硬件提供的各种安全措施,既可以保证用户共享资源,同时也可保证关键数据的安全性。 采用标准技术:本系统的所有设计遵循国际上现行的标准进行,以提高系统的开放性。 可维护性:系统的设计要求方便维护,包括硬件的维护,软件的维护(更改,升级等)和网络的维护。 可扩展性及灵活性:系统的设计以方便未来业务的扩展和系统扩充为目标,系统要求能够方便的升级,充分保护系统的投资。 第二章 系统原理和开发工具 2.1 VC++概述 Visual C++是当今最被广泛使用的可视化编程环境,为我们提供了一种方便、快捷的Windows 应用程序开发工具。它使用了Microsoft Windows 图形用户界面的许多先进特性和设计思想,采用了弹性可重复利用的完整的面向对象程序语言(Object-Oriented Language)、当今世界上最快的编辑器、最为领先的数据库技术。Visual C++ 6.0 是Visual C++系列的最新版本,是为Windows 98 或Windows 2000 等32 位操作系统开发应用程序用的编程工具,功能强大,界面友好,操作方便。 与Visual C++系列以前的版本相比而言,VC6.0 提供了许多新的特性,大致可以分为以下几方面。 2.1.1 编辑器方面的新特性 VC6.0 在集成开发环境的编辑器做了一些改进,以方便用户快速准确地编辑代码和资源,这些新特性主要包括: 1)自动完成语句功能:在用户编辑代码时,编辑器根据光标当前位置判断作用的类或对象,在一个下拉列表中显示相应的内容,如类的成员、函数原型、标识符定义等等。自动完成语句功能减轻了用户在输入长的类名或成员对象名时的繁 琐工作,方便了用户的使用。 2)快速宏录制:用户可以将集成开发环境中特定的连续操作定义为宏,在需要再次使用类似操作的时候只需调用已录制好的宏即可。 3)支持IE5 新控件的资源编辑器:新版本的资源编辑器支持IE5 提供的四种新控件,在资源编辑器中可以方便地将这些新控件添加到工具栏或者对话框中。 2.1.2、编译器、连接器和调试器方面的改进 VC6.0 在集成开发环境的编译器、连接器和调试器方面也做了大的改进,其目的就是使 得用户的应用程序运行起来更快、更稳定,调试起来更方便。 1) 编译器方面的改进:包括新添加的“_assume”关键字、增强对内联函数的控制、新增并更新了警告、加强了运行时刻的错误检测等内容。 2)连接器方面的改进:包括延迟加载外部支持、增添了新的连接选项和修正了外部函数的接口以减小文件尺寸等内容。 3)调试器方面的改进:包括改善了反汇编输出、改善了指针对象的显示、支持进程中的远程过程调用等内容。 2.2 windows绘图概述 Windows应用程序绘制图形时使用的是一种逻辑单位,每个逻辑单位的大小由映射模式决定, 这个逻辑单位既可以与设备单位(屏幕或打印机上的一个像素点)相同,也可以是一种物理单 位(如毫米),还可以是用户自定义的一种单位。在Windows应用程序中,只要与输出有关系,都 要使用映射模式。 当Windows应用程序在其客户区绘制图形时,必须给出在客户区的位置,其位置用x和y 两个坐标表示,x表示横坐标,y表示纵坐标。在所有的GDI绘制函数中,这些坐标使用的是一 种"逻辑单位"。当GDI函数将输出送到某个物理设备上时,Windows将逻辑坐标 转换成设备坐标(如屏幕或打印机的像素点)。逻辑坐标和设备坐标的转换是由映射模式决 定的。映射模式被储存在设备环境中。GetMapMode函数用于从设备环境得到当前的映射模 式,SetMapMode函数用于设置设备环境的映射模式。 1.逻辑坐标 逻辑坐标是独立于设备的,它与设备点的大小无关。使用逻辑单位,是实现"所见即所得"的基础。当程序员在调用一个画线的GDI函数LineTo,画出25.4mm(1英寸) 长的线时,他并不需要考虑输出的是何种设备。若设备是VGA显示器,Windows自动将其转化为96个像素点;若设备是一个300dpi的激光打印机,Windows自动将其转化为300个像素点。 2.设备坐标 Windows将GDI函数中指定的逻辑坐标映射为设备坐标,在所有的设备坐标系统中,单位以像素点为准,水平值从左到右增大,垂直值从上到下增大。 Windows中包括以下3种设备坐标,以满足各种不同需要: (1)客户区域坐标,包括应用程序的客户区域,客户区域的左上角为(0,0)。 (2)屏幕坐标,包括整个屏幕,屏幕的左上角为(0,0)。屏幕坐标用在WM_MOVE消息中(对于非子窗口)以及下面的Windows函数中:CreateWindow和MoveWindow(都对于非子窗口)、GetMessage、GetCursorPos、GetWindowRect、WindowFromPoint和SetBrushOrg中。用函数ClientToScreen和ScreenToClient可以将客户区域坐标转换成屏幕区域坐标,或反之。 (3)全窗口坐标,包括一个程序的整个窗口,包括标题条、菜单、滚动条和窗口框,窗口的左上角为(0,0)。使用GetWindowDC得到的窗口设备环境,可以将逻辑单位转换成窗口坐标。 3.逻辑坐标与设备坐标的转换方式 映射方式定义了Windows如何将GDI函数中指定的逻辑坐标映射为设备坐标。要继续讨论映射方式我们要介绍Windows有关映射模式的一些术语:我们将逻辑坐标所在的坐标系称为"窗口",将设备坐标所在的坐标系称为"视口"。 "窗口"依赖于逻辑坐标,可以是像素点、毫米或程序员想要的其他尺度。 "视口"依赖于设备坐标(像素点)。通常,视口和客户区域等同。但是,如果程序员用GetWindowDC或CreateDC获取了一个设备环境,则视口也可以指全窗口坐标或屏幕坐标。 点(0,0)是客户区域的左上角。x的值向右增加,y的值向上增加。 对于所有映射模式,Windows都用下面两个公式将窗口坐标转换成视口坐标: xViewport=(xWindow-xWinOrg)*(xViewExt/xWinExt)+xViewOrg yViewport=(yWindow-yWinOrg)*(yViewExt/yWinExt)+yViewOrg 其中,(xWindow,yWindows)是待转换的逻辑点,(xViewport,yViewport)是转换后的设备点。如果设备坐标是客户区域坐标或全窗口坐标,则Windows在画一个对象前,还必须将这些坐标转换成屏幕坐标。 这两个公式使用了分别指定窗口和视口原点的点:(xWinOrg,yWinOrg)是逻辑坐标的窗口原点;(xViewOrg,yViewOrg)是设备坐标的视口原点。在缺省的设备环境中,这两个点均设置为(0,0),但它们可以改变。此公式意味着,逻辑点(xWinOrg,yWinOrg)总被映射为设备点(xViewOrg,yViewOrg)。 Windows还能将视口(设备)坐标转换为窗口(逻辑)坐标: xWindow=(xViewport-xViewOrg)*(xWinExt/xViewExt)+xWinOrg yWindow=(yViewport-yViewOrg)*(yWinExt/yViewExt)+yWinOrg 可以使用Windows提供的两个函数DPtoLP和LPtoDP在设备坐标及逻辑坐标之间互相转换。 实际应用中,遇到一些与显示模式有关的问题。例如OLEServer中映射模式 的设置、如何减少逻辑坐标与设备坐标间相互转换的误差等。下面,笔者就讨论一下这两个 问题的解决方法。 1.映射模式的设置方法 开发应用程序时,如果直接调用SetMapMode函数将映射模式设置成度量映射方式中的一种后,在Windows95/98上程序会正常运行,但在WindowsNT上对象显示的大小比边框小。经过研究后,发现WindowsNT上使用基于逻辑英寸的映射方式。在讨论如何设置基于逻辑英寸的映射方式前,我们先介绍一下逻辑英寸的概念。 Windows在显示时以"逻辑英寸"为单位,逻辑英寸比实际的英寸要大。如果Windows程序使用实际英寸,则普通的10磅文本在显示器上就会小到几乎难以辨认,因此Windows使用放大了的"逻辑英寸"来表示文本。逻辑英寸只影响显示,而不影响打印。 使用GetDeviceCaps函数可得到当前设备的各种能力,其第一个参数nIndex指示要获取信息的类型。当nIndex为HORZSIZE和VERTSIZE时,可得到显示区域的宽度和高度;当nIndex 为HORZRES和VERTRES时,可得到每个水平和垂直方向的像素数即分辨率;当nIndex的值为LOGPIXELSX 和LOGPIXELSY时,可得到水平和垂直方向每逻辑英寸所含像素数。 在介绍了逻辑英寸的知识以后,很容易将OLEServer设置为基于逻辑英寸的映射模式。如果程序员仅仅调用SetMapMode(hdc,MM_LOENGLISH)来设置映射模式,当前的映射模式为物理英寸,而不是逻辑英寸。设置逻辑英寸必须自定义窗口和视口的范围,使 xViewExt/xWinExt =0.01逻辑英寸中水平像素的点数,当 xViewExt=LOGPIXELSX,xWinExt=100时,其比值正好满足上述要求。 以下是设置映射模式的代码。 intxLogPixPerInch=GetDeviceCaps(hdc,LOGPIXELSX); intyLogPixPerInch=GetDeviceCaps(hdc,LOGPIXELSY); SetMapMode(MM_ANISOTROPIC); SetWindowExt(100,100); SetViewportExt(xLogPixPerInch,yLogPixPerInch); 上述代码中调用SetMapMode函数将映射模式设置为自定义的,该调用必须位于SetWindowExt 和SetViewportExt调用之前,否则设置将会无效。 上述代码实际上将映射模式设置成逻辑MM_LOENGLISH,若程序员需要设置逻辑MM_LOMETRIC、MM_HIMETRIC、MM_HIENGLISH 或MM_TWIPS,只需修改上述代码中的SetWindowExt的参数,该参数实际上是每英寸所包含的各种映射模式下的单位数。根据表,中各映射模式的参数,可得到表,中每英寸所对应的各逻辑单位的个数。 例如,要设置逻辑MM_TWIPS,函数SetWindowExt中的参数为应1440。 当我们将映射模式设置成基于逻辑英寸的MM_LOMETRIC时,窗口的范围设为256,视口的范围设为96(在VGA显示器下LOGPIXELSX的值),约2.6个逻辑单位对应1个像素,这显然会造成不小的误差,它会表现在应用程序的各个方面:客户区的一个部分没有被刷新;对象之间本来没有间距,却显示出有间距;对象在屏幕的不同位置上会缩小或增大一个像素等问题。 可以采取以下两个步骤避免转换误差。(1)尽量选择窗口范围和视口范围比可以整除的映射方式,例如基于逻辑英寸的MM_TWIPS其窗口范围和视口范围比1440/96,可简化为15/1,从设备坐标转化为逻辑坐标时没有误差,从消除误差角度看,MM_TWIPS比其他几个映射模式都要好。(2)窗口范围和视口范围比不能整除时,也尽量将其简化,例如,当采用0.3900mm 中的将1个逻辑单位映射成1/64英寸的映射方式时,其窗口范围和视口范围比值为64/96,可简化为2/3。如果我们将逻辑单位的值都取为2的倍数,设备单位的值都取为3的倍数,转换后就没有精度的丢失了。 综上所述,如果我们能够根据映射模式值的特点,逻辑坐标和设备坐标都取经简化的窗口和视口范围值的倍数,则逻辑坐标和设备坐标间的转化将没有误差 第三章 系统算法设计 3.1 软件结构设计 MFC 框架中最容易被程序员和用户两者都见到的部分就是文档和视图。你在利用应用框架编写程序时的大部分工作是编写你的视图类和文档类。因此,我们有必要详细了解文档/视图结构。文档/视图结构是基于MFC 库的应用的一个重要特性。它将的实质就是将数据本身与用户对数据的观察和操作分离开来。所有的数据变化都在文档类中进行管理,同时它为视图对它的访问提供一个接口。视图调用两者间的接口来响应用户的操作,进行数据的修改,并且不断更新对文档的显示。这样就允许对同一数据可以有多个视图。 本软件使用文档视图结构,采用多文档的结构方式。 3.2 基本图元算法 3.2.1 直线类 直线类的继承结构如图:CObject->CUnit->CDline,直线类名为:CDline,主要结构如下: class CDLine:public CUnit { public: virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual BOOL IsInRgn(CPoint point); virtual void ShowSelectPoint(CDC*pDC); virtual void Circumrotate(CPoint first,CPoint second); virtual int IsOnMarginPoint(CPoint point); virtual void Initial(); virtual CRgn* GetRgn(); CDLine(); virtual void DrawStatic(CDC*pDC); DECLARE_SERIAL(CDLine) }; 主要画图的算法如下: CPen m_pen; m_pen.CreatePen(m_PenStyle,m_PenWidth,m_PenColor); CPen* pen=(CPen*)pDC->SelectObject(&m_pen); COLORREF OldColor=pDC->SetBkColor(m_BackgroundColor); int OldBkMode=pDC->SetBkMode(m_BkMode); pDC->MoveTo(m_FirstPoint); pDC->LineTo(m_SecondPoint); pDC->SelectObject(pen); pDC->SetBkMode(m_BkMode); 3.2.2 方形类 class CRectangle:public CUnit { public: virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual void ShowSelectPoint(CDC *pDC); virtual BOOL IsInRgn(CPoint point); virtual int IsOnMarginPoint(CPoint point); CRectangle(); virtual void Serialize(CArchive &ar); virtual void DrawStatic(CDC*pDC); DECLARE_SERIAL(CRectangle) }; 画图算法如下: CPen m_pen; CBrush m_brush; m_pen.CreatePen(m_PenStyle,m_PenWidth,m_PenColor); CPen* pen=(CPen*)pDC->SelectObject(&m_pen); LOGBRUSH brushlog; brushlog.lbColor=m_BrushColor; brushlog.lbHatch=m_BrushHatch; brushlog.lbStyle=m_BrushStyle; m_brush.CreateBrushIndirect(&brushlog); SetBrushOrg(pDC,&m_brush); CBrush*brush=(CBrush*)pDC->SelectObject(&m_brush); int OldBkMode=pDC->SetBkMode(m_BkMode); COLORREF OldColor=pDC->SetBkColor(m_BackgroundColor); pDC->Rectangle(CRect(m_FirstPoint,m_SecondPoint)); pDC->SelectObject(brush); pDC->SelectObject(pen); pDC->SetBkMode(OldBkMode); pDC->SetBkColor(OldColor); 3.2.3 圆形类 class CRound:public CUnit { DECLARE_SERIAL(CRound) public: void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual void ShowSelectPoint(CDC *pDC); virtual void Serialize(CArchive &ar); virtual int IsOnMarginPoint(CPoint point); virtual BOOL IsInRgn(CPoint point); virtual int ComputRadious(CPoint centerPoint, CPoint movingPoint); virtual void DrawStatic(CDC*pDC); CRound(); }; 3.2.4 B曲线类 class CPolyBezier:public CUnit { DECLARE_SERIAL(CPolyBezier) public: virtual void OnContextMenu(CWnd *pWnd, CPoint point); virtual void Serialize(CArchive& ar); virtual void OnMenuitemOk(CDC *pDC, CEastDrawView *pView); virtual BOOL IsInRgn(CPoint point); virtual int IsOnMarginPoint(CPoint point); void DrawMaskPoint(CDC*pDC); virtual void ShowSelectPoint(CDC*pDC); virtual void DrawStatic(CDC*pDC); virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); CPolyBezier(); CPoint*m_PointList; BOOL m_HaveDrawFirst; }; 3.2.5 多边形类 class CPolygon:public CUnit { DECLARE_SERIAL(CPolygon) public: virtual void OnMouseMove(CDC*pDC,CEastDrawView*pView,CPoint point); virtual void OnLButtonDown(CDC *pDC, CEastDrawView *pView, CPoint point); virtual void DrawActive(CDC *pDC,CPoint point); virtual void ShowSelectPoint(CDC *pDC); virtual void ExchangeDraw(CDC *pDC, CPoint point); virtual BOOL IsInRgn(CPoint point); virtual int IsOnMarginPoint(CPoint point); virtual void DrawEnd(CDC*pDC,CPoint point); CPolygon(); virtual void DrawMask(CDC*pDC,CPoint point); virtual void DrawStatic(CDC*pDC); virtual void Initial(); void Serialize(CArchive &ar); }; 第四章 系统详细设计 4.1 界面设计 4.2 存储结构设计 存储格式包括两种,一种是位图结构,一种是矢量图结构。位图结构的保存代码设计为: CEastDrawView*pView; POSITION pos=GetFirstViewPosition(); pView=(CEastDrawView*)GetNextView(pos); return pView->SaveDIB(NULL,file); 矢量图格式存储代码设计为: if (ar.IsStoring()) { ar<>this->m_TotalSize; ar>>m_CenterPoint; // TODO: add loading code here } m_DLineArray.Serialize(ar); m_CurveArray.Serialize(ar); m_RectangleArray.Serialize(ar); m_PolygonArray.Serialize(ar); m_RoundRectangleArray.Serialize(ar); m_RoundArray.Serialize(ar); m_EllipseArray.Serialize(ar); m_LiEllipseArray.Serialize(ar); m_RoundArcArray.Serialize(ar); m_PolyBezierArray.Serialize(ar); m_TextArray.Serialize(ar); m_EllipseArcArray.Serialize(ar); 第五章 系统测试 5.1 测试原则 5.1.1 80—20原则 80,的软件缺陷常常生存在软件20,的控件里。这个原则告诉我们,如果你想使软件测试有效地话,记住常常光临其“高危多发”地段 。在那里发现软件缺陷的可能性会大的多。这一原则对软件测试人员提高测试效率及缺陷发现串有着重大的意义。 5.1.2全程测试 如果单纯的将程序设计阶段后的阶段称之为软件测试的话,需求阶段和设计阶段的缺陷产生的放大效应会加大。这非常不利于保址软件质最。需求缺陷、设计缺陷也是软件缺陷,记住“软件缺陷具有生育能力”。软件测试跨越整个软件开发流程。需求验证(自检)和设计验证(白检)也可以算作软件测试的一种。软件测试应该是一个泛型概念,涵盖整个软什生命周期,这样才能确保周期的每个阶段禁得起考验软件测试是提高软件产品质量的必要条件而非充分条件,软件测试是提高产品质量最直接、最快捷的手段,但决不是一个根本于段。 5.1.3测试具有免疫性 软件缺陷与病毒一样具有可怕的”免疫性” ,测试人员对 采用的测试越多,其免疫能力就越强,寻找更多软什缺陷就更加困难。在软件测试中采用单一的方法不能高效和完全的针对所有软件缺陷, 此软件测试应该尽可能的多采用多种途径进行测试。 5.2 模块测试结果 5.2.1画图测试 5.2.2缩放选择测试 第六章 结论 通过实际使用,我们感觉这套系统的优势是: 1(具备一定的绘图功能(使我们可以很好的作图,在很大程度上掌握了工作的主动性,提高了效率; 2(方便的图形保存,,使用起来方便快捷; 3(界面设计合理,使用美观,方便。 通过毕业设计我收获不少主要是以下几个方面:一是对软件工程知识进行了系统的学习,在实践中丰富了自己,提高了自己。通过模块分析设计,系统的选择与设计,进一步加深了所学习的知识。二是对于VC编程有了一点的实践能力。通过对数据库系统的设计,提高了自己的编程能力。在VC编程有了很大的提高。三是学会了自主学习。通过不断的学习查找资料,我深深体会到学习的重要性。 同时我也感到了自身的不足,一是知识有限,需要不断的加强学习,在新技术不断涌现的今天要不断提高自身的知识水平。二是理论和实践还有一定的差距,需要在今后的工作中不断提高理论和实践的水平。 参考文献 [1] 胡晓军,邓波,高宏伟等《Visual C++高级开发范例解析》,电子工业出版社,2002 [2] David J.Kruglinski,潘爱民 译《Visual C++技术内幕》,人民邮电出版社,2004 [3] 吴文奎 《最流行图像格式实用参考手册》,电子工业出版社,1998 [4] 徐慧,《Visual C++数字图像实用工程案例精选》,人民邮电出版社,2004 [5] 胡峪《Visual C++++编程技巧与示例》,西安电子科技大学出版,2002 [6] 袁峰《Windows图形编程》,人民邮电出版社,2004 致 谢 当这篇论文最终完成的时候,我要向给予过我热情帮助和悉心指导的老师和师兄们致以真诚的谢意。 首先,我要感谢我的导师,感谢他带给我来学习的机会,感谢他对我学术上的悉心指导,感谢他对我生活上的关怀和体贴。老师是不仅是我学业上的导师,更是生活中让我敬佩的学者、长者。给我留下深刻印象的,是他知识的渊博、治学态度的严谨、诲人不倦的学者风范,是他谦逊待人、处处关心别人的长者风度,是他勤奋忘我的工作态度、精益求精的治学作风。特别是老师做大事的风范和气度,尤其让我钦佩。 sounds that were a lot like laughter. 'You think it's funny, huh?' Weary inquired. He walked around to Billy's back. Billy's jacket and shirt and undershirt had been hauled up around his shoulders by the violence, so his back was naked. There, inches from the tips of Weary's combat boots, were the pitiful buttons of Billy's spine. Weary drew back his right boot, aimed a kick at the spine, at the tube which had so many of Billy's important wires in it. Weary was going to break that tube. But then Weary saw that he had an audience. Five German soldiers and a police dog on a leash were looking down into the bed of the creek. The soldiers' blue eyes were filled with bleary civilian curiosity as to why one American would try to murder another one so far from home, and why the victim should laugh. Three The Germans and the dog were engaged in a military operation which had an amusingly self-explanatory name, a human enterprise which is seldom described in detail, whose name alone, when reported as news or history, gives many war enthusiasts a sort of post-coital satisfaction. It is, in the imagination of combat's fans, the divinely listless loveplay that follows the orgasm of victory. It is called 'mopping up.' The dog, who had sounded so ferocious in the winter distances, was a female German shepherd. She was shivering. Her tail was between her legs. She had been borrowed that morning from a farmer. She had never been to war before. She had no idea what game was being played. Her mine was Princess. Two of the Germans were boys in their early teens. Two were ramshackle old me droolers as toothless as carp. They were irregulars, armed and clothed fragmentarily with junk taken from real soldiers who were newly dead. So it goes. They were farmers from just across the German border, not far away. Their commanander was a middle-aged corporal-red-eyed., scrawny, tough as dried beef, sick of war. He had been wounded four times-and patched up, and sent back to war. He was a very good soldier-about to quit, about to find somebody to surrender to. His bandy legs were thrust into golden cavalry boots which he had taken from a dead Hungarian colonel on the Russian front. So it goes. Those boots were almost all he owned in this world. They were his home. An anecdote: One time a recruit was watching him bone and wax those golden boots, and he held one up to the recruit and said, 'If you look in there deeply enough, you'll see Adam and Eve.' Billy Pilgrim had not heard this anecdote. But, lying on the black ice there, Billy stared into the patina of the corporal's boots, saw Adam and Eve in the golden depths. They were naked. They were so innocent, so vulnerable, so eager to behave decently. Billy Pilgrim loved them. Next to the golden boots were a pair of feet which were swaddled in rags. They were crisscrossed by canvas straps, were shod with hinged wooden clogs. Billy looked up at the face that went with the clogs. It was the face of a blond angel of fifteen-year-old boy. The boy was as beautiful as Eve. Billy was helped to his feet by the lovely boy, by the heavenly androgyne. And the others came forward to dust the snow off Billy., and then they searched him for weapons. He didn't have any. The most dangerous thing they found on his person was a two-inch pencil stub. Three inoffensive bangs came from far away. They came from German rifles. The two scouts who had ditched Billy and Weary had just been shot. They had been lying in ambush for Germans. They had been discovered and shot from behind. Now they were dying in the snow, feeling nothing, turning the snow to the color of raspberry sherbet. So it goes. So Roland Weary was the last of the Three Musketeers. And Weary, bug-eyed with terror, was being disarmed. The corporal gave Weary's pistol to the pretty boy. He marveled at Weary's cruel trench knife, said in German that Weary would no doubt like to use the knife on him, to tear his face off with the spiked knuckles, to stick the blade into his belly or throat. He spoke no English, and Billy and Weary understood no German. 'Nice playthings you have, the corporal told Weary, and he handed the knife to an old man. 'Isn't that a pretty thing? Hmmm? He tore open Weary's overcoat and blouse. Brass buttons flew like popcorn. The corporal reached into Weary's gaping bosom as though he meant to tear out his pounding heart, but he brought out Weary's bulletproof Bible instead. A bullet-proof Bible is a Bible small enough to be slipped into a soldier's breast pocket, over his heart. It is sheathed in steel. The corporal found the dirty picture of the woman and the pony in Weary's hip pocket. 'What a lucky pony, eh?' he said. "Hmmmm? Hmmmm? Don't you wish you were that pony?' He handed the picture to the other old man. 'Spoils of war! It's all yours, you lucky lad.' Then he made Weary sit down in the snow and take off his combat boots, which he gave to the beautiful boy. He gave Weary, the boy's clogs. So Weary and Billy were both without decent military footwear now' and they had to walk for miles and miles, with Weary's clogs clacking, with Billy bobbing up-and-down, up-and-down, crashing into Weary from time to time. 'Excuse me,' Billy would say, or 'I beg your pardon.' They were brought at last to a stone cottage at a fork in the road. It was a collecting point for prisoners of war. Billy and Weary were taken inside, where it was warm and smoky. There vas a fire sizzling and popping in the fireplace. The fuel was furniture. There were about twenty other Americans in there, sitting on the floor with their backs to the wall, staring into the flames-thinking whatever there was to think, which was zero. Nobody talked. Nobody had any good war stories to tell. Billy and Weary found places for themselves, and Billy went to sleep with his head on the shoulder of an unprotesting captain. The captain was a chaplain. He was a rabbi. He had been shot through the hand. Billy traveled in time, opened his eyes, found himself staring into the glass eyes of a jade green mechanical owl. The owl was hanging upside down from a rod of stainless steel. The owl was Billy's optometer in his office in Ilium. An optometer is an instrument for measuring refractive errors in eyes-in order that corrective lenses may be prescribed. Billy had fallen asleep while examining a female patient who was m a chair on the other side of the owl. He had fallen asleep at work before. It had been funny at first. Now Billy was starting to get worried about it, about his mind in general. He tried to remember how old he was, couldn't. He tried to remember what year it was. He couldn't remember that, either. 'Doctor,' said the patient tentatively. 'Hm?' he said. 'You're so quiet.' 'Sorry.' 'You were talking away there-and then you got so quiet' 'Um.' 'You see something terrible?' 'Terrible?' 'Some disease in my anslated by David Lewis The elderly man stroked the dogpillar's head. "This fellow here, I wonder what he was called before he became a dogpillar." "No calling a dogpillar by its original name," I said. "Isn't that a strange law?" The man gave me a quick glance, then replied casually. "Didn't they just extend the laws concerning people to dogs? That's why they lose their names when they become dogpillars." He nodded while scratching the dogpillar's jaw. "Not only the old names, but you can't give them new names, either. That's because there are no proper nouns for plants." Why, of course, I thought. He Looked at my envelope with MANUSCRIPT ENCLOSED written on it. "Excuse me," he said. "Are you a writer?" I was a little embarrassed. "Well. yes. Just trivial little things." "So that's it." After looking at me closely, the man returned to stroking the dogpillar's head. "I also used to write things." He managed to suppress a smile. "How many years is it now since I stopped writing? It feels like a long time." I stared at the man's profile. Now that he said so, it was a face I seemed to have seen somewhere before. I started to ask his name, hesitated, and fell silent. The elderly man said abruptly, "It's become a hard world to write in." I lowered my eyes, ashamed of myself, who still continued to write in such a world. "It certainly has..." The man apologized in a bit of a flurry discerning my sudden depression. "That was rude. I'm not criticizing you. I'm the one who should feel ashamed." "No," I told him, after looking quickly around us, "I can't give up writing because I haven't the courage. Giving up writing! Why, after all, that would be a gesture against society." The elderly man continued stroking the dogpillar. After a long while he spoke. "It's painful, suddenly giving up writing. Now that it's come to this, I would have been better off if I'd gone on boldly writing social criticism and had been arrested. There are even times when I think that. But I was just a dilettante, never knowing poverty, craving peaceful dreams. I wanted to live a comfortable life. As a person strong in self- respect, I couldn't endure being exposed to the eyes of the world, ridiculed. So I quit writing, A sorry tale." He smiled and shook his head. "No no, let's not talk about it. You never know where someone might be listening." "You're right." I changed the subject. "Do you live near here?" "Do you know the beauty parlor on the main street? You turn in there. My name is Hiyama." He nodded at me. "Come on over sometime. There's no one home but my wife." "Thank you very much." I gave him my own name. I didn't remember any writer named Hiyama. No doubt he wrote under a pen name. I had no intention of visiting his house. This is a world where even two or three writers getting together is considered illegal assembly. "It's time for the mail truck to come." Talking pains to look at my watch, I stood up. "I'm afraid I'd better go," I said. He turned a sadly smiling face toward me and bowed slightly. After stroking the dogpillar's head a little, I left the park. Standing Woman(2)--- I came out on the main street, there were a lot of cars on the road but few pedestrians. A cattree about thirty to forty centimeters high was planted next to the sidewalk. Sometimes I come across a catpillar that has just been planted and still hasn't become a cattree. New catpillars look at my face and meow or cry, but the ones where all four limbs planted in the ground have vegetized, with their greenish faces stiffly set and their eyes shut tight, only move their ears now and then. Then there are catpillars that grow branches from their bodies and put out handfuls of leaves. The mental condition of there seems to be completely vegetized •| they don't even move their ears. Even if you can still make out a cat's face, it may be better to call these cattrees. Maybe. I thought, it's better to make dogs into dogpillars. When their food runs out, they get vicious and even turn on people. But why did they have to turn cats into catpillars? Too many strays? To improve the food situation even a little? Or perhaps for the greening of the city ... Next to the big hospital on the corner where the roads cross are two mantrees, and ranged alongside these trees is a manpillar. This manpillar wears a postman's uniform, and you can't tell how far its legs have vegetized because of its trousers. It is male, thirty-five or thirty-six years old, tall, with a bit of a stoop. I approached him and held out my envelope as always. "Registered mail, special delivery, please." The manpillar, nodding silently, accepted the envelope and took stamps and a registered mail slip from his pocket. I looked around quickly after paying the postage. There was no one else there. I decided to try speaking to him. I had been giving him mail every three days, but I still hadn't had an opportunity chance for a leisurely talk. "What did you do?" I asked in a low voice. The manpillar looked at me in surprise. Then, after running his eyes around the area, he answered with a sour look, "Won't do to go saying unnecessary things to me. Even me, I'm not supposed to answer." ways been, the wonted way of things. Spitz was a practiced fighter. From Spitzbergen through the Arctic, and across Canada and the Barrens, he had held his own with all manner of dogs and achieved to mastery over them. Bitter rage was his, but never blind rage. In passion to rend and destroy, he never forgot that his enemy was in like passion to rend and destroy. He never rushed till he was prepared to receive a rush; never attacked till he had first defended that attack. In vain Buck strove to sink his teeth in the neck of the big white dog. Wherever his fangs struck for the softer flesh, they were countered by the fangs of Spitz. Fang clashed fang, and lips were cut and bleeding, but Buck could not penetrate his enemy's guard. Then he warmed up and enveloped Spitz in a whirlwind of rushes. Time and time again he tried for the snow-white throat, where life bubbled near to the surface, and each time and every time Spitz slashed him and got away. Then Buck took to rushing, as though for the throat, when, suddenly drawing back his head and curving in from the side, he would drive his shoulder at the shoulder of Spitz, as a ram by which to overthrow him. But instead, Buck's shoulder was slashed down each time as Spitz leaped lightly away. Spitz was untouched, while Buck was streaming with blood and panting hard. The fight was growing desperate. And all the while the silent and wolfish circle waited to finish off whichever dog went down. As Buck grew winded, Spitz took to rushing, and he kept him staggering for footing. Once Buck went over, and the whole circle of sixty dogs started up; but he recovered himself, almost in mid air, and the circle sank down again and waited. But Buck possessed a quality that made for greatness--imagination. He fought by instinct, but he could fight by head as well he rushed, as though attempting the old shoulder trick, but at the last instant swept low to the snow and in. His teeth closed on Spitz's left fore leg. There was a crunch of breaking bone, and the white dog faced him on three legs. Thrice he tried to knock him over, then repeated the trick and broke the right fore leg. Despite the pain and helplessness, Spitz struggled madly to keep up. He saw the silent circle, with gleaming eyes, lolling tongues, and silvery breaths drifting upward, closing in upon him as he had seen similar circles close in upon beaten antagonists in the past. Only this time he was the one who was beaten. There was no hope for him. Buck was inexorable. Mercy was a thing reserved for gentler climes. He maneuvered for the final rush. The circle had tightened till he could feel the breaths of the huskies on his flanks. He could see them, beyond Spitz and to either side, half-crouching for the spring, their eyes fixed upon him. A pause seemed to fall. Every animal was motionless as though turned to stone. Only Spitz quivered and bristled as he staggered back and forth, snarling with horrible menace, as though to frighten off impending death. Then Buck sprang in and out; but while he was in, shoulder had at last squarely met shoulder. The dark circle became a dot on the moon flooded snow as Spitz disappeared from view. Buck stood and looked on, the successful champion, the dominant primordial beast who had made his kill and found it good. away. At the Pelly one morning, as they were harnessing up, dolly, who had never been conspicuous for anything, went suddenly mad. She announced her condition by a long, heart-breaking wolf howl that sent every dog bristling with fear, then sprang straight for Buck. He had never seen a dog go mad, nor did he have any reason to fear madness; yet he knew that here was horror, and fled away from it in a panic. Straight away he raced, with Dolly, panting and frothing, one leap behind; nor could she gain on him, so great was his terror, nor could he leave her, so great was her madness. He plunged through the wooded breast of the island, flew down to the lower end, crossed a back channel filled with rough ice to another island, gained a third island, curved back to the main river, and in desperation started to cross it. And all the time, though he did not look, he could hear her snarling just one leap behind. Francois called to him a quarter of a mile away and he doubled back, still one leap ahead, gasping painfully for air and putting all his faith in that Francois would save him. the dog-driver held the axe poised in his hand, and as Buck shot past him the axe crashed down upon mad Dolly's head. Buck staggered over against the sled, exhausted, sobbing for breath, helpless. This was Spitz's opportunity. He sprang upon Buck, and twice his teeth sank into his unresisting foe and ripped and tore the flesh to the bone. Then Francois' lash descended, and Buck had the satisfaction of watching Spitz receive the worst whipping as yet administered to any of the team. "One devil, dat Spitz," remarked Perrault. "Some dam day him kill dat Buck." "Dat Buck two devils," was Francois's rejoinder. "All de time I watch dat Buck I know for sure. Lissen: some dam fine day him get mad like hell and den him chew dat Spitz all up and spit him out on de snow. Sure, I know." From then on it was war between them. Spitz, as lead-dog and acknowledged master of the team, felt his supremacy threatened by this strange Southland dog.F And strange Buck was to him, for of the many Southland dogs he had known, not one had shown up worthily in camp and on trail. They were all too soft, dying under the toil, the frost, and starvation. Buck was the exception. He alone endured and prospered, matching the husky in strength, savagery, and cunning.E Then he was a masterful dog, and what made him dangerous was the fact that the club of the man in the red sweater had knocked all blind pluck and rashness out of his desire for mastery. He was preeminently cunning, and could bide his time with a patience that was nothing less than primitive. PART 3 Mulan: Okay, okay, how 'bout this? Ahem, [in her manly voice] excuandanother man picking out dirt from between his toes with chopsticks] Beautifulisn't it? Mulan [making a face of disgust and continuing to walk]: They're disgusting. Mushu: No, they're men. And you're going to have to act just like them, sopay attention. [Mulan stops and watches Yao, Ling, Chien-Po and Tattoo Soldier] Tattoo Soldier [showing the dragon tattoo on his chest and belly]: Look, thistattoo will protect me from harm. [Yao thi Shang: What's your name? Mulan [stumbling]: Ahh, I, uhhh, I, uh-- Chi Fu [stepping into Mulan's face]: Your commanding officer just asked you a question. Mulan: Uhh, I've got a name. Huh. And it's a boys name too. Mushu [from the back of Mulan]: Ling, How 'bout Ling? Mulan [to Mushu motioning with her head to Ling]: His name's Ling. Shang: I didn't ask for his name. I asked for yours. Mushu: Try, uh, ahh, Chu! Mulan: Ah Chu. Shang: Ah Chu? Mushu: Gesundheit. He He, I kill myself. Mulan [whispering over her shoulder]: Mushu. Shang: Mushu? Mulan: No. Shang: Then what is it! Mushu: Ping! Ping was my best friend growing up! Mulan: It's Ping. Shang: Ping. Mushu: Of course Ping DID steal my gir-[Mulan reaches back and grabs holds Mushu's mouth together] Mulan: Yes, my name is Ping. Shang: Let me see your conscription notice. [Takes the notice from Mulan] Fa Zhou, *the* Fa Zhou? Chi Fu: I didn't know Fa Zhou had a son. Mulan: Um, he...doesn't talk about me much. [Mulan tries to hawk up a loogie and spit but the saliva just runs from her mouth. Therecruits laugh] Chi Fu: I can see why, the boy's an absolute lunatic. Shang [to the recruits]: Okay gentlemen, thanks to your new friend Ping, you'll spend tonight picking up every single grain of rice. Andtomorrow, the real work begins. [All recruits growl at Mulan] Mushu [Popping out the front of Mulan's armor]: You know, we have to work on your people skills. [Cut to Mulan sleeping in her tent. Mushu winds up Cri-Kee's wings. Cri-Kee rings like an alarm clock] S - GLAUCON AND thus, Glaucon, after the argument has gone a weary way, the true and the false philosophers have at length appeared in view. I do not think, he said, that the way could have been shortened. I suppose not, I said; and yet I believe that we might have had a better view of both of them if the discussion could have been confined to this one subject and if there were not many other questions awaiting us, which he who desires to see in what respect the life of the just differs from that of the unjust must consider. And what is the next question? he asked. Surely, I said, the one which follows next in order. Inasmuch as philosophers only are able to grasp the eternal and unchangeable, and those who wander in the region of the many and variable are not philosophers, I must ask you which of the two classes should be the rulers of our State? And how can we rightly answer that question? Whichever of the two are best able to guard the laws and institutions of our State --let them be our guardians. Very good. Neither, I said, can there be any question that the guardian who is to keep anything should have eyes rather than no eyes? There can be no question of that. And are not those who are verily and indeed wanting in the knowledge of the true being of each thing, and who have in their souls no clear pattern, and are unable as with a painter's eye to look at the absolute truth and to that original to repair, and having perfect vision of the other world to order the laws about beauty, goodness, justice in this, if not already ordered, and to guard and preserve the order of them --are not such persons, I ask, simply blind? Truly, he replied, they are much in that condition. And shall they be our guardians when there are others who, besides being their equals in experience and falling short of them in no particular of virtue, also know the very truth of each thing? There can be no reason, he said, for rejecting those who have this greatest of all great qualities; they must always have the first place unless they fail in some other respect. Suppose then, I said, that we determine how far they can unite this and the other excellences. By all means. In the first place, as we began by observing, the nature of the philosopher has to be ascertained. We must come to an understanding about him, and, when we have done so, then, if I am not mistaken, we shall also acknowledge that such an union of qualities is possible, and that those in whom they are united, and those only, should be rulers in the State. What do you mean? Let us suppose that philosophical minds always love knowledge of a sort which shows them the eternal nature not varying from generation and corruption. Agreed. And further, I said, let us agree that they are lovers of all true being; there is no part whether greater or less, or more or less honourable, which they are willing to renounce; as we said before of the lover and the man of ambition. True. And if they are to be what we were describing, is there not another quality which they should also possess? What quality? Truthfulness: they will never intentionally receive into their mind falsehood, which is their detestation, and they will love the truth. Yes, that may be safely affirmed of them. 'May be,' my friend, I replied, is not the word; say rather 'must be affirmed:' for he whose nature is amorous of anything cannot help loving all that belongs or is akin to the object of his affections. Right, he said. And is there anything more akin to wisdom than truth? How can there be? Can the same nature be a lover of wisdom and a lover of falsehood? Never. The true lover of learning then must from his earliest youth, as far as in him lies, desire all truth? Assuredly. But then again, as we know by experience, he whose desires are strong in one direction will have them weaker in others; they will be like a stream which has been drawn off into another channel. True. He whose desires are drawn towards knowledge in every form will be absorbed in the pleasures of the soul, and will hardly feel bodily pleasure --I mean, if he be a true philosopher and not a sham one. That is most certain. Such an one is sure to be temperate and the reverse of covetous; for the motives which make another man desirous of having and spending, have no place in his character. Very true. Another criterion of the philosophical nature has also to be considered. What is that? There should be no secret corner of illiberality; nothing can more antagonistic than meanness to a soul which is ever longing after the whole of things both divine and human. Most true, he replied. Then how can he who has magnificence of mind and is the spectator of all time and all existence, think much of human life? He cannot. Or can such an one account death fearful?
本文档为【基于VC++的图形实现-简单的图形编辑程序—免费毕业设计论文】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_083599
暂无简介~
格式:doc
大小:227KB
软件:Word
页数:0
分类:工学
上传时间:2017-10-06
浏览量:12