首页 \ 问答 \ 实用的COW示例程序?(Practical COW example program?)

实用的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
更新时间:2022-05-06 20:05

最满意答案

我发现自己是答案,这里举个简单的例子:

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)
}

相关问答

更多
  • "X Window系统"通常简称为"X11"或者"X" 在 mac 下不启动虚拟机还要运行 windows 程序的话这个是必不可少的, 使用类似 darwine 这样的程序打开 exe 文件时,你可以看到同时也调用了这个程序 摘录的几句话 懂了吧? 也就是说可以帮助运行一些exe文件,类似虚拟机
  • 我发现自己是答案,这里举个简单的例子: 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中截取屏幕截图的标准工具是使用 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).
  • 经过进一步的研究和尝试,我最终找到了两个事实: 首先我的帖子是错误的:这不会崩溃: 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 ...
  • 不,X不会为你渲染字体,但它可以渲染反锯齿pixmap“Glyphs”的序列。 如果您只想使用核心X协议,则必须在客户端呈现所有内容(大多数库无论如何都会这样做,通常使用cairo库)。 我建议尝试:1)使用FreeType在本地预渲染字体的所有字形; 2)使用CreateGlyphSet Xrender请求上传字体; 3)使用CompositeGlyphs8 / 16/32请求绘制字符串。 阅读第12节 - XRender 文档的 “字形渲染”。 每个字形都有自己的偏移值,但无法定义字距调整对。 你还必须 ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。