Create dosbox_logo.h from icon file?

Developer's Forum, for discussion of bugs, code, and other developmental aspects of DOSBox.

Create dosbox_logo.h from icon file?

Postby emendelson » 2010-11-30 @ 22:43

I'm trying to use a custom icon in my DOSBox builds, and want to replace the icon in dosbox_logo.h, which defines the icon that appears at the upper left of the title bar.

@ykhwong posted a very nice version of a "Z:" icon in another thread, in the correct format for dosbox_logo.h. And I think I see how I could create the code for my own icon, but I can only see how to create it by hand, by typing in the correct number for every pixel.

Is there a way to generate those numbers automatically, without doing typing in the code for every pixel by hand? If so, could someone kindly explain how this might be done?

Thanks for your help.
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00

Re: Create dosbox_logo.h from icon file?

Postby Dominus » 2010-12-01 @ 00:36

Google convert binary or picture to code or text
User avatar
Dominus
DOSBox Moderator
 
Posts: 7673
Joined: 2002-10-03 @ 09:54
Location: Ludwigsburg

Re: Create dosbox_logo.h from icon file?

Postby emendelson » 2010-12-01 @ 03:52

Thank you - that pointed me to plenty of code that does the job. As far as I can see, there's no prebuilt application that does it.
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00

Re: Create dosbox_logo.h from icon file?

Postby bloodbat » 2010-12-01 @ 03:57

Yes there are prebuilt binaries...for Linux, as far as I recall.
For example png2c.
User avatar
bloodbat
Oldbie
 
Posts: 792
Joined: 2009-12-06 @ 07:11

Re: Create dosbox_logo.h from icon file?

Postby ykhwong » 2010-12-01 @ 04:03

Use this to convert your icon to PPM (32bit array).
http://netpbm.sourceforge.net/doc/ppm.html

If you get something like this:
Code: Select all
P3
# temp.ppm
4 4
15
1 7 2 15 1 15 0 0 0 15 0 15
0 3 0 3 1 7 0 0 0 0 0 0
0 1 7 0 0 0 0 3 7 0 3 0


Remove lines from P3 to 15 and add a zero after 3 numbers and add "," in between.
Code: Select all
1, 7, 2, 0, 15, 1, 15, 0, 0, 0, 0, 0, 15, 0, 15, 0,...
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Create dosbox_logo.h from icon file?

Postby emendelson » 2010-12-01 @ 05:04

I will try that. Thank you!
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00

Re: Create dosbox_logo.h from icon file?

Postby Qbix » 2010-12-01 @ 08:10

that is what I do more or less as well.
Water flows down the stream
How to ask questions the smart way!
User avatar
Qbix
DOSBox Author
 
Posts: 10677
Joined: 2002-11-27 @ 14:50
Location: Fryslan

Re: Create dosbox_logo.h from icon file?

Postby Dominus » 2010-12-01 @ 09:24

There are also tools for Windows just don't know anymore where to find. I did some firefox customization some years ago and for that you needed to convert the pictures as well...
User avatar
Dominus
DOSBox Moderator
 
Posts: 7673
Joined: 2002-10-03 @ 09:54
Location: Ludwigsburg

Re: Create dosbox_logo.h from icon file?

Postby emendelson » 2010-12-01 @ 15:34

Thank you again. If anyone finds the Windows tool, I would be grateful.

It looks as if it should be easy to automate the procedure of adding the zeros and the commas. A macro in a good text editor or a word-processor should do it. I'll experiment and report.
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00

Re: Create dosbox_logo.h from icon file?

Postby Dominus » 2010-12-01 @ 15:38

You can probably find a windows binary of png2c, or you can compile it yourself (since you are compiling dosbox yourself you should be able to)
User avatar
Dominus
DOSBox Moderator
 
Posts: 7673
Joined: 2002-10-03 @ 09:54
Location: Ludwigsburg

Re: Create dosbox_logo.h from icon file?

Postby ykhwong » 2010-12-01 @ 15:53

1. Copy the contents of PPM to notepad or MS word. (Like mentioned above, remove four lines of header in advance)
2. Press Ctrl-H and replace space(" ") to tab(^t).
3. Copy all again to MS Excel.
4. Insert cells after 3 columns so that D, H, L, P will have empty rows.
5. Fill rows of D, H, L, P columns with 0.
6. Copy everything to notepad
7. Press Ctrl-H and replace the existing tabs to ", " (comma space)

[EDIT] This is not an automation but it could be better than manually adding 0 and comma.
ykhwong
Oldbie
 
Posts: 627
Joined: 2004-3-17 @ 15:35

Re: Create dosbox_logo.h from icon file?

Postby emendelson » 2010-12-04 @ 03:45

I've found a free Windows program that can create ascii-format PPM files to be used for the dosbox_logo.h file (after following @yhkwong's procedure):

http://www.xnview.com/

I've had complete success with @ykhwong's procedure. Thank you!
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00

Re: Create dosbox_logo.h from icon file?

Postby emendelson » 2014-2-10 @ 16:21

I've been trying to create a new dosbox_logo.h, and the current version of the tools I used before don't seem to work any longer.

Xnview now produces a long single string of digits, not the twelve-column rows that ykhwong describes above.

I found this:

http://sourceforge.net/projects/png2cscc/?source=dlp

But it outputs lines with 16 hex numbers, not 12 dec numbers.

I suppose I can convert all this to the right format, but I wonder if anyone knows of a Windows or OS X-based tool that will create the kind of 12-number rows that ykhwong describes, and which I used to be able to create easily from third-party tools.
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00

Re: Create dosbox_logo.h from icon file?

Postby emendelson » 2014-2-10 @ 22:34

Found the answer:

http://gnuwin32.sourceforge.net/packages/netpbm.htm

The executable bmptoppm.exe produces a file that's close enough to what I was looking for, with the command:

Code: Select all
bmptoppm.exe -plain d:\path\bmpfile.bmp > d:\path\output.ppm


You end up with some lines of different lengths, but it's not hard to sort this out in Excel.

One addition to ykhwong's instructions: after step 7, also replace the paragraph breaks with comma-space-paragraphbreak or the resulting output won't work.
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00

Re: Create dosbox_logo.h from icon file?

Postby emendelson » 2014-2-20 @ 03:05

Well, after doing all this work by hand (inserting empty columns in Excel, etc.), I found this online tool, which does the job automatically. Probably I'm the last person on earth to know about this page:

http://adrianoesposito.altervista.org/c ... oTools.htm
emendelson
Oldbie
 
Posts: 746
Joined: 2010-2-14 @ 02:00


Return to DOSBox Development

Who is online

Users browsing this forum: No registered users and 1 guest