[comp.sys.amiga] LACE Workbench

shf@well.UUCP (Stuart H. Ferguson) (02/04/88)

What's a good (read: fast/simple) way to detect if the Workbench screen is in
interlace mode?  I need to do this to compute the aspect ratio for pixels on
*any* Workbench screen.  Thanx in advance.

-- 
		Stuart Ferguson		(shf@well.UUCP)
		Action by HAVOC		(shf@Solar.Stanford.EDU)

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (02/04/88)

In article <5145@well.UUCP> shf@well.UUCP (Stuart H. Ferguson) writes:
>What's a good (read: fast/simple) way to detect if the Workbench screen is in
>interlace mode?  I need to do this to compute the aspect ratio for pixels on
>*any* Workbench screen.  Thanx in advance.
>
	Well, you could do this:
--------
	register struct Window	*win;
	UWORD			CRTModes;

	win = OpenWindow (&NewWindow);
	CRTModes = win -> WScreen -> ViewPort.Modes;
--------

	However, this will probably not be very useful when 1.4 (currently
vaporware, and likely to remain that way for a long time yet) comes out.

	If I'm reading Dale's and Jimm's minds correctly, under future
operating systems, you won't be able to make any assumptions about what the
WorkBench screen looks like (case in point: The Hedley (sp?) monitor).

	Dale thought of this already, and somewhere in GfxBase are a couple
of variables called NormalDPMX and NormalDPMY.  These give the DotsPerMetre
measurements of the screen.  You're supposed to calculate aspect ratios from
these.

	Exactly how you do that, I have no idea.  Dale, could you clear that
up?  Personally, I've never understood how those variables worked,
particularly if there are multiple viewports on the screen.

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	ihnp4!ptsfa -\
 \_ -_		Recumbent Bikes:	      dual ---> !{well,unicom}!ewhac
O----^o	      The Only Way To Fly.	      hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor

cmcmanis%pepper@Sun.COM (Chuck McManis) (02/05/88)

In article <5145@well.UUCP> shf@well.UUCP (Stuart H. Ferguson) writes:
>
>What's a good (read: fast/simple) way to detect if the Workbench screen is in
>interlace mode?  I need to do this to compute the aspect ratio for pixels on
>*any* Workbench screen.  Thanx in advance.

Open a window on the workbench and look at ..
interlace = ((win->WScreen).ViewPort.Modes & LACE) != 0;

But better yet, the aspect ratio is supposed to be ...
GfxBase->NormalDPX / GfxBase->NormalDPY 
This is the Dots per meter in the X direction over the
Dots per meter in the Y direction.


--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

ltf@killer.UUCP (Lance Franklin) (02/05/88)

In article <5145@well.UUCP> shf@well.UUCP (Stuart H. Ferguson) writes:
>
>What's a good (read: fast/simple) way to detect if the Workbench screen is in
>interlace mode?  I need to do this to compute the aspect ratio for pixels on
>*any* Workbench screen.  Thanx in advance.
>
>-- 
>		Stuart Ferguson		(shf@well.UUCP)
>		Action by HAVOC		(shf@Solar.Stanford.EDU)

Hmmm...There may be an easier way (Perhaps something in IntuitionBase or
GfxBase), but I generally do a call to GetScreenData (with WBENCHSCREEN as
the screen_type parameter) and look at the Screen.Height member of the
structure...if it's greater than the maximum size of a non-interlaced screen
(what, 263 lines?), I assume it's an interlaced screen.  This is also how I
get the information I need to open a window to the full size of a morerow'd
workbench.
 
Here's another question....how do I, when working with an interlaced screen,
figure out whether I'm starting an even or odd scan when I call WaitTOF()?
A ScrollRaster does some really interesting things on an interlaced screen
when you do it EVERY WaitTOF().
 
Oh, and one more question...is there an approved way to open a window with
less planes inside the window than there is in the borders?  f.i. a window
with two planes for the border, but only one plane in the drawing area inside
the window?
 
Thanx



-- 
+------------------+ +------------------------------------------------------+
| Lance T Franklin | |  Now accepting suggestions for clever, humourous or  |
|    ltf@killer    | |  incredibly insightful .signature quote.  Send Now!  |
+------------------+ +------------------------------------------------------+

shf@well.UUCP (Stuart H. Ferguson) (02/07/88)

I (Stuart H. Ferguson) asked:
>What's a good (read: fast/simple) way to detect if the Workbench screen is in
>interlace mode?  I need to do this to compute the aspect ratio for pixels on
>*any* Workbench screen.  Thanx in advance.

Leo ('Bols Ewhac' Schwab) replied [edited]:
>
>        Well, you could do this:
>  [code fragment to open window and examine Modes flag for ViewPort]
>
>        However, this will probably not be very useful when 1.4 comes out.
>        If I'm reading Dale's and Jimm's minds correctly, under future
>operating systems, you won't be able to make any assumptions about what the
>WorkBench screen looks like (case in point: The Hedley (sp?) monitor).
>        Dale thought of this already, and somewhere in GfxBase are a couple
>of variables called NormalDPMX and NormalDPMY.  These give the DotsPerMetre
>measurements of the screen.  You're supposed to calculate aspect ratios from
>these.
>        Exactly how you do that, I have no idea.  Dale, could you clear that
>up?  Personally, I've never understood how those variables worked,
>particularly if there are multiple viewports on the screen.

Yeah, I use these variables, as well as a couple of fields called
NormalDisplayRows and NormalDisplayColumns.  On my machine, these fields
contain the fixed values:

NormalDisplayRows:      200
NormalDisplayColumns:   640
NormalDPMX:            1280
NormalDPMY:            1098

These values do *not* change if I set the Workbench to interlace in
preferences and reboot.  So "Normal" means a 640 x 200 screen, and the
values for other resolution modes are left as an exercize for the
programmer.  So, if the Workbench is in interlace mode, you have to multiply
NormalDisplayRows by 2 to get the correct value.

But, the aspect ratio for pixels computed from the measures above is 0.858,
which is the aspect ratio for pixels at maximum resolution, i.e. a 640 x 400
screen.  Mixed bag, this "Normal" stuff.  (BTW this aspect ratio looks
better than the one I figured out using a ruler.  I recomend it.)

Although using these fields lets software adapt to changing hardware, this
particular "standard" way of storing the parameters of the monitor could be
a problem for programs that run on the Workbench Screen.  If a program needs
to know the aspect ratio or just the maximum sized window possible, its
values will be off by a factor of two if it fails to take in to account that
the Workbench is in interlace mode.

On the original question -- how to find out if the Workbench is in interlace
mode -- I've found that there is a LaceWB field in the Preferences
structure, so I'll try reading it out from there.  I would like to find out
without opening a dummy window, thank you.  Part of the point is so I can
open a window that fills the screen (minus one or two pixels at the top :-).

There are also a couple of fields in the GfxBase called MaxDisplayRow and
MaxDisplayColumn with values (again on my machine) of 261 and 465,
respectively.  Anyone know what these are?

-- 
		Stuart Ferguson		(shf@well.UUCP)
		Action by HAVOC		(shf@Solar.Stanford.EDU)