At the request of Souvik1997, I'm posting a brief tutorial explaining how to turn an 8x8 pixel or 5x5 pixel icon that you have drawn into hexadecimal, suitable for use in a Doors CS header or with the DCSB Libs tools for GUI creation. I'll start out with a simple 8x8-pixel icon; consider the following smiley face:



It is, of course, 8 pixels wide and 8 pixels tall, and every pixel is either white (which we'll call 0) or black (which we'll call one. We could, instead of using an image, represent this smiley in terms of 1s and 0s:


Code:
00111100
01000010
10100101
10000001
10100101
10011001
01000010
00111100


We'll deal with these in sixteen separate groups, each 4 digits long, like this:


Code:
0011 1100
0100 0010
1010 0101
1000 0001
1010 0101
1001 1001
0100 0010
0011 1100


Each of those sets of 4 will be converted into a single character, either a 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, or F. Here, 0 through 9 represent 0 through 9, while A=10, B=11, C=12, D=13, E=14, and F=15. Now, we'll take each set of 4 in turn, starting with the first set, which is 0011. The first of each set of four is worth 8, the next, 4, the next, 2, and the last, 1. So 0011 is 8*0 + 4*0 + 2*1 + 1*1, because there are 0s in the 8s and 4s place and 1s in the 2s and 1s place (think of it the way a 4-digit decimal number would have the first place worth 1000, the next 100, then 10, and finally 1). Therefore, 0011->3, the sum of 8*0 + 4*0 + 2*1 + 1*1.

The next one is 1100. Now this is worth 8*1 + 4*1 + 2*0 + 1*0. The sum of that is 12, agreed? Now, if we look about, we see that 12=C, so for the first row of the icon, we have 3 and C, or 3C. If we follow through to complete the whole icon this way, we'll get:


Code:
3C
42
A5
81
A5
99
42
3C


To use that, we'll just concatenate: 3C42A581A599423C

To make a 5x5 Doors CS icon for windows, for example, we start instead with 5 rows and 8 columns, but only fill in the first five columns of the 8 columns with any 1s or 0s, and leave the last three columns as 0s. We follow the same process as above, but for five rows, yielding in the end 10 hex characters that we can use.

Any unclearnesses? How does this hit people?
Thanks, that was easy to understand. Good Idea
Nice tutorial. I wrote one myself a while ago, but it was a bit less detailled and it's kinda lost somewhere on my forum in a topic. It can be helpful for converting sprites, although I assume for 100 sprites it might take quite a while Razz
souvik1997 wrote:
Thanks, that was easy to understand. Good Idea
Glad to hear it, souvik, cheers. Smile

@DJ: Aye, it might get time consuming for 100 sprites, but on the other hand you get to the point where you can skip the addition step and just know the hex from looking at it, if you've looked at as many sprites as I (and I'm sure you too) have. It wouldn't be a terrible idea to upgrade my old TI-BASIC DCS header creator program to work with all of the current header styles.
"consider the following smiley face" actually makes me laugh out loud every time I read it.
merthsoft wrote:
"consider the following smiley face" actually makes me laugh out loud every time I read it.
Excellent. Smile I will totally need to figure out a way to put that phrase into a scholarly paper.
Well if this seems to hard for you guys to do on your own, post a Binary string, and I will convert to hex for you free of charge. Very Happy

You can not say that is not an amazing deal.

Also, good tutorial Kerm. ;D
I assume you mean binary string?
Also, this isn't that great of a deal. There is software that will basically do this for you (such as my Tokens IDE):
merthsoft wrote:
I assume you mean binary string?
Also, this isn't that great of a deal. There is software that will basically do this for you (such as my Tokens IDE):


Yeah, I need to edit that, thanks. And programs or not, they are never 100% perfect, they have limits, as for me, size is not an issue.
Very Happy
This program can make a 65535x65535 spirte into a hex string with 0 mistakes. Can you say the same?
merthsoft wrote:
This program can make a 65535x65535 spirte into a hex string with 0 mistakes. Can you say the same?


Given time, yes.
I have a feeling that the margin of error with a person is a lot higher than a program. And a program is a lot faster.

Now, as much fun as this pissing contest is, I think it's a lot harder for you to argue 100% accuracy than a provable algorithm.
merthsoft wrote:
I have a feeling that the margin of error with a person is a lot higher than a program. And a program is a lot faster.

Now, as much fun as this pissing contest is, I think it's a lot harder for you to argue 100% accuracy than a provable algorithm.


Just wait, a Y2K type will happen again, this time all computers will cease to work, then I come in and do it... Very Happy
Sonlen wrote:
merthsoft wrote:
This program can make a 65535x65535 spirte into a hex string with 0 mistakes. Can you say the same?


Given time, yes.
Based on the errors you made in converting your minimized bar to hex, I'm not too confident in your abilities. Wink
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement