Copyright (c) Hyperion Entertainment and contributors.
Difference between revisions of "Classic Intuition Screens"
Steven Solie (talk | contribs) |
Steven Solie (talk | contribs) |
||
Line 95: | Line 95: | ||
Applications should use tag items to set up a new screen instead of the NewScreen structure since tag items are often more convenient. For the sake of backwards compatibility, the ExtNewScreen structure is available. ExtNewScreen combines the NewScreen method used to define screens in older versions of the OS with the tag item method. The examples listed in the next section show how these various data structures can be used to set up a new screen. |
Applications should use tag items to set up a new screen instead of the NewScreen structure since tag items are often more convenient. For the sake of backwards compatibility, the ExtNewScreen structure is available. ExtNewScreen combines the NewScreen method used to define screens in older versions of the OS with the tag item method. The examples listed in the next section show how these various data structures can be used to set up a new screen. |
||
+ | |||
+ | == Custom Screen Functions == |
||
+ | |||
+ | All applications require a screen to work in. This can be an existing, public screen or a new, custom screen created by the application itself. To create a new, custom screen to work with, you call OpenScreen(). |
||
+ | |||
+ | === Creating a new Custom Screen === |
||
+ | |||
+ | The old OpenScreen() call relied on a fixed size data structure (NewScreen) which made little allowance for extensions and growth. The new calls are tag based, allowing for the addition of new features without modification of existing structures and applications. The "Screen Attributes" section below contains a complete list of all the tag options available for setting up an Intuition screen. For a general description of tag items, see [[Utility_Library|Utility Library]]. |
||
+ | |||
+ | The NewScreen structure used with OpenScreen() has been extended with a tag list in V36 to form an ExtNewScreen. This is done by setting the NS_EXTENDED bit in the Type field of the NewScreen structure and adding a pointer to an array of tags to the end of the structure. The NS_EXTENDED bit is ignored in older versions of the operating system, so the tags can be transparently added to existing applications and the features will appear when executed in a system running V36 or greater. See the OpenScreen() Autodocs and the include file <intuition/screens.h> for more information on NS_EXTENDED and the ExtNewScreen structure. |
Revision as of 19:53, 9 April 2013
Contents
Classic Intuition Screens
This sections contains information regarding programming Amiga screens which is no longer in use. See Intuition Screens for the current methods used to manipulate Intuition screens.
Screen Data Structures
The Amiga uses color registers and bitplane organization as its internal representation of display data. Screens require a color table and display raster memory for each bitplane. This is the memory where imagery is rendered and later translated by the hardware into the actual video display. This information is contained in data structures from the Amiga's graphics library.
A ViewPort is the main data structure used by the graphics library to represent a screen. Pointers to each of the screen's bitplanes are stored in the graphics library BitMap structure. Color table information is stored in a graphics structure called a ColorMap. And the screen's drawing and font information is stored in the RastPort structure.
The graphics RastPort structure is a general-purpose handle that the graphics library uses for drawing operations. Many Intuition drawing functions also take a RastPort address as a parameter. This makes sense since the RastPort structure contains drawing variables as well as a pointer to the BitMap telling where to draw. See Graphics Primitives chapter for more information on these structures and how they are used.
The Intuition Screen Data Structure
The structures mentioned above are unified along with other information in Intuition's Screen data structure defined in the include file <intuition/screens.h>. Notice that the Screen structure contains instances of a ViewPort, RastPort and BitMap.
struct Screen { struct Screen *NextScreen; struct Window *FirstWindow; WORD LeftEdge, TopEdge, Width, Height; WORD MouseY, MouseX; UWORD Flags; UBYTE *Title, *DefaultTitle; BYTE BarHeight, BarVBorder, BarHBorder, MenuVBorder, MenuHBorder; BYTE WBorTop, WBorLeft, WBorRight, WBorBottom; struct TextAttr *Font; struct ViewPort ViewPort; struct RastPort RastPort; struct BitMap BitMap; struct Layer_Info LayerInfo; struct Gadget *FirstGadget; UBYTE DetailPen, BlockPen; UWORD SaveColor0; struct Layer *BarLayer; UBYTE *ExtData, *UserData; };
In general, applications don't need to access the fields in the Screen structure directly; they use Intuition functions to manipulate the screen instead. Likewise, applications do not set up the Screen themselves; they use one of the OpenScreen() calls (see below). Here is a description of some of the more interesting members of the Screen structure (it is not meant to be a complete description of all the fields).
- LeftEdge, TopEdge
- The LeftEdge and TopEdge variables give the position of the screen relative to the upper left corner of the monitor's visible display (as set by the user in the Overscan preferences editor). If it is positioned down or to the right, the values are positive. If the screen is positioned up or to the left, the values are negative. The values are in screen resolution pixels.
- The screen position may be set when the screen is opened or later by calling the MoveScreen() function.
- Note that the screen's actual display position may not exactly equal the coordinates given in the LeftEdge and TopEdge fields of the Screen structure. This can cause a window which is opened in the visible part of the screen to be incorrectly positioned by a few pixels in each direction. This complication is due to hardware constraints that limit the fineness of screen positioning. For instance, high resolution screens can only be positioned in low resolution pixel coordinates, yet the values in the LeftEdge and TopEdge use high resolution pixel coordinates. So when the screen is displayed, its position is rounded to a position available for the monitor.
- MouseX, MouseY
- Position of the mouse with respect to the upper left corner of the screen.
- ViewPort, RastPort, BitMap, LayerInfo
- Actual instances of the graphics library data structures associated with this screen (not pointers to structures). For normal use of custom screens, these structures may be ignored.
- BarLayer
- A pointer to the Layer structure for the screen's title bar.
- WBorTop, WBorLeft, WBorRight, WBorBottom
- Window border values, see the Intuition Windows for information on pre-calculating the size of window borders for windows that open in this screen.
- Font
- The default screen font, this can be used to pre-calculate the size of the window borders for windows that open in this screen.
- UserData
- Free for application use.
Other Screen structure members provide information on the title bar layer, and attributes of menus and windows opened in the screen. Of particular interest are the values that allow precalculation of window border size. These variables will be discussed in Intuition Windows.
Other Screen Data Structures
In addition to the Screen structure, Intuition uses some other supporting structures defined in the include file <intuition/screens.h> and in <utility/tagitems.h>. (See the SDK for a complete listing.)
Structure Name | Description | Defined in Include File |
---|---|---|
Screen | Main Intuition structure that defines a screen (see above) | <intuition/screens.h> |
DrawInfo | Holds the screen's pen, font and aspect data for Intuition | <intuition/screens.h> |
TagItem | General purpose parameter structure used to set up screens in V36 | <utility/tagitem.h> |
NewScreen | Parameter structure used to create a screen in V34 | <intuition/screens.h> |
ExtNewScreen | An extension to the NewScreen structure used in V37 for backward compatibility with older systems | <intuition/screens.h> |
As previously mentioned, there is an Intuition Screen structure (and a corresponding graphics ViewPort) for every screen in memory. Whenever a new screen is created, Intuition also creates an auxiliary data structure called a DrawInfo.
The DrawInfo structure is similar to a RastPort in that it holds drawing information. But where a RastPort is used at the lower graphics level, the DrawInfo structure is used at the higher Intuition level. Specifically, DrawInfo contains data needed to support the New Look of Intuition. (See the section below, "DrawInfo and the 3D Look" for more information.)
With screens, tag items are used to describe the attributes an application wants for a new, custom screen. Tag items replace the NewScreen structure, the set of parameters used in older versions of the OS to set up a screen.
Applications should use tag items to set up a new screen instead of the NewScreen structure since tag items are often more convenient. For the sake of backwards compatibility, the ExtNewScreen structure is available. ExtNewScreen combines the NewScreen method used to define screens in older versions of the OS with the tag item method. The examples listed in the next section show how these various data structures can be used to set up a new screen.
Custom Screen Functions
All applications require a screen to work in. This can be an existing, public screen or a new, custom screen created by the application itself. To create a new, custom screen to work with, you call OpenScreen().
Creating a new Custom Screen
The old OpenScreen() call relied on a fixed size data structure (NewScreen) which made little allowance for extensions and growth. The new calls are tag based, allowing for the addition of new features without modification of existing structures and applications. The "Screen Attributes" section below contains a complete list of all the tag options available for setting up an Intuition screen. For a general description of tag items, see Utility Library.
The NewScreen structure used with OpenScreen() has been extended with a tag list in V36 to form an ExtNewScreen. This is done by setting the NS_EXTENDED bit in the Type field of the NewScreen structure and adding a pointer to an array of tags to the end of the structure. The NS_EXTENDED bit is ignored in older versions of the operating system, so the tags can be transparently added to existing applications and the features will appear when executed in a system running V36 or greater. See the OpenScreen() Autodocs and the include file <intuition/screens.h> for more information on NS_EXTENDED and the ExtNewScreen structure.