Drawing lines and dots to an offscreen buffer

GFA, ASM, STOS, ...

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

Post Reply
tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Drawing lines and dots to an offscreen buffer

Post by tschak909 »

I need to be able to draw individual pixels and lines to an offscreen buffer (the terminal display), which will be blit when the window needs updating via vrt_copyfm() back to the screen.

How do I do this (and also, draw lines) to an off-screen MFDB?

(sorry, am not familiar with the architecture yet, and I am coding at a million miles an hour, am trying to get this terminal done)

-Thom
tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Re: Drawing lines and dots to an offscreen buffer

Post by tschak909 »

I realized that I asked a variation of this question, a few months ago, with regards to v_opnbm, but this function only seems to be available in some VDI implementations. How can I best handle re-drawing terminal output when the window needs a redraw?

-Thom
ThorstenOtto
Atari God
Atari God
Posts: 1192
Joined: Sun Aug 03, 2014 5:54 pm

Re: Drawing lines and dots to an offscreen buffer

Post by ThorstenOtto »

There are VDI functions for this (v_opnbm for example), but this requires a VDI that supports its (i think only NVDI).

If you only need a monochrome bitmap, and only simple functions like vertikal/horizontal lines for drawing, the most portable (so maybe not the fastest) way would be to do the drawing yourself.
joska
Hardware Guru
Hardware Guru
Posts: 4724
Joined: Tue Oct 30, 2007 2:55 pm
Location: Florø, Norway
Contact:

Re: Drawing lines and dots to an offscreen buffer

Post by joska »

tschak909 wrote:How do I do this (and also, draw lines) to an off-screen MFDB?
This is only possible with offscreen bitmaps, which is only properly supported by NVDI.

http://toshyp.atari.org/en/VDI_fundamen ... _20bitmaps
tschak909 wrote:I need to be able to draw individual pixels and lines to an offscreen buffer (the terminal display), which will be blit when the window needs updating via vrt_copyfm() back to the screen.
You don't *need* to do that, although I agree that this is the easiest way of doing it when NDVI is present. But most applications don't do this, they either draw directly to the screen or implement their own drawing functions and draw to an offscreen buffer.
Jo Even

VanillaMiNT - Firebee - Falcon060 - Milan060 - Falcon040 - MIST - Mega ST - STM - STE - Amiga 600 - Sharp MZ700 - MSX - Amstrad CPC - C64
tschak909
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 138
Joined: Mon Mar 26, 2018 9:29 pm

Re: Drawing lines and dots to an offscreen buffer

Post by tschak909 »

Is there a set of line and dot routines I can use to start with? I'm writing 12 different terminals, at the same time, and am trying to maximize what I can get done.

Basically, the problem is, that I can't reconstruct the screen, because I most likely will have lost the data required to do so. This is a graphical terminal emulator. I just need a viable approach to deal with the problem.

-Thom
User avatar
mfro
Atari Super Hero
Atari Super Hero
Posts: 856
Joined: Thu Aug 02, 2012 10:33 am
Location: SW Germany

Re: Drawing lines and dots to an offscreen buffer

Post by mfro »

tschak909 wrote:Is there a set of line and dot routines I can use to start with? I'm writing 12 different terminals, at the same time, and am trying to maximize what I can get done.

Basically, the problem is, that I can't reconstruct the screen, because I most likely will have lost the data required to do so. This is a graphical terminal emulator. I just need a viable approach to deal with the problem.

-Thom
A little bit of what you want to do is available here:

https://github.com/mfro0/libcmini-examp ... ster/bench

(look into include/rasterdraw.h)

at least for pixels, horizontal lines, arbitrary lines and circles.

Should work on any standard Atari resolution (use the ...256 routines for palette screens, the ..32k routines for true colour). This was originally meant as a PoC for libcmini and I wouldn't guarantee for anything, but it might give you a head start to work from.
Post Reply

Return to “Coding”