Game browser with GEM/SDL xbios targets using gcc

C and PASCAL (or any other high-level languages) in here please

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

MegatronUK
Atariator
Atariator
Posts: 23
Joined: Fri Jan 04, 2019 11:11 am

Re: Game browser with GEM/SDL xbios targets using gcc

Postby MegatronUK » Mon Feb 04, 2019 11:27 pm

Well I pulled out the last of the SDL code in the Atari backend graphics library now and replaced the first part of the image loading routine with a simple BMP loader qdbmp. I now have bitmap data loading from disk and the packed pixel data structure in memory; these can currently be from 8, 24 or 32bit RGB images.

What I'm trying to do next is the conversion from chunky to a planar data structure which I can use with a MFDB struct and then copy around the screen with normal vdi calls.

I've looked at the SDL routines in SDL-1.2.15/src/video/ataricommon/SDL_ataric2p_s.h - but I'm struggling to make sense of the parameters to be honest, the headers look like this:

Code: Select all

/* Convert a chunky screen to bitplane screen */

void Atari_C2pConvert8(
   unsigned char *src,         /* Source screen (one byte=one pixel) */
   unsigned char *dest,      /* Destination (8 bits planes) */
   unsigned int width,      /* Dimensions of screen to convert */
   unsigned int height,
   unsigned int dblligne,   /* Double the lines when converting ? */
   unsigned int srcpitch,   /* Length of one source line in bytes */
   unsigned int dstpitch      /* Length of one destination line in bytes */
);

/*--- 4 bits functions ---*/

/* Convert a chunky screen to bitplane screen */

void Atari_C2pConvert4(
   unsigned char *src,         /* Source screen (one byte=one pixel) */
   unsigned char *dest,      /* Destination (4 bits planes) */
   unsigned int width,      /* Dimensions of screen to convert */
   unsigned int height,
   unsigned int dblligne,   /* Double the lines when converting ? */
   unsigned int srcpitch,   /* Length of one source line in bytes */
   unsigned int dstpitch      /* Length of one destination line in bytes */
);


How do I calculate the overall size of the destination memory structure that I need to allocate, as well as what srcpitch and dstpitch are? For the raw image data I presume srcpitch is (width_in_pixels * bpp)?

MegatronUK
Atariator
Atariator
Posts: 23
Joined: Fri Jan 04, 2019 11:11 am

Re: Game browser with GEM/SDL xbios targets using gcc

Postby MegatronUK » Mon Feb 04, 2019 11:34 pm

That's (width_in_pixels / bpp), of course.

mikro
Hardware Guru
Hardware Guru
Posts: 1997
Joined: Sat Sep 10, 2005 11:11 am
Location: Kosice, Slovakia
Contact:

Re: Game browser with GEM/SDL xbios targets using gcc

Postby mikro » Tue Feb 05, 2019 7:03 am

The comments say it all. :)

The buffer is as big as width * height for 8-bit graphics. For 4-bit, divide by two.

srcpitch / dstpitch is exactly what it says, length of a line in bytes. So 'width' for 8-bit graphics, half for 4-bit graphics. Basically the amount of bytes which should be added to src/dst pointer after every pass. You might want to use different values if not copying the whole buffer but only part of it.

MegatronUK
Atariator
Atariator
Posts: 23
Joined: Fri Jan 04, 2019 11:11 am

Re: Game browser with GEM/SDL xbios targets using gcc

Postby MegatronUK » Thu Feb 07, 2019 11:47 pm

Thanks, it seems to work pretty straightforward, I also added a 24bpp colour downsampling routine to the loader so that the C2P routine always gets fed an 8bpp image.

One thing I'm now coming to terms with is the lack of off-screen bitmap support in VDI. Just how do I now go about turning this block of memory that has been turned from a packed pixel bitmap structure into a 4 plane planar structure into something I can vro_cpyfm() to the cover art placeholder coordinate of my display? If plain VDI cannot copy from offscreen memory, how do image get loaded if from anything other than a native VDI image container format?

User avatar
Eero Tamminen
Atari God
Atari God
Posts: 1949
Joined: Sun Jul 31, 2011 1:11 pm

Re: Game browser with GEM/SDL xbios targets using gcc

Postby Eero Tamminen » Fri Feb 08, 2019 11:56 pm

For off-screen bitmaps there's NVDI (commercial SW VDI accelerator and lots of other things), and a free program that does just off-screen bitmaps, and which is shipped with some of the Atari SW needing off-screen bitmap support. For more info on checking for support on this and NVDI, see:
http://toshyp.atari.org/en/VDI_fundamentals.html#NVDI
http://toshyp.atari.org/en/003007.html#Cookie_2C_20EdDI

This was the only place where I found the non-NVDI program: https://github.com/ggnkua/Atari_ST_Sour ... I/ENHANCER

I've seen some comments that the latter does some nasty things, so I'm not sure how good it's to depend on it or on NVDI.

MegatronUK
Atariator
Atariator
Posts: 23
Joined: Fri Jan 04, 2019 11:11 am

Re: Game browser with GEM/SDL xbios targets using gcc

Postby MegatronUK » Fri Feb 15, 2019 11:52 pm

This is starting to become very messy to do something I thought rather straightforward :(

I had a good look at your ximgview.c code and I'm seeing that it's something like the complexity of my entire application again, just to load an (X)IMG file. That's vastly more complex than I anticipated.

At this point I'll probably settle with the speed of displaying the BMP format image.


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 2 guests