实用的COW示例程序?(Practical COW example program?)
是否有人在COW中编写过长或短的程序来演示它能做什么? 当然,语言是一个笑话; 但由于它是图灵完整的,也许有人写了一个高级语言,转化为COW。 在编写了一个简短实用的程序,至少显示了你在屏幕上输入的内容后,人们会认为有人在该语言中编写了一个更有趣的应用程序。
MoOMOOmoOMooMooOOOmOomoo
Has anyone written either a long or short program in COW that demonstrates what it can do? Sure, the language is a joke; but since it is Turing complete, maybe someone has written a high-level language that translates into COW. After writing a short, practical program that at least showed what you typed on the screen, one would think that someone has written a far more interesting application in the language.
MoOMOOmoOMooMooOOOmOomoo
原文:https://stackoverflow.com/questions/1805176
最满意答案
我发现自己是答案,这里举个简单的例子:
package main import ( "os" "time" "image" "exp/draw/x11" ) func main() { win, _ := x11.NewWindow() color := image.RGBAColor{255, 255, 255, 255} img := win.Screen() for i, j := 0, 0; i < 100 && j < 100; i, j = i + 1, j + 1 { img.Set(i, j, color) } win.FlushImage() time.Sleep(10 * 1000 * 1000 * 1000) win.Close() os.Exit(0) }
I found myself the answer, here it goes a simple example:
package main import ( "os" "time" "image" "exp/draw/x11" ) func main() { win, _ := x11.NewWindow() color := image.RGBAColor{255, 255, 255, 255} img := win.Screen() for i, j := 0, 0; i < 100 && j < 100; i, j = i + 1, j + 1 { img.Set(i, j, color) } win.FlushImage() time.Sleep(10 * 1000 * 1000 * 1000) win.Close() os.Exit(0) }
相关问答
更多-
mac 的 x11如何使用[2023-10-17]
"X Window系统"通常简称为"X11"或者"X" 在 mac 下不启动虚拟机还要运行 windows 程序的话这个是必不可少的, 使用类似 darwine 这样的程序打开 exe 文件时,你可以看到同时也调用了这个程序 摘录的几句话 懂了吧? 也就是说可以帮助运行一些exe文件,类似虚拟机 -
如何在Go中绘制X11(How to draw in X11 with Go)[2023-02-28]
我发现自己是答案,这里举个简单的例子: package main import ( "os" "time" "image" "exp/draw/x11" ) func main() { win, _ := x11.NewWindow() color := image.RGBAColor{255, 255, 255, 255} img := win.Screen() for i, j := 0, 0; i < 100 && j < 100; ... -
我认为使用XImage可以满足您的需求:请参阅https://tronche.com/gui/x/xlib/graphics/images.html XImage * s_image; void init(...) { /* data linked to image, 4 bytes per pixel */ char *data = calloc(width * height, 4); /* image itself */ s_image = XCreateImage(d ...
-
X11中的屏幕截图(Screenshots in X11)[2022-10-07]
在X11中截取屏幕截图的标准工具是使用 xwd -root > myscreen.xwd 然后,转换为.pnm xwd2pnm myscreen.xwd > myscreen.pnm 因此,您可以找到xwd的源代码并查看它是如何实现的, http ://cvsweb.xfree86.org/cvsweb/xc/programs/xwd/xwd.c?rev=HEAD&content-type=text/vnd.viewcvs -markup The standard tool for taking scr ... -
这是我的理解,X11使用自己的Windows服务器和通用堆栈。 这就是为什么它可以运行没有特殊端口的X11应用程序。 它只有一层模仿Cocoa窗口的响应,以便它可以与通用接口进行通信。 它不是一个变相的Cocoa堆栈,它的一个X11堆栈表面上伪装成Cocoa。 因此,它只响应可可相关消息的一个子集。 我认为在X11中要做任何严肃的事情,你必须从一开始就使用X11 API。 换句话说,就好像它不打算在Mac OS上运行一样。 All the X11.app sources and other stuff (X ...
-
新行“\ n”不会被Xft渲染。 您需要根据字体大小和所需的间距分别渲染每一行,并使用适当的偏移量。 我已经在单独的行上渲染了两次示例文本,修改了代码的结尾块。 if (ev.type == Expose) { int fonth = font->ascent + font->descent; XftDrawString8(draw, &xft_color, font, x, y, (XftChar8 *) str, strlen(str) ...
-
这个答案应该可以帮助你: “我如何在屏幕上为我的脚本绘制选择矩形?” Creditsbunt在askubuntu.com上发送到sdbbs #include
#include #include #include #include // added for sleep/usleep // original from [https://bbs.archlinux.org/viewtopic.p ... -
不是真的。 在非Windows系统上,GDI +依赖于开罗,而不是相反。 所以开罗是要走的路。 I used Mono.Cairo. It doesn't depend on X11 (in my case I build system with Buildroot tool).
-
X11 XImage操纵(X11 XImage manipulation)[2023-02-20]
经过进一步的研究和尝试,我最终找到了两个事实: 首先我的帖子是错误的:这不会崩溃: XPutImage(display, XDefaultRootWindow(display), XDefaultGC(display, screen), bg, 100, 100, 100, 100, 100, 100); 那些线路崩溃: XPutImage(display, wnd, XDefaultGC(display, screen), bg, 0, 0, 0, 0, 300, 300); XPutImage(dis ... -
裸骨x11如何绘制truetype或其他抗锯齿字体?(bare bones x11 how to draw a truetype or other antialiased font?)[2023-04-02]
不,X不会为你渲染字体,但它可以渲染反锯齿pixmap“Glyphs”的序列。 如果您只想使用核心X协议,则必须在客户端呈现所有内容(大多数库无论如何都会这样做,通常使用cairo库)。 我建议尝试:1)使用FreeType在本地预渲染字体的所有字形; 2)使用CreateGlyphSet Xrender请求上传字体; 3)使用CompositeGlyphs8 / 16/32请求绘制字符串。 阅读第12节 - XRender 文档的 “字形渲染”。 每个字形都有自己的偏移值,但无法定义字距调整对。 你还必须 ...