BBC BASIC
« RISC OS Sprite reader »

Welcome Guest. Please Login or Register.
Mar 31st, 2018, 11:11pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Cross-platform BBC BASIC (Windows, Linux x86, Mac OS-X, Android, iOS, Raspberry Pi)
BBC BASIC Resources
BBC BASIC Help Documentation
BBC BASIC for Windows Home Page
BBC BASIC Programmers' Reference
BBC BASIC Beginners' Tutorial
BBC BASIC for SDL 2.0 Home Page
BBC BASIC Discussion Group

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: RISC OS Sprite reader  (Read 1299 times)
hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 55
xx RISC OS Sprite reader
« Thread started on: Jun 18th, 2017, 10:55am »

Hi,

For a project I'm thinking about, I need to display Sprite images from my VirtualRPC hard disk on a Microsoft window.

I'm therefore wondering if their is already (freeware) BB4W code available that someone wrote or in a library to achieve this. A Windows command line executable, that converts to e.g. BMP or JPG would also do.
Of course I'm not interested that some graphics packages, like Photoshop, can import Sprites because that won't help displaying it onto my projects window.

Since the file layout for both Acorn's Sprite files and Microsoft's ( ? ) BMP files are documented, I'm pretty confident I can write the conversion code myself. Actually it would be a challenge, however if this already has been done, I don't want to reinvent the wheel!

Thanks

Mike
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #1 on: Jun 18th, 2017, 4:16pm »

on Jun 18th, 2017, 10:55am, hellomike wrote:
I'm therefore wondering if their is already (freeware) BB4W code available that someone wrote or in a library to achieve this.

I Googled it - so could you - and the first hit was this thread (from 1899, or so it says!) which seems to contain several suggestions.

Richard.
User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 55
xx Re: RISC OS Sprite reader
« Reply #2 on: Jun 19th, 2017, 09:32am »

Of course I Googled it but all I found was RISC OS utilities or people recommending using ChangeFSI from the command line.

As far as I can see, the suggestions in the thread you found also are about someone programming in RISC OS, not Windows.

Not much use when I'm using BB4W and have a 'Image,ff9' file on my hands.

Thanks for checking though Richard.

Mike
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #3 on: Jun 19th, 2017, 5:27pm »

on Jun 19th, 2017, 09:32am, hellomike wrote:
Not much use when I'm using BB4W and have a 'Image,ff9' file on my hands.

You stated in your question 'VirtualRPC' which is a Windows program! So naturally I assumed that RISC OS solutions would be entirely relevant to you because you could run them in VRPC. Why can't you?

If for some reason you need to perform the conversion in a native Windows program this post by Jeroen Groenendaal says he created one. You could try contacting him.

Richard.
User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 55
xx Re: RISC OS Sprite reader
« Reply #4 on: Jun 20th, 2017, 08:07am »

Ah, OK. Sorry for the confusion. I mentioned VirtualRPC to clarify why I would have a bunch of RISC OS sprite files.

Although those sprite files are created and maintained under RISC OS, I need to access them in Windows using BB4W.

Thanks for the link to the post, it might be useful.

The Acorn sprites I need to handle are simple ones in which I don't need to consider masks and <100k.
Shouldn't be too difficult to convert although I'm not yet familiar with the BMP format. I assume BMP is the most logical (documented) format to convert to as it can be discarded after displaying it in a window.

Maybe its even possible to read a pixel from the sprite file and then PLOT 69 it to the screen!
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #5 on: Jun 20th, 2017, 08:35am »

on Jun 20th, 2017, 08:07am, hellomike wrote:
Although those sprite files are created and maintained under RISC OS, I need to access them in Windows using BB4W.

Let me see if I have understood properly. You could convert them to BMP format in RISC OS but you prefer not to because they are actively maintained so you would need to repeat the conversion after every alteration, is that right?

In that case would it not be possible to create the RISC OS equivalent of a 'batch' or 'command' file that converts all your sprites into BMP in an automated way? Then all you would need to do is to run that process whenever you need the BMP versions of the sprites.

Quote:
The Acorn sprites I need to handle are simple ones in which I don't need to consider masks

BMP format doesn't support masks (except for non-standard extensions using 32-bit ARGB pixels); in the Windows world you need to use an icon (.ICO) or cursor (.CUR) file for that.

Writing your own conversion routine from scratch would, I fear, be a lot of work, especially if you want it to handle the full range of options for size, colour depth etc. I would find it difficult myself, and I have years of experience of creating and working with BMP files.

Richard.
User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 55
xx Re: RISC OS Sprite reader
« Reply #6 on: Jun 20th, 2017, 8:24pm »

Quote:
You could convert them to BMP format in RISC OS but you prefer not to because they are actively maintained

That's correct.

Let me be more specific.
- believe it or not but I still maintain my vinyl and CD collection data, like title, price, date purchased etc, in !MultiStor in RISC OS (via VirtualRPC)
- this data includes a cover art picture which !MultiStor stores as a path where the sprite is located on the hard disk
- with a BASIC V program I once made, which sequentially reads the !MultiStor database and copies all the data to one big flat ASCII file (currently just 750Kb) and I run this program after each edit in the !MultiStor database (takes only a few seconds)
- now, when I want to see the data, for a certain album title in Windows, I just read that data from the ASCII flat file

However when entering the album title in Windows, in addition to date purchased etc I also want to see what cover art is used for that title.
From the ASCII file I can get the path to the sprite file but.... how to display that cover art from that sprite file in Windows?

Quote:
I would find it difficult myself

Coming from someone who wrote a full blown very powerful interpreter all is assembly language and a lot of image processing code, that means I won't have a chance....

Then again, those sprite files are of the simplest form because !MultiStor is rather primitive in what it can handle. The most complex ones are 221 by 221, Mode 21, 48Kb, no palette, no mask, x90, y90.
That's it! So I have no need for covering the full range like any size, colour depth etc. None of that.

That's why I feel that it's doable to write real-time conversion when I want to display the sprite using BB4W.

I just started this thread to see if maybe someone already covered this.

Do you think even simple sprites like I mentioned are difficult to encipher?

Thanks

Mike
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #7 on: Jun 21st, 2017, 11:35am »

on Jun 20th, 2017, 8:24pm, hellomike wrote:
Coming from someone who wrote a full blown very powerful interpreter all is assembly language and a lot of image processing code...

The interpreter you speak of was written in 1982, or thereabouts, in Z80 assembler code and has been semi-automatically translated since then - initially (in 1986) to 16-bit x86 code (with the help of Jeffrey Raynor and Brandon Butterworth, I should add) and then (in 2000) to IA-32 code for Windows. There's no way I could write anything like that now. cry

Also, contrary to your comment, it contains no image processing code at all because everything is offloaded to the Windows GDI. All I had to write was a simple 'wrapper' to convert VDU commands to the appropriate calls to GDI32.DLL.

Quote:
Do you think even simple sprites like I mentioned are difficult to encipher?

It's hard for me to say, not knowing anything about Acorn sprites. Judging by Jeroen's comments it was the mask he found most difficult, so if your images have no masks it should be easier.

Richard.
« Last Edit: Jun 21st, 2017, 11:48am by Richard Russell » User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 55
xx Re: RISC OS Sprite reader
« Reply #8 on: Jun 21st, 2017, 11:52am »

With image processing code I was referring to something a read about you making software for converting B&W footage to colour.
That must have involved some thorough knowledge of image processing.

Yeah, I know. It's pretty frustrating getting old(er) and realising many skills are fading. Turning 55 myself in a month.

At least you have quite an impressive legacy. For me it's just a 2048 clone laugh
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #9 on: Jun 21st, 2017, 1:37pm »

on Jun 21st, 2017, 11:52am, hellomike wrote:
With image processing code I was referring to something a read about you making software for converting B&W footage to colour.

OK, but that was nine years ago, when I was approximately the same age as you are now (I've just turned 65)! The decline in my faculties in that period has been very marked.

Quote:
That must have involved some thorough knowledge of image processing.

Not in a general sense, no. One of the things I specialised in during my career was filtering, and the Colour Recovery process consists of many filtering steps - some one-dimensional and some two-dimensional. You've also likely seen my online document on 'A Frequency Domain approach to Scaling'.

But ask me to do a more conventional image-processing task, such as tools like Photoshop, Gimp and ImageMagick do, and I wouldn't know where to start!

Richard.
User IP Logged

IanKings
New Member
Image


member is offline

Avatar




PM


Posts: 1
xx Re: RISC OS Sprite reader
« Reply #10 on: Jun 22nd, 2017, 07:54am »

Hello hellomike,

A bit off BBC BASIC topic but here are two links that may assist you in writing a BBC BASIC version, both work well.

This library is written in C
http://www.netsurf-browser.org/projects/librosprite/

This one is python
http://www.boddie.org.uk/david/Projects/Python/Spritefile/

All the best
Ian
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #11 on: Jun 22nd, 2017, 08:20am »

on Jun 22nd, 2017, 07:54am, IanKings wrote:
A bit off BBC BASIC topic but here are two links that may assist you in writing a BBC BASIC version, both work well.

A simpler alternative (hardly any work) would be to compile the linked C code to a Windows DLL and call that from BBC BASIC using SYS.

Richard.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #12 on: Jun 22nd, 2017, 5:05pm »

on Jun 22nd, 2017, 08:20am, Richard Russell wrote:
A simpler alternative (hardly any work) would be to compile the linked C code to a Windows DLL

Here you go. This file contains the compiled DLL (rosprite.dll) an example BBC BASIC program showing how to use it (rosprite.bbc) and a sample Acorn sprite file (sample.ff9, containing 40 icons) to test it.

I've not experimented with palettes or masks, but unless the 'librosprite' library has a fault they should work.

Please note that 'rosprite.bbc' is not compatible with lowercase keywords (and I don't care!).

Richard.
« Last Edit: Jun 22nd, 2017, 5:11pm by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 803
xx Re: RISC OS Sprite reader
« Reply #13 on: Jun 22nd, 2017, 7:56pm »

on Jun 22nd, 2017, 5:05pm, Richard Russell wrote:
an example BBC BASIC program showing how to use it (rosprite.bbc)

Further, if you want to convert an Acorn sprite to a BMP file the above program could be adapted to do this very quickly (no per-pixel processing) but it wouldn't support masks properly. Let me know if you would like me to do that.

Richard.
User IP Logged

hellomike
Junior Member
ImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 55
xx Re: RISC OS Sprite reader
« Reply #14 on: Jun 23rd, 2017, 08:46am »

Thanks to Ian for pointing out this useful source!

With the documentation at PRM 1-749, I managed to identify the Sprite Control Block format and wrote code for listing all the Sprite names in a sprite file. So far, so good.

Then after finding the link to the C-source I knew I had to change plans. Then, while thinking about that, Richard provides the DLL en BB4W example code!
Now and then I play with C-code to speed things up, but noting more complex than compiling to an object file and then linking to get an executable. Wouldn't know how to compile to DLL and I'm very bad in using Project and/or make files.
What did you compile it with Richard, GCC?

So, new approach again.
I will check the DLL and its functionality.

Thanks to all.

Mike
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls