offscreen bitmap help

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

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

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12769
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

offscreen bitmap help

Postby wongck » Wed May 30, 2012 4:03 pm

Is there any simple example on how to use off-screen bitmaps for rendering images and then moving the bitmap to the screen ?
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
simonsunnyboy
Moderator
Moderator
Posts: 5116
Joined: Wed Oct 23, 2002 4:36 pm
Location: Friedrichshafen, Germany
Contact:

Re: offscreen bitmap help

Postby simonsunnyboy » Wed May 30, 2012 4:50 pm

If you want to do it systemclean and hardareindependant I can't help.

For plain pictures in ST standard resolutions, you can simply uses memcpy or a replacement:

Code: Select all

extern unsigned char picture_data[]; /* where ever your picture is in memory.... */
...
memcpy(Physbase(),(void *)picture_data,32000); /* put picture onscreen */
Simon Sunnyboy/Paradize - http://paradize.atari.org/

Stay cool, stay Atari!

1x2600jr, 1x1040STFm, 1x1040STE 4MB+TOS2.06+SatanDisk, 1xF030 14MB+FPU+NetUS-Bee

User avatar
Cyprian
10 GOTO 10
10 GOTO 10
Posts: 1712
Joined: Fri Oct 04, 2002 11:23 am
Location: Warsaw, Poland

Re: offscreen bitmap help

Postby Cyprian » Wed May 30, 2012 6:09 pm

thanks simonsunnyboy,
and what about NVDI's offscreen bitmap? how to draw e.g. line and put that bitmap on the screen?
Lynx II / Jaugar / TT030 / Mega STe / 800 XL / 1040 STe / Falcon030 / 65 XE / 520 STm / SM124 / SC1435
SDrive / PAK68/3 / Lynx Multi Card / LDW Super 2000 / XCA12 / SkunkBoard / CosmosEx / SatanDisk / UltraSatan / USB Floppy Drive Emulator / Eiffel / SIO2PC / Crazy Dots / PAM Net
Hatari / Steem SSE / Aranym / Saint
http://260ste.appspot.com/

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12769
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: offscreen bitmap help

Postby wongck » Wed May 30, 2012 11:12 pm

Yes, I am looking for using those as specific by NVDI off-screen bitmaps.
Not just dawning entire screen but a specific portion of the screen.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

m0n0
Captain Atari
Captain Atari
Posts: 425
Joined: Mon Oct 05, 2009 3:13 am

Re: offscreen bitmap help

Postby m0n0 » Wed May 30, 2012 11:34 pm

Personally I wouldn't use the NVDI bitmaps because it introduces incompatible binaries...

However, NVDI bitmaps is the most advanced solution...
The can just be used like an vdi workstation handle - just pass the bitmap handle to functions like v_line, v_arc etc...
It also much more easy to blit these bitmaps.... ( you don't have to care that much about pixel format...)

If you just want to have RGB images somewhere in memory, then you can also use the following methods, as required per Hardware architecture:

vdi standard (device independent) memory forms ( works well up to 256 colors )
device dependent memory forms for systems with more than 256 Colors.

Device dependent memory forms can also be used for systems with less than true color... however, it adds a wider range of bitmap organization. like indexed and shifted planes...

I stick to the combination of device independent and device dependent memory forms. To bad device independent memory forms don't work with more than 8 planes - or is someone here that has made other experiences?

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12769
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: offscreen bitmap help

Postby wongck » Thu May 31, 2012 12:31 pm

How do you place a line or circle at a specific position using a memory form?
I am using v_line for example to place a line at 2 points.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12769
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: offscreen bitmap help

Postby wongck » Thu May 31, 2012 2:48 pm

I found a NVDI programmer guide in French. And given how Chrome translate it, I was able to make my drawing on the screen flicker free.
But as Mono mentioned, it works only on system with NVDI installed.

What other ways are there to avoid flickering of drawings graphics in a window on the screen ?
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
jfl
Atari Super Hero
Atari Super Hero
Posts: 882
Joined: Tue Jul 18, 2006 10:55 pm
Location: Liège, Belgium
Contact:

Re: offscreen bitmap help

Postby jfl » Mon Jun 04, 2012 8:01 am

wongck wrote:I found a NVDI programmer guide in French.

There's an English version of the NVDI 4 doc, which covers offscreen bitmaps. There are no changes in that respect in NVDI 5.
wongck wrote:But as Mono mentioned, it works only on system with NVDI installed.

Obviously :wink:
wongck wrote:What other ways are there to avoid flickering of drawings graphics in a window on the screen ?

I guess it all depends on what you want to achieve. For scrolling the content of a window, for example, vro_cpyfm() works fine.
Jean-François
GEMDict – GEMClip

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 12769
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: offscreen bitmap help

Postby wongck » Mon Jun 04, 2012 11:10 am

jfl wrote:I guess it all depends on what you want to achieve. For scrolling the content of a window, for example, vro_cpyfm() works fine.


Would you believe it if I tell you it is a clock face that I am drawing :D

I have now optimised the drawing by saving the picture of face with the hours markings and this save me from drawing them, so less drawing, which in turn reduces the flickering. So I don't really need that off-screen bitmap thingy now.
My Stuff: FB/Falcon CT63 CTPCI ATI RTL8139 USB 512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

m0n0
Captain Atari
Captain Atari
Posts: 425
Joined: Mon Oct 05, 2009 3:13 am

Re: offscreen bitmap help

Postby m0n0 » Mon Apr 22, 2013 10:15 pm

non NVDI-Offscreen plotting libraries that I know:

- libgd (looks suited for gcc / atari projects,...)
- cairo
- nsfb (netsurf framebuffer, also contains an "memory" surface, probably also well suited for atari projects)
- imagemagick
The latest version crashes on some functions..., however the sparemint one works fine. But it's a bit of overkill to use libimagemagick just because you need basic functions to handle drawing on an memory form =)

Anyone knows other libs?

User avatar
shoggoth
Nature
Nature
Posts: 973
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: offscreen bitmap help

Postby shoggoth » Tue Apr 23, 2013 10:55 am

Depending on what you wish to do, you could use mono-expand blits towards an MFDB to draw device dependent stuff in a clean way in memory. I think Zorro does that in his custom text rendering code (zDesk, zTask, zView etc).
Ain't no space like PeP-space.

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

Re: offscreen bitmap help

Postby Eero Tamminen » Tue Apr 23, 2013 1:24 pm

wongck wrote:But as Mono mentioned, it works only on system with NVDI installed.


I think there's some freeware (I think) utility which adds off-screen bitmap support to normal VDI. fVDI might also support them?

Documentation on offscreen bitmaps:
http://toshyp.atari.org/en/VDI_fundamen ... _20bitmaps

User avatar
shoggoth
Nature
Nature
Posts: 973
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: offscreen bitmap help

Postby shoggoth » Tue Apr 23, 2013 1:31 pm

Eero Tamminen wrote:
wongck wrote:But as Mono mentioned, it works only on system with NVDI installed.


I think there's some freeware (I think) utility which adds off-screen bitmap support to normal VDI. fVDI might also support them?

Documentation on offscreen bitmaps:
http://toshyp.atari.org/en/VDI_fundamen ... _20bitmaps


fVDI provides the Eddi-cookie, but doesn't afaik properly support offscreen bitmaps (it does support vq_scrninfo() though).
NVDI supports them, but unfortunately allocates regular RAM for them.
EXTEND.PRG is an ultra-nasty hack which adds support for offscreen bitmaps and vq_scrninfo() to the standard VDI, 1-16bpp modes only however.
Nova VDI supports them, but for some reason it only uses RAM for them.
MVDI supports them too, I think.
The MagiC VDI probably does so also.
Ain't no space like PeP-space.

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

Re: offscreen bitmap help

Postby Eero Tamminen » Tue Apr 23, 2013 2:18 pm

shoggoth wrote:EXTEND.PRG is an ultra-nasty hack which adds support for offscreen bitmaps and vq_scrninfo() to the standard VDI, 1-16bpp modes only however.


How nasty is "ultra-nasty"? :-)

Doesn't work with MiNT? Works only with specific TOS version(s)?

User avatar
shoggoth
Nature
Nature
Posts: 973
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: offscreen bitmap help

Postby shoggoth » Tue Apr 23, 2013 3:21 pm

Eero Tamminen wrote:
shoggoth wrote:EXTEND.PRG is an ultra-nasty hack which adds support for offscreen bitmaps and vq_scrninfo() to the standard VDI, 1-16bpp modes only however.


How nasty is "ultra-nasty"? :-)

Doesn't work with MiNT? Works only with specific TOS version(s)?


Nasty as in changes LineA/VDI variables on the fly to force the VDI to operate on bitmaps in memory. There is no clean way to achieve that. The whole shebang is inherently ugly - but then again it "works" and it's the only way to do so without re-implementing the VDI. It's not compatible with any other VDI (surprise), but it seems to work well with the SuperVidel drivers (vq_scrninfo() gets a bit confused in 8bpp chunky and 32-bit truecolor though).
Ain't no space like PeP-space.

m0n0
Captain Atari
Captain Atari
Posts: 425
Joined: Mon Oct 05, 2009 3:13 am

Re: offscreen bitmap help

Postby m0n0 » Tue Apr 23, 2013 9:14 pm

but then again it "works" and it's the only way to do so without re-implementing the VDI.


I doubt that it works, as there is no way (at least not suitable under multi-taskin OS) to stop task-switching. So when you do plot with VDI, your task is maybe switched an then the next application assumes the VDI writes to the memory area which was used when the application was started, or maybe it assumes output goes directly to screen.

This posting assumes that all plot functions like line/circle/polygon etc. write into the one and only physical workstation, but takes parameters from the virtual workstation.

User avatar
shoggoth
Nature
Nature
Posts: 973
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: offscreen bitmap help

Postby shoggoth » Wed Apr 24, 2013 8:32 am

m0n0 wrote:
but then again it "works" and it's the only way to do so without re-implementing the VDI.

I doubt that it works, as there is no way (at least not suitable under multi-taskin OS) to stop task-switching. So when you do plot with VDI, your task is maybe switched an then the next application assumes the VDI writes to the memory area which was used when the application was started, or maybe it assumes output goes directly to screen.


No, you've misunderstood how this works. Context switching doesn't happen in supervisor mode. The VDI - and other trap based stuff - are executed in supervisor mode. Since this is a VDI patch, it's main entry point is through the VDI trap interface, hence it runs in supervisor mode, hence it "works" - just like any VDI patch (GDOS anyone?) would.

EDIT: Maybe you're thinking about a discussion we had at IRC, where you considered doing something similar in a user application, and I convinced you not to do so (hence your post here is a bit funny, I have to admit)? That would be seriously wrong obviously. EXTEND.PRG is not a user application, basically it becomes part of the VDI.

This posting assumes that all plot functions like line/circle/polygon etc. write into the one and only physical workstation, but takes parameters from the virtual workstation.


Not sure what you're refering to. EXTEND.PRG integrates with the VDI, extends the existing VDI implementation, and respects how the VDI already works. Workstations etc works as expected, otherwise it wouldn't make sense to add this to the VDI.
Ain't no space like PeP-space.


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 3 guests