图形学笔记1.直线扫描转换与devC的图形库ege扩展

图形学处理系统构造

光栅图形生成算法(RGB3只电子枪在屏幕中产生亮点)

数学点与像素点区别-整形(只能逼近

putpixal

几何描述(函数,数据

点阵图放大会变模糊,矢量图不会

图像处理-由图到图;

图形处理,描述画的时候提取关键点,建立模型

cad技术

 

进入光栅级别的最基本算法:线段-增量

点:扫描转换一个点(整形转换-向下取整/四舍五入)

线:每个点扫描

直线扫描转换(求斜率截距)

 

增量算法:每个y加增量k

计算斜率:C中如果两个数都是整数,结果是整数,需要除数中有浮点数。

加入图形库

成功安装egehttps://xege.org/beginner-lesson-1.html

先从EGE官网(http://www.xege.org  )下载安装包文件

安装包也可在我上传的下载列表找到:https://download.csdn.net/download/lagoon_lala/10978560

把安装包内 include 文件夹内所有文件,复制到你的编译器安装目录下的include目录内再把lib目录下的文件,根据自己的编译器,复制对应的东西到你的编译器安装目录下的lib目录内,具体编译器所依赖的文件情况:

  • Dev-cpp: 下载 https://pan.baidu.com/s/1qWxAgeK 里面的 “ege19.01_all (vc2017,vc2015,devcpp5.11)” 之后, 选择使用包内的头文件以及 ming64 目录里面的静态库文件, 然后按如下操作:
  • 这里使用的Dev-Cpp 的版本为 https://xege.org/install_and_config里面的版本
  • 假设我们的Dev-Cpp 安装在 C:\Dev-Cpp (下面的devc的目录请替换成自己的目录)
  • 将压缩包内的include里面的东西 (ege目录, ege.h, graphics.h) 复制到 C:\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include 目录下
  • 将压缩包内的 lib\mingw64\lib 里面的libgraphics64.a这个文件复制到 C:\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2 目录下
  • 新建一个 devc Console Application (控制台应用程序),  选择 C++ Project 编译运行一次, 确保devcpp正确安装
  • 在上方菜单栏选择 Tools->Compiler Options (工具->编译选项) 填入

-lgraphics64 -luuid -lmsimg32 -lgdi32 -limm32 -lole32 -loleaut32

  • 图形学笔记1.直线扫描转换与devC的图形库ege扩展

 

 

Easyx失败尝试

https://blog.csdn.net/shujiaw/article/details/82969394

:“graphics.h”: No such file or directory”

graphics.hturbo c特有的,它依赖dos调用

缺少easyx文件。

 接下来,就介绍一下手动配置一下easyx文件。

https://blog.csdn.net/hewei0241/article/details/8288715

 

easyx 目前不支持 dev-c++。由于 dev-c 使用 gcc,缺少一些预编译指令,因此每次建立项目都要引用库,比较麻烦,对许多初学者都不够友好,因此暂时不支持

如果一定要用 dev-c++,可以试试这个: http://www.cs.colorado.edu/~main/bgi/dev-c++/

https://daojin.iteye.com/blog/350990

 

报错

undefined reference to `putpixel(int, int, unsigned long)'

查看文档1

Using the WinBGIm Graphics Library with Dev-C++

Description:

This page provides a mechinism for using the WinBGIm Graphics Library with the Dev-C++ development environment.. Additional documentation for the WinBGIm graphics library is available at www.cs.colorado.edu/~main/bgi.

本页提供了在 Dev-C 开发环境中使用 winbgim 图形库的机制。www.cs.colorado.edu/~main/bgi 提供了 winbgim 图形库的其他文档

Installation Notes:

  1.         Install Dev-C++. I installed from the Version 4.9.9.2 Setup File.
  2.         Download graphics.h to the include/ subdirectory of the Dev-C++ directories.
  3.         Download libbgi.a to the lib/ In order to use the WinBGIm subdirectory of the Dev-C++ directories.
  4.         Whenever you #include <graphics.h> in a program, you must instruct the linker to link in certain libraries. The command to do so from Dev-C++ is Alt-P. Choose the Parameters tab from the pop-up window and type the following into the Linker area:

-lbgi

-lgdi32

-lcomdlg32

-luuid

-loleaut32

-lole32

安装注意事项:

  1.         安装 Dev-C。我从 "版本4.9.9.2 安装文件" 安装。
  2.         下载graphics.h Dev-C 目录的include/子目录。
  3.         下载  libbgi.a lib/以便使用 Dev-C 目录的 WinBGIm子目录。
  4.         每当您在程序中 #include  <graphics.h>, 则必须指示链接器在某些库中链接。从 Dev-C 执行此操作的命令是 Alt-P.。从弹出窗口中选择 "参数" 选项卡, 然后在 "链接器" 区域中键入以下内容

graphics.h (放入DEV-C++的安装路径/Dev-Cpp/include/

libbgi.a (放入DEV-C++的安装路径/Dev-Cpp/lib/

然后再在DEV-C++的工具栏中  工程(Project)->工程属性(Project Options)-> 参数(Parameters)的 连接器(Linker)中

You can now compile and run programs that use the WinBGIm graphics library, such as this one that opens a small window, draws a circle and waits for the user to press a key:

现在, 您可以编译和运行使用 winbgim 图形库的程序, 例如, 此程序打开一个小窗口, 绘制一个圆圈, 并等待用户按一个键:#include <graphics.h>

 

int main( )

{

    initwindow(400, 300, "First Sample");

    circle(100, 50, 40);

    while (!kbhit( ))

    {

        delay(200);

    }

    return 0;

}

查看文档2

1) Change the user default directory changed to the location where you plan to put your projects. This is found in Tools/Environment Options/Files & Dirs.
2) Add the following files to the Templates folder (they can be found in this zip archive file, devcFiles.zip).

1) 将用户默认目录更改为计划放置项目的位置。这可以在 tools/环境选项中找到。

2) 将以下文件添加到 "模板" 文件夹 (它们可以在此 zip 归档文件 devcfile. zip 中找到)

CS151.template (new)
ConsoleGDI.template (replacement)
BGI.ico (new)
cs151.ico (new)
CS151App_c.txt (new)
ConsoleGDI.txt (replacement)

3) Save libbgi.a & libconio.a from the zip archive to the lib directory.

4) Save winbgim.h, conio.h, and conio2.h from the zip archive to the include directory.