系统调用以在c(linux)中绘制点 [英] System call to plot a point in c( linux)

查看:56
本文介绍了系统调用以在c(linux)中绘制点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Linux系统调用的新手.我的问题是我们在Linux中有一个系统调用可以在屏幕上绘制点吗?我用Google搜索了它,但找不到任何简单的解释.我想在Linux中编写一个简单的C程序,无需C图形库就可以在屏幕上直接绘制一个点.

I am new to Linux system calls.My question is do we have a system call in Linux to plot points on screen.I googled it but could not find any simple explanation for it. I want to write a simple C program in Linux that directly plot a point on screen without the help of a C graphics library.

如果没有这样的系统调用,如何创建自己的系统调用以在屏幕上绘制点?

If there is no such system call how can I create my own system call to plot point on screen?

推荐答案

Linux上最低级别的独立于硬件的图形界面是

The lowest level hardware independent graphics interface on linux is the framebuffer. This is manipulated by writing to a device node (generally /dev/fb0) which is the equivalent of a system call, since it is a means of sending requests to the kernel. So this does not require any libraries.

一种常见的方法似乎是 mmap()一块代表用户屏幕的用户空间内存,然后将其操作到/dev/fb0 .有一些 ioctl()调用可获取有关帧缓冲区显示的信息.信息的一个很好的起点是内核源代码中的文档- src/Documentation/fb 是一个完整目录,请参见例如那里有"framebuffer.txt"和"api.txt".如果您在线上看,这里有一些教程等.不管您看哪个内核版本源都没有关系-"api.txt"的最新版本是2011年,而"framebuffer.txt"的最新版本是十年前的(因此界面非常稳定).

A common approach seems to be to mmap() a chunk of user space memory representing the screen to /dev/fb0 and then manipulating that. There are some ioctl() calls to get information about the framebuffer display. A good starting place for information would be the docs in the kernel source -- src/Documentation/fb is a whole directory, see e.g. "framebuffer.txt" and "api.txt" there. There are a few tutorials and such around if you look online. It doesn't matter particularly which kernel version source you look at -- the last revision of "api.txt" was 2011 and "framebuffer.txt" a decade before that (so the interface is very stable).

请注意,您不能在X内部使用帧缓冲区.如果要在X内部进行图形处理,则必须至少使用

Note that you can't use the framebuffer from within X. If you want to do graphics stuff within X, you have to use at least Xlib, or a higher level library built on that.

这篇关于系统调用以在c(linux)中绘制点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆