I wanted to touch up on my graphics programming today, so, seeing as how the CE has 8bpp mode, which could be useful for double-buffered, or even a temp buffer for graphics, here's a little thing that will take a png file and convert it into a format useable on the calculator.

Please see this topic for the latest information on CE image conversion. Thanks! Smile
So you use the program on the computer to convert an image, and then send it to your calc? (I haven't looked at the file so forgive me if I am wrong.)
Nice work Mateo! The tools that ive made for personal use are very clunky so its great to see something user friendly out there!

Can I ask what methods you are using for colour reduction?
Unicorn wrote:
So you use the program on the computer to convert an image, and then send it to your calc? (I haven't looked at the file so forgive me if I am wrong.)

Well, kind of. This makes it relatively simple to implement graphics, as things don't need to be hand-coded or messed around with. Smile

tr1p1ea wrote:
Nice work Mateo! The tools that ive made for personal use are very clunky so its great to see something user friendly out there!

Can I ask what methods you are using for colour reduction?

Well, color reduction right now is simply only taking the first colors that appear, moving left to right up and down. Later I will make it so it takes the ones that appear most often, or something along those lines.

Also, neat update! Smile Now you can convert to 1bpp, 2bpp, 4bpp and 8bpp images. Updated example program with each; if you want to play around with it; just edit a bmp in the example and save it, and then just compile and run. Enjoy!

Next on the to-do list is add the ability to specify the output name, input palettes to parse an image with, and xlibc conversion. Razz
EDIT: Oh, and error checking. When editing pictures, please be smart about it right now. Smile

EDIT: Woo, added the ability to add in different palettes! Now you can have a single palette and multiple images, and just use the same palette for each without having to do each individually! This is very useful for palatalized tilemaps and such, which gives me a question: Would it be helpful to have an option to split up an image into tiles?

Here's an example program, included in the actual converter, that uses a palette to display this 8bpp image on calc:


Enjoy all! Smile
In spasm and Brass you can include a .bmp file directly into your source, i'm not sure if something similar exists for spasm-ng, but if it doesn't a way to streamline including pictures might be nice. For example, providing a file with a list of your bitmaps, you run it through the program, it converts the list of images and spits out an include file with your sprite data. That way you could just add that to the top of your script/batch file before assembling your main program. I haven't done any programming for the color calcs yet so i'm not sure how this is generally handled.
Whelp, here you go: Now you can just have a file that the program can take. Of course, parsing of individual files works just as before.

For example, here is an example file:

Code:
-8
-pal
8bppPalette.bmp
8bppImage1.bmp
8bppImage2.bmp
-4
-nopal
4bppImage.bmp
-1
1bppImage1.bmp
1bppImage2.bmp

The -1,-2,-4,-8 tells the bit mode to parse the next files in, which can change throughout the file. -pal tells the program that the next file is a palette, and that it should use that palette to parse the next files. -nopal tells the program that it should stop using a palette and just parse each image individually. Is this useful, or should it be slightly different? Thanks! Smile

EDIT2: What do you guys think of a tile map extractor? You give it a tilemap with the size of tiles and the separation between tiles, and then it converts it to a usable tilemap index.
If anyone is still interested, I added in support to convert it to a palatalized tilemap... So that way your life is a lot easier. Smile Here's the new syntax for it:


Code:
-tp:tilewidth:tileheight

Where 'p' is either 1,2,4, or 8 depending on the bit mode. Enjoy; and please post if you would like anything added! Smile
This topic is now outdated and irrelevant. Please see this topic for the latest information on CE image conversion.
Mateo, you might want to update the first post with a pointer to the new topic as well, especially as i've been pointing people to this topic in the z80 help forums.
  
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 UTC - 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