Grid Sage Forums

REXPaint => Everything REXPaint => Topic started by: Phssthpok on June 06, 2015, 06:26:18 AM

Title: Web-based REX viewer
Post by: Phssthpok on June 06, 2015, 06:26:18 AM
I'm working on a web-based REX viewer. It's still pretty rough, but it gets the right tiles in the right location with the right foreground color. Give it a try:

http://jjclark1982.github.io/rex-viewer/ (http://jjclark1982.github.io/rex-viewer/)
Title: Re: Web-based REX viewer
Post by: Kyzrati on June 06, 2015, 06:38:59 AM
Wow, and I thought you were busy enough doing cool things with the wiki :P

This is pretty neat... what might it be used for? Any plans? I dropped some stuff in and can see that it's missing the background color implementation, but other than that it works nicely so far.
Title: Re: Web-based REX viewer
Post by: Phssthpok on June 06, 2015, 06:53:23 AM
I thought it might be useful for importing item screenshots to the wiki. Are you ok with that in terms of copyright? It's easy to limit to items that other people have already spoiled.

I had done some similar work for Dwarf Fortress tilesets (http://jjclark1982.github.io/df-tileset-previewer/ (http://jjclark1982.github.io/df-tileset-previewer/)), so this was mostly a matter of parsing the binary format. But at this point I might as well get backgrounds working too.
Title: Re: Web-based REX viewer
Post by: Kyzrati on June 06, 2015, 07:44:39 AM
Nice DF tileset previewer!

I hadn't yet made the connection that this could be related to your wiki endeavor. I do need to put a proper copyright message up on the wiki, but yeah eventually images and art can/should all be there, anyway. I'm okay with that and expected it to happen at some point.
Title: Re: Web-based REX viewer
Post by: Phssthpok on June 06, 2015, 09:36:37 AM
I think I have colors painting properly now. Is it correct to treat the final color as a linear interpolation between the bg color and the fg color, determined by the brightness of the font pixel?

It still doesn't handle font files with over 256 chars, so it's hard to find a good grayscale font to inspect visually.
Title: Re: Web-based REX viewer
Post by: Kyzrati on June 06, 2015, 08:55:09 PM
Background colors are simply painted in each cell, and foreground pixels are painted over that using the grayscale value (0-255) of each font pixel to set the alpha transparency at that point.

Unless I've misunderstood what you're asking here...
Title: Re: Web-based REX viewer
Post by: Phssthpok on June 06, 2015, 10:16:38 PM
Yeah, that sounds equivalent to the linear interpolation I'm using:

Code: [Select]
bgColor + (fontColor / 255) * (fgColor - bgColor)
Title: Re: Web-based REX viewer
Post by: ironpotato on June 10, 2015, 04:25:27 PM
Man I was just going to make something to view the game files but it looks like yours already works for it :P So much for that.

Good job on this though, very well done. I was considering making the viewer in javascript myself xD
Title: Re: Web-based REX viewer
Post by: Kyzrati on June 10, 2015, 08:37:26 PM
You guys are really good at spoiling yourselves =p
Title: Re: Web-based REX viewer
Post by: Phssthpok on June 10, 2015, 08:54:09 PM
Yeah, this will view Cogmind art files.

But I'm not sure how to handle Cogmind font files, which are not laid out in normal ASCII order. I hard-coded some mappings for obvious things like letters and punctuation, but there are still a lot of unreachable or duplicate tiles.