Application exit for potentially pickable primitives in a graphics system
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     This invention relates to locally programmed interactive graphics workstations in which a user selects a graphics primitive in the ,display image by means of positioning a &#34;pick window&#34; to create an area of the display screen active for picking. 
     2. Background Art 
     In graphics computing systems that provide the pick window function, the position of the pick window is usually visually indicated to a user by means of a tracking cursor. The workstation user 18 communicates pick window position to the display processor by means of an interactive device 20 such as a keyboard, mouse, cursor, or track ball. Such systems have a display processor ID which processes a graphics program stored in a memory sometimes referred to as a display list buffer 12 to generate a graphics image on the display screen 14 of the system (see FIG. 1). The graphics program stored in the display list buffer is produced by an application program 16 running in the system, or workstation, or on a remote host computer. 
     This type of workstation architecture is well known in the literature (see, for instance, Foley and Van Dam&#39;s text, Fundamentals of Interactive Computer Graphics, pages 19-20 and 200-203). The IBM 5080, described in IBM publication GA23-2012-0 (&#34;IBM 5080 Graphics System: Principles of Operation, 5085 Model 2&#34;), serves as one specific example of such a display list programmed workstation providing a picking function. 
     A common problem that must be solved in the user-interface of such a workstation is how to give the user the ability to identify which graphics primitive he or she wishes to select if more than one primitive intersects the pick window. The methods for solving this problem can be divided into two categories, those in which the &#34;visual feedback&#34; function is provided by the workstation independent of the application program, and those in which the application program uses the features of the workstation to perform the &#34;visual feedback&#34; function. Each of these categories will now be presented, along with a discussion of their advantages and disadvantages: 
     1. Application-provided visual feedback approaches: 
     One such approach available to applications for solving the problem posed by multiple pickable primitives in the pick window is for the application to give the user the ability to magnify the image when necessary. By magnifying the image, the pick window can be positioned in such a way that only the desired primitive intersects the pick window. Once the picking action has been performed on the magnified image, the user may then &#34;demagnify&#34; the image back to its original size. This approach, however, has the drawback that the user&#39;s productivity is reduced by the additional steps he or she must take to accomplish the magnification/demagnification processes. 
     An alternative to the &#34;magnify-demagnify&#34; approach is for the application to provide a selective highlight or display of primitives (or high-level structures) that pass through the pick window. In order to do this, the application must take special action when it detects that the primitive being drawn intersects the pick window. Currently available graphics systems, such as the IBM 5080, offer applications the choice of handling pick events at the remote host or the workstation&#39;s general purpose processor, or locally in the display list program itself. Each of these picking modes will now be described. 
     a. Remote pick processing-- 
     In the case where picks are handled at the host or workstation processor, any time a pickable primitive is drawn in the pick window the display processor immediately interrupts the host or workstation processor with the data for the pickable primitive, and suspends operation until it receives a command back from the processor. Processing of the pickable primitive is then done at the remote host instead of by the display processor. The advantage of this picking mode that control is automatically given to the processing unit that handles the pick event whenever the display processor detects that a primitive was drawn in the pick window; no overhead is added to the display list program to determine which of the intersecting primitives is to be picked. Since such a test is needed after each primitive is drawn this is a significant feature. A disadvantage of this picking mode is that it incurs the performance penalties arising from communication between the display processor and the host or workstation processor when a pick intersection occurs, and it increases the likelihood that the state of the workstation may change between the time of the pick window intersection and the time that the host or workstation processor responds. 
     b. Local pick processing-- 
     In the &#34;local&#34; picking mode, any time a pickable primitive is drawn in the pick window the workstation saves the pick data for that primitive in a local save area, and sets an indicator for the display program to know that a pick window intersection occurred. After this, execution continues at the next graphics instruction. The display program can add instructions after each primitive is drawn to test for the occurrence of a pick window intersection, and take appropriate action to perform some sort of visual feedback if a pick window intersection did occur. This picking mode has the advantage that it permits local (display processor) processing of pickable primitives, thus avoiding the performance penalties of communicating with a remote host or workstation processor. However, &#34;local&#34; picking mode of current graphic workstations has the disadvantage that additional graphics instructions must be inserted at many places in the display program, thus reducing the application&#39;s performance and increasing its program storage requirements. 
     Due to the disadvantages listed above for the remote and local picking modes, many graphics applications to date have offered the &#34;magnify-pick-demagnify&#34; technique instead of providing a true high-level visual feedback function. Unfortunately, the brunt of the selection process is then put on the user of the graphics application. 
     2. Workstation-provided visual feedback approaches: 
     In these approaches, the workstation itself keeps track of those primitives that intersect the pick window, and displays or highlights them one at a time in response to some signal (such as the depression of a keyboard button) issued by the user. This is an improvement over the application-provided visual feedback approach in that the user no longer needs to magnify/demagnify the image. However, this approach has the drawback that the set of display or highlight functions available to the application is limited to those that are implemented in the hardware of the workstation. These are usually limited to simpler building-block primitives (such as lines) instead of the aggregate graphic structures an application allows its users to select. Thus, an application is often unable to visually identify the complete structure containing the pickable entity, a drawback that creates ambiguity for the user of the application. With the workstation-provided visual feedback approach, the application is not given the ability to implement the visual feedback requirements of its own unique user-interface. 
     SUMMARY OF THE INVENTION 
     According to the present invention a computer graphics system is provided, having a processor that executes a set of microcoded instructions to generate data corresponding to basic graphic elements, called primitives, in response to a main list of application display instructions. The data is used to generate a display of those primitives. The system also includes a way of defining a display region, called a pick window, for identifying for selection primitives that intersect the pick window. The invention provides a method for enhancing the selectability of pickable primitives that intersect the pick window. According to the invention a further list of application display instructions, called a selection subroutine, is provided for saving data pertaining to primitives that intersect with the pick window. The saved data is used for effecting subsequent modification of the display area to facilitate selection of the intersecting primitives. Further microcoded instructions are provided to test whether a set of microcoded instructions previously executed for generating data corresponding to a primitive caused a pickable primitive to be drawn in the pick window. If the determination is that such a primitive was drawn, the execution of the main display list is suspended, and the selection subroutine is executed. Finally, execution of the main display list is resumed at a selected instruction therein. Thus, the present invention is a new application interface built into the hardware or microcode of the display processor to enable applications to implement better visual feedback/selection functions. It should be noted that as used herein, &#34;microcoded instruction&#34; means an instruction provided in microcode or in hardwired logic, as contrasted with an application instruction. 
     According to, for example, the preferred embodiment of the present invention, a method is provided by which an application may easily control both the pre-selection and the final selection of the pickable primitive from the set of primitives which intersect the pick window. This is accomplished by creating an interface to the application for specifying the address of a display list subroutine to be automatically executed whenever a graphics instruction draws a pickable primitive that intersects the pick window. In this way, a branch from the application visualization display list program is taken whenever a &#34;pick&#34; or &#34;pre-selection&#34; occurs, and the state of the application&#39;s visualization display list program is maintained. Thus, according to the preferred embodiment, the advantages of both the remote and local picking modes are provided without having any of their disadvantages. 
     The foregoing and other objects, features and advantages of the invention will be apparent from the more particular description of the preferred embodiments of the invention, as illustrated in the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a graphics workstation in which the method of the present invention is applied. 
     FIG. 2 is a flowchart of a first part of the preferred embodiment of the present invention. 
     FIG. 3 is a flowchart of a second part of the preferred embodiment of the present invention. 
     FIG. 4 is a flowchart showing typical steps in a subroutine according to the preferred embodiment of the present invention. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The preferred embodiment of the present invention, including specific structural and functional details, are disclosed herein. These specifics are merely representative, and in that regard, provide a basis for the claims herein which define the scope of the invention. It is not intended that the specifics be construed as a limitation of the principles set forth in the claims. 
     In the preferred embodiment of this invention, the workstation&#39;s display processor provides application control of the pre-selection process by performing the following steps after completion of each graphics instruction: 
     1. Testing whether or not the instruction just completed caused a pickable primitive to be drawn in the pick window region; 
     2. If the operation just completed caused a pickable primitive to be drawn in the pick window, the following steps are performed: 
     a. The address of the order after the operation that caused a pickable primitive to be drawn in the pick window is pushed onto the application&#39;s hardware stack (this enables the application&#39;s selection subroutine to return to the visualization display list program at the point from which it left when the subroutine completes execution); 
     b. Normal display list execution of the application&#39;s visualization display list program is suspended, and the hardware begins display list execution at the address of the selection subroutine (n.b., the selection subroutine must not draw a pickable primitive in the pick window, in order to avoid infinite recursion). 
     3. If the instruction just completed did not cause a pickable primitive to be drawn in the pick window, workstation execution continues with the next graphics instruction. 
     The workstation&#39;s display processor performs the following steps whenever a pickable primitive intersects the pick window: 
     1. Saving the data relevant to the primitive just drawn in a storage area for potential use at a later time; 
     2. Setting a flag to indicate that a pickable primitive intersected the pick window. 
     FIGS. 2, 3 and 4 are detailed flowcharts of how this improved method for handling potentially picked primitives would typically be implemented. FIG. 2 shows the steps by which the exit to the application-provided display list subroutine is effected, while FIG. 3 shows the steps that are performed each time a primitive intersecting the pick window is drawn. These two processes communicate with each other by means of a flag which indicates whether or not the application-provided display list subroutine is to be given control at the end of the current graphics instruction. This &#34;branch to the application-provided subroutine&#34; flag is tested and reset by the process in FIG. 2, and set by the process in FIG. 3. 
     The workstation incorporating the present invention will operate as follows. The frame generation cycle reads the graphic instructions and generates the image for display on the display screen 14. At the beginning of the cycle 22 the &#34;branch to the application provided subroutine&#34; flag is cleared and processing begun. The system first tests to determine whether the &#34;branch to the application provided subroutine&#34; flag is on 24. This test incorporates the steps described in FIG. 3 for determining whether to branch to the application subroutine. If the flag is on the address of the next instruction is pushed on to the workstation stack 26 to serve as a point of return for continued processing. The &#34;next address&#34; is set to the address of the application provided subroutine in step 28. This causes the execution of the application provided subroutine as described in further detail with reference to FIG. 4. At the end of processing the &#34;branch to the application provided subroutine&#34; flag is reset and the next graphics instruction executed 32 is continued unless that sequence was modified by the application provided subroutine. If the &#34;branch to the application provided subroutine&#34; flag is not on at step 24, control passes immediately to step 32. The &#34;next address&#34; value is incremented 34 and processing returns to the testing step 24. 
     Testing step 24 is executed after each graphics instruction and incorporates the steps shown in FIG. 3. Whenever a primitive is drawn in the pick window 40 control is passed to this routine. A first test 42 is made to determine whether a primitive has been designated as pickable. If it is not a pickable primitive, control returns to the drawing routine 50. If the primitive is pickable, data relevant to the primitive is saved by the system 4. If the primitive being drawn is part of the boundary of the area fill 46 control is returned to the drawing processor 50. If not, a &#34;branch to the application subroutine&#34; flag is set 48 and control is returned to the drawing routine 50. 
     Each application provided subroutine contains a similar structure as shown in FIG. 4. The entry point of the application provided subroutine 60 is the address to which the drawing processor branches. As a first step, data relevant to the primitive that entered the pick window is retrieved step 62. The data about the primitive is used in an the application specific manner by processing step 64. Finally, a &#34;pop&#34; instruction is executed to retrieve the next graphics instruction 66. As an alternative, the next instruction address may be removed from the stack and processing continued in the application subroutine without a return to the drawing process. 
     This inventive structure provides a method to implement application specific control of the picking or selection process. Thus, an application can control how potentially pickable primitives are displayed for visualization and finer selection by the operator. 
     The following implementation points must be observed to make the application interface of the preferred embodiment work well: 
     1. In order to avoid infinite recursion, the &#34;pick window intersection&#34; subroutine provided by the application must not draw a pickable primitive in the pick window. 
     2. In order to provide meaningful data to the visualization display program, the workstation hardware must defer transferring control to the &#34;pick window intersection&#34; subroutine until an &#34;atomic&#34; drawing operation completes (e.g., during an area fill operation, the workstation hardware must complete the fill process prior to transferring control to the application&#39;s selection routine, even if the area fill boundary intersected the pick window; this is because the area fill primitive is the item of interest, not the boundary of the area fill). 
     According to the present invention, the application-provided display list subroutine can immediately perform the display function programmed into the application with respect to the primitive that intersected the pick window, or it can save any data needed to perform the application&#39;s unique display or highlight functions at a later point in the image generation cycle. When the subroutine is finished, it executes a &#34;POP&#34; instruction to cause workstation execution to resume at the address placed on the stack prior to branching to the application-provided subroutine. In this way, each application can &#34;customize&#34; the workstation to achieve the user-interface it wishes to provide. 
     For example, if the image is that of an automobile, and a vector in the bumper passes through the pick window, the application may be programmed to highlight the vector, the bumper, or the entire car; or it can be programmed to erase the vector, the bumper, or the entire car; or any number of other combinations of useful visual effects. As another example, under application control, a user of the system could &#34;step through&#34; a pick window in a way which permits successive display of the structure which would be selected if the user were to signal that to the system. Since the application controls this process, it can guarantee that the item indicated to be selected will be the item that will actually be selected. Thus the user of the workstation may clearly what item the application will select prior to the actual selection. Furthermore, the application may be programmed to permit the user to make his &#34;final choice&#34; at any moment during the &#34;step through&#34; process. All of the above-described application &#34;customized&#34; display functions are readily programmable to those having ordinary skill in the art. 
     The flowchart in FIG. 4 shows the typical steps the application-provided display list subroutine performs in handling primitives that intersect the pick window. Such a subroutine has total flexibility as to what to do when it is given control by the workstation. It can immediately use the data provided by the workstation to change the display, it can save the data in a table for use at a later time, or it can not use the data at all. When the subroutine is finished, it can return to the graphics program at the point from which it was entered, or it can be programmed to branch somewhere else and not return at all. 
     The data saved in this part of the preferred embodiment of the present invention depends upon the particular architecture of the graphics computer system involved. In a typical computer graphics system architecture, such as the IBM 5080 workstation, the main application program is provided as a listing of commands, and data corresponding to the primitives to be drawn in accordance with the commands. These primitives may be, for example, vectors. If data is to be saved for a vector, for example, in order to permit the application to readily provide the desired visual enhancement, the data saved is the x, y, and z of the end point of the vector, the address of the graphics instruction in the display program listing for drawing the vector, the address of the vector in the data list of the graphics instruction, and the segment name, that is, the name of the overall structure that the primitive is part of. The reason for saving the address of the primitive in the data list is that according to typical graphics architectures, a given graphics instruction may relate to a number of geometric primitives, such as a string of vectors. In order to permit the application subroutine to identify which vector primitive associated with the given graphics instruction is the one which intersects the pick window, the address of the instruction associated with that vector primitive is provided. The segment name permits the application to construct the overall geometric element of which the primitive is a part, for example, for visual enhancement of the overall geometric structure. The rather considerable flexibility afforded by this saving of data will be readily apparent to those skilled in this art. 
     Thus, while the invention has been described with reference to the preferred embodiment thereof, it will be understood by those skilled in the art that various changes in form and details may be made without departing from the scope of the invention.