Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: bwang on June 09, 2010, 02:34:28 am

Title: Nspire bmp viewer
Post by: bwang on June 09, 2010, 02:34:28 am
I was experimenting with bitmap file loading today, and the program has reached a semi-usable state, so here it is.
It has no file browsing, so to use it, you will need a 24-bit bmp file with dimensions less than 320x240, renamed to
test.tns and placed in a folder called bmpviewer on the Nspire. It has only been tested with bitmaps produced by the GIMP.
Hopefully I will figure out how to add more features (like browsing) in the future.
Enjoy!
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on June 09, 2010, 02:36:27 am
mhmm interesting I shall try it out when I get some time. I believe someone did something similar on TI-BANK a while ago but it was never tested on real hardware and is only in french.

Will you eventually support different bmp formats as well as gif/jpg/png?
Title: Re: Nspire bmp viewer
Post by: bwang on June 09, 2010, 02:38:32 am
Different bmp formats and gif, maybe.
JPG/PNG, probably no. The compression in JPG is rather complex.
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on June 09, 2010, 02:38:52 am
aaah ok, sound good still :)
Title: Re: Nspire bmp viewer
Post by: TIfanx1999 on June 09, 2010, 07:55:06 am
That's pretty sweet! It's nice that the Nspire will have an actual bmp viewer. Cool stuff! ^^.
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on June 09, 2010, 12:50:11 pm
Sorry but I can't get it to work :(

I followed instructions in the readme and even tried with both my own pics and your examples, renamed to test.tns and tested one by one and when I run the viewer all I get is a blank screen until I press ESC (which quits back to the Nspire) ???
Title: Re: Nspire bmp viewer
Post by: SirCmpwn on June 09, 2010, 12:51:58 pm
Good stuff, bwang.  Sounds pretty cool.  Now, lets get a rickroll to work on an Nspire.
Title: Re: Nspire bmp viewer
Post by: bwang on June 09, 2010, 03:25:38 pm
DJ, did you put them in a folder called bmpviewer? The pictures and the program need to be in the same directory.
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on June 09, 2010, 03:40:29 pm
oh it needs to be in that directory in particular? You should probably make it directory-independent in future versions (even if the images still has to be in the same directory as the app. just not force the app to be in bmpviewer, or at least explain more clearly in the readme (which I read, btw) that the app absolutely needs to be in that directory). Thanks for the tip, though.
Title: Re: Nspire bmp viewer
Post by: ztrumpet on June 09, 2010, 03:47:50 pm
oh it needs to be in that directory in particular? You should probably make it directory-independent in future versions (even if the images still has to be in the same directory as the app. just not force the app to be in bmpviewer, or at least explain more clearly in the readme (which I read, btw) that the app absolutely needs to be in that directory). Thanks for the tip, though.
DJ,
Hopefully I will figure out how to add more features (like browsing) in the future.
Bwang, this sounds neat!  Now if only I had an Nspire... ;D
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on June 09, 2010, 03:50:34 pm
Yeah I know, I meant it might be good to clarify that the viewer has to be in one folder in particular to run.
Title: Re: Nspire bmp viewer
Post by: fb39ca4 on July 10, 2010, 02:19:49 pm
If this could work with animated gifs, it would be boss.
Title: Re: Nspire bmp viewer
Post by: apcalc on July 10, 2010, 04:45:57 pm
I think I missed this when it was originally posted.  I just tried this out and it works nicely! :) Great job!
Title: Re: Nspire bmp viewer
Post by: bwang on August 05, 2010, 02:45:11 am
Many weeks later, I have finally added file browsing (of a sort).
Limitations:
bmps must be 320x240 or less, and 24-bit
bmp names must be of the form *.bmp.tns
bmps must reside in a directory called bmpviewer (the program itself need not reside there)

Controls: At the file selection screen, press RETURN (next to ENTER) to view. Press ESC to exit from the viewing.
The controls aren't very smooth since the keypress delay method I use is terrible so you may have to hold a key down for a while for it to register.

The program is compilable for NON-CAS only, since I don't have the directory listing functions for the CAS.
Next up: scrolling (easy) and images in different directories (I don't know how hard that will be yet).
Title: Re: Nspire bmp viewer
Post by: TIfanx1999 on August 05, 2010, 08:31:41 am
Nice to see updates! :) I may actually be getting a Nspire soon, but I haven't decide yet.
Title: Re: Nspire bmp viewer
Post by: fb39ca4 on August 05, 2010, 02:29:16 pm
Yaay! I just loaded up my calc with epic fail pics.
Why is the keypress detection slow?
Title: Re: Nspire bmp viewer
Post by: TIfanx1999 on August 05, 2010, 02:44:19 pm
From the previous page :):
The controls aren't very smooth since the keypress delay method I use is terrible so you may have to hold a key down for a while for it to register.
Title: Re: Nspire bmp viewer
Post by: fb39ca4 on August 05, 2010, 02:58:39 pm
I wasn't clear, I really meant why is this keypress method used?
Title: Re: Nspire bmp viewer
Post by: bwang on August 05, 2010, 04:33:07 pm
Because I haven't figured out an intelligent way to do it, so I just refresh the screen 20 times each iteration of the loop.
Title: Re: Nspire bmp viewer
Post by: bwang on August 05, 2010, 07:12:14 pm
Doublepost is bad, I know, but here's a minor update. It now only refreshes 3x instead of 20.
Also, you now click at the file selection screen, instead of pressing RETURN.
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on August 05, 2010, 07:16:35 pm
It isn't as bad if it's made within the forum rules ;) (which is currently the case, since it has been more than one hour for a project update :P)

I'll have to give this a try again at one point. Last time I didn't get it to work, but I think I started to figure out
Title: Re: Nspire bmp viewer
Post by: bwang on August 05, 2010, 07:32:26 pm
Yet another update! Press +/- when viewing to change the contrast.
Title: Re: Nspire bmp viewer
Post by: bwang on August 06, 2010, 01:30:29 am
A bugfix update: the program now calls free() appropriately at the end of main() to free the malloc'd blocks of memory. This should prevent some random crashes I've been getting.
Also, attached some screenies. We all love screenies, right? :)
Title: Re: Nspire bmp viewer
Post by: apcalc on August 06, 2010, 09:12:49 am
Very nice bwang!

Great job :)
Title: Re: Nspire bmp viewer
Post by: ztrumpet on August 06, 2010, 02:21:27 pm
Wow, excellent job!  Nice work bwang! ;D
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on August 06, 2010, 09:54:58 pm
Darn it must look quite nice on calc.
Title: Re: Nspire bmp viewer
Post by: apcalc on August 06, 2010, 10:23:42 pm
Heres a nice screenshot:

(http://i974.photobucket.com/albums/ae226/apcalc/bmpviewer.gif)

It looks great on hardware too!
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on August 08, 2010, 05:27:53 pm
Nice, even better with the dithering ^^
Title: Re: Nspire bmp viewer
Post by: fb39ca4 on August 09, 2010, 12:01:04 pm
I think that dithering was from the screenshot program-it is dithered in the border of the emulator.
Title: Re: Nspire bmp viewer
Post by: apcalc on August 09, 2010, 12:05:46 pm
Yeah, I think that was caused by Windows Snipping Tool.  It is like that on all screenshots I take with it.
Title: Re: Nspire bmp viewer
Post by: fb39ca4 on August 09, 2010, 12:17:16 pm
Still, actual dithering wouldn't be too hard to implement.
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on August 09, 2010, 12:28:12 pm
oh that's why prbly then x.x, my bad
Title: Re: Nspire bmp viewer
Post by: fb39ca4 on August 09, 2010, 01:05:53 pm
I just had another idea-256 level grayscale!
Title: Re: Nspire bmp viewer
Post by: Builderboy on August 09, 2010, 03:00:16 pm
:O Thats so awesome Bwang! Heh nspire built in greyscale is making us all warm and fuzzy inside :]
Title: Re: Nspire bmp viewer
Post by: willrandship on August 09, 2010, 03:15:00 pm
Will we be able to see the difference between 64-level and 256-level?

Especially on the nspire's screen :P not to discourage.
Title: Re: Nspire bmp viewer
Post by: apcalc on August 09, 2010, 03:18:17 pm
Actually, the transition between the 16 shades of grayscale on the Nspire's screen is not that great.  It is almost like there are only four levels with several close shades in each level.  Although the still look nice, I have not found a pic that looks better on hardware than on the emulator.
Title: Re: Nspire bmp viewer
Post by: DJ Omnimaga on August 09, 2010, 03:38:54 pm
Ouch that kinda sucks. I guess it's like the regular 83+ with more than 5 level grayscale x.x, where we only saw like 60% of the shades.