Saturday, April 9, 2011

Pixel Coding

  What we have here is what is called pixel coding. More of an art than an actual coding language, pixel coding takes advantage of the common language between all computer files, binary. Colors can be encoded in differing amounts of bits, 12 or 24 or 32 or more, depending on what is needed by the user. By controlling red, blue, and green values along with opacity, it's possible to generate any 32 bit binary string needed. Along with an understanding of application programming interfaces, or APIs, and knowing the binary strings needed to generate different function calls, it's possible to translate to them directly. A system's API is the set of instructions that allow the user to utilize the functionality build into the system. Aside from some header information depending on the file extension, changing the file from .raw to .com shouldn't change the binary strings located within. The API generated by the file created a texture tunnel from nothing but pixels.

2 comments:

  1. I have no idea what you just said. But guessing this post isn't meant for me.

    ReplyDelete
  2. Jen,

    Sorry, this was definitely one of those "this is cool so I want to post about it" posts. Here's a brief and simplified example:

    Let's say you wanted to add two numbers together. You fire up your compiler and make a program that does x=2+3. The compiler translates that code over several levels until it reaches binary, which the computer can understand. Let's say that line of code translates to 10011011 as an eight bit string, saying add 2 and 3 and place them in a memory address know as x.

    Now, if you know this string of binary and know how your computer stores colors in a picture, we open a painting program. If we had eight bit color, it could be the first two bits are for opacity, second set is for red, third set for green, and the last set for blue. We create a color that has '10' opacity, '01' or slightly red, '10' or very green, and '11' or maximum blue and place it on a 1x1 pixel sized board and save it.

    Now both files have an eight bit string '10011011'. Ignoring additional information that would be in both files that are used by different programs based on file extension (.exe, .jpg, etc.) both files are identical. So opening either program in the paint program should generate the same pixel color and opening both as the compiled language would execute the command 'x=2+3'.

    ReplyDelete