如何做到这人code"的Hello World"与微软画图? [英] How did this person code "Hello World" with Microsoft Paint?

查看:199
本文介绍了如何做到这人code"的Hello World"与微软画图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚才已经看到了这一点在过去几天无法弄清楚它是如何工作。我谈的视频这里

I have just seen this within the past few days and cannot figure out how it works. The video I talk about is here:

这是<一个href=\"http://stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers/5509538#5509538\">the从这个堆栈溢出问题最受好评的答案:<一href=\"http://stackoverflow.com/questions/5508110/why-is-this-program-erroneously-rejected-by-three-c-compilers/5509143\">Why在这个计划由三个编译器拒绝?

这是怎么回事位图能够显示的Hello WorldC ++程序?

How is this bitmap able to show a C++ program for "Hello World"?

推荐答案

一个BMP(DIB)图像由报头后面uncom pressed 1 颜色的数据(24 BPP图像组成它的每个像素3个字节,存储在反向行顺序和​​4字节行的步伐)。

A BMP (DIB) image is composed by a header followed by uncompressed1 color data (for 24 bpp images it's 3 bytes per pixel, stored in reverse row order and with 4 bytes row stride).

有彩色数据的字节被用于重新present颜色(即其中没有被授权,由文件格式 2 ,它们都来自每个像素的颜色),并有一个完美的1:像素颜色和书面文件中的字节之间1的对应关系;因此,使用完美挑选的颜色,你可以实际编写任何你想要的文件中(用头除外)。

The bytes for color data are used to represent colors (i.e. none of them are "mandated" by the file format2, they all come from the color of each pixel), and there's a perfect 1:1 correspondence between pixel colors and bytes written in the file; thus, using perfectly chosen colors you can actually write anything you want in the file (with the exception of the header).

当你用记事本打开生成的文件,颜色数据将显示为文本;你可以还清楚地从头部看(部分从 BM 文本的开始),由文件格式授权。

When you open the generated file in notepad, the color data will be shown as text; you can still clearly see from the header (the part from BM to the start of the text), that is mandated by the file format.

在我看来这个视频做是这样的:首先笔者计算出所需的位图的大小,创造充满扩展为一个简单的图案颜色正确尺寸的DIB文件(例如所有字节65 => 'A');然后代替,例如图案的有效载荷code,如图视频

In my opinion this video was done this way: first the author calculated the size needed for the bitmap, and created a DIB file of the correct size filled with a color that expands to a simple pattern (e.g. all bytes 65 => 'A'); then replaced such pattern with the "payload" code, as shown in the video.

易发。

关于DIB格式更多信息


  1. 有RLE玉米pressed的DIB,但在这种情况下uncom $ P $用于pssed位图(和它们用于真很少反正)。

  2. 随着步幅的例外,这是使用的4字节的行的多个避免。

这篇关于如何做到这人code&QUOT;的Hello World&QUOT;与微软画图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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