Intuition draws lines between points that are specified as sets of X, Y coordinates. border data does not have to be in chip memory. The xy field contains a pointer to an array of coordinate pairs. all of these coordinates are offsets relative to the border position, which is determined by the sum of the external and internal position components as described above. The coordinate pairs are ordered sequentially. The first two numbers make up the first coordinate pair, the next two numbers make up the second pair, and so on. Within a coordinate pair, the first number is the X offset and the second number is the Y offset. The first coordinate pair describes the starting point of the first line. When the border is rendered, a line is drawn between each pair of points. The first line is drawn from point one to point two, the second line is drawn from point two to point three, and so on, until the final point is reached. The numbers specified in the xy array may be positive or negative. Negative values move up and to the left relative to the border position, positive values move down and to the right. Again, the Border position is determined by adding the external position component and the internal position component. For example, a Border attached to a gadget has an external component equal to the upper left corner of the gadget's select box. The internal component is set within the Border structure itself. These two components are added together and offsets from the resulting position, specified within the XY array, determine where the lines of the Border will appear. Suppose the top left corner of the select box of the gadget is at window position (10,5). If the border has leftedge set to 10 and topedge set to 10, then the Border is positioned at (10+10,5+10), that is (20,15). All xy coordinates will be relative to this border position. if the xy array contains `0,5, 15,5, 15,0', then the relative coordinates will be (0,5), (15,5) and (15,0). Adding each coordinate to the Border position gives the absolute position of the lines within the window. This Border will draw two lines in the window, one from (20,20) to (35,20) and the second from (35,20) to (35,15). 0 5 10 15 20 25 30 35 40 45 50 | | | | | | 0__|____|____|____|____|____|____|____|____|____|____| | Top left corner of the | gadget's select box (10,5) 5 _| * _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | | | 10__| Border Third | | Position Coordinate | (20,15) (20+15,15+0) 15 _| | * * | | | | | 20__| *______________* | | First Second | Coordinate Coordinate 25 _| | (20+0,15+5) (20+15,15+5) | | | 30__| Figure 8-3: Example of Border Relative Position To create a border that is outside the select box of a gadget, specify negative values in the internal component or use negative values for the initial xy values. for example, setting leftedge to -1 and topedge to -1 moves the position of the border one pixel above and one pixel to the left of the gadget's select box.