PATTERN DATA GENERATING SYSTEM

Abstract: A pattern data generating system including a processor (12) for writing in a bit map memory (13), on the basis of input data, point of all lines to be filled or painted along a scan direction which is one direction on the bit map memory (13). This writing is performed such that a point (S6 in Fig. 1) on each line is written as one of two end points thereof while a point (S14 in Fig. 1), offset by one point in the scan direction, is written as the other of the two end points. The pattern data generating system also includes a pattern data generating circuit (30) for, if w ( w is a positive integer) points b0, b1, ..., b(w-2), and b(w-1) are present on one scan line, writing EXOR of data of points b0, b1, ..., b(j-1) at positions corresponding to points b(j) ( j is not less than 0 and less than w ). Similar EXOR data writing is performed by the pattern data generating circuit (30) for all the scan lines. Then, pattern data, in which the area surrounded by the closed curve is filled or painted, is obtained.

Description: The present invention relates to a pattern data generating system for generating pattern data in which an arbitrary closed graphic pattern whose boundary data is defined on a two-dimensional bit map is filled or painted. In the field of graphics, it is often required to form pattern data by filling or painting an area defined by an polygonal boundary. It is also required to sequentially generate points, one by one, for forming an arbitrary curve and to fill or paint a portion surrounded by the curve, using hardware such as a DDA (digital differential analyzer). In a conventional system, in order to satisfy such requirements, filling or painting is performed by a scan conversion for polygons. According to the scan conversion, one direction on a two-dimensional bit map is selected. The selected direction is called a scan direction. A line parallel to the scan direction is called a scan line. When filling or painting is to be performed, the coordinates of both ends of a line, included in a closed graphic pattern, are obtained for each scan line, and all lines in the pattern are filled or painted, thereby painting the overall graphic pattern. EP 145821 describes a system for filling a pattern stored in a two-dimensional bitmap; the system comprises a control logic which includes means for producing output signals indicating changes in position in the x or y direction (see page 9, first paragraph), which are then sent to an edge filling logic which includes means for EXORing together successive bits of the stored bit pattern to provide data representing a filled area (see claim 4). A conventional filling/painting operation of a polygon using the scan conversion will be described with reference to Figs. 10 and 11A to 11C. Referring to Fig. 10, reference numeral 71 denotes a rectangular area to be scan-converted; 72 to 77, vertexes of the boundaries of a polygon; 78 to 83, sides of the polygon; and 91, one scan line. Procedure (1): Intersection points P0, P1, P2, and P3 of one scan line 91 and sides of the polygon are obtained. Then, the intersection points are sorted in the order of the coordinate values in the scan direction. Procedure (2): If a given intersection point is an end of a side, i.e., a vertex of the polygon, the given intersection point is processed in accordance with a connection state of the sides of the polygon. In the case shown in Fig. 11A, for example, vertex A is processed as a normal intersection point. In the case shown in Fig. 11B, one of vertexes B and C is processed as an intersection point. In the case shown in Fig. 11C, vertex D is processed as two intersection points. Procedure (3): The sorted intersection points are paired, and lines having these pairs as their both ends (lines 84 and 85 in Fig. 10) are filled or painted. Accordingly, in the conventional system, since software processing, such as sorting, takes a considerably long period of time, high-speed filling/painting cannot be performed. Further, it is practically difficult to achieve the function of the software processing by a hardware system. In addition, when lines are to be filled or painted, vertexes require special processing, as described in procedure (2). Moreover, even if a change in each point of a curve defining an area is generated in a software manner by using a processor or in a hardware manner by using a DDA or the like, the change in each point need be processed as one line in scan conversion. As a result, a large amount of data must be processed. As described above, in the conventional system, when painting of a closed graphic pattern is performed, various drawbacks are posed, e.g., high-speed processing cannot be performed, and a hardware system is difficult to arrange. The present invention has been made in consideration of the above situation, and has as its object to provide a pattern data generating system which can perform painting at high speed and can be easily formed into a hardware system. In order to achieve the above object, according to the present invention, there is provided a pattern data generating system including a processor (12) for writing in a bit map memory, on the basis of input data, points of all lines to be filled or painted along a scan direction which is one direction on the bit map memory. This writing is performed such that a point on each line is written as one of two end points thereof while a point, offset by one point in the scan direction, is written as the other of the two end points. The pattern data generating system also includes a pattern data generating circuit (30) for, if w ( w is a positive integer) points b0, b1, ..., b(w-2), and b(w-1) are present on one scan line, writing EXOR of data of points b0, b1, ..., b(j-1) at positions corresponding to points b(j) ( j is not less than 0 and less than w ). Similar EXOR data writing is performed by the pattern data generating circuit for all the scan lines, thereby generating pattern data in which the area surrounded by the closed curve is filled or painted. In the pattern data generating system according to the present invention, a special memory circuit is used to fill or paint the area surrounded by the closed curve. The special memory circuit is arranged such that row and column directions thereof respectively correspond to x and y directions of the bit map, and exclusive OR data of the points b0, b1, ..., b(j-1) to be written in each point b(j) is calculated for each row, using a hardware logic. According to the pattern data generating system of the present invention, boundary data has a direction defined as a clockwise or counterclockwise direction with respect to an area to be painted. This data is given as the coordinates of a start point of a closed curved and changes dx and dy of each point. In this case, each of changes dx and dy takes any one of +1, -1, and 0. In order to generate painted pattern data from such data, a special memory of a rectangular area of a memory is used, and points corresponding to the boundary of a closed curve are generated from data dx and dy and are written in the memory. In this case, the points corresponding to the boundary are not those on the boundary. That is, while a point on a line to be filled or painted is given as one of its end points, a point offset by one point in a scan direction is given as the other. After the points representing the boundary are written in the memory as described above, data are written in the points along the scan line, thereby obtaining painted pattern data. At this time, if one scan line includes, e.g., w bits and bit data at the respective points on the scan line are given as d0, d1, ..., d(w-1), the following exclusive OR calculations are sequentially performed. The exclusive OR results are written in the memory to obtain painted pattern data d0′, d1′, ..., d(w-1)′: This invention can be more fully understood from the following detailed description when taken in conjunction with the accompanying drawings, in which: Fig. 1 is a flow chart explaining the operation of a pattern data generating system according to a first embodiment of the present invention ; Fig. 2 is a block diagram showing a hardware configuration of the pattern data generating system of the above first embodiment; Fig. 3 illustrates how the contours of a pattern to be filled or painted are stored in a bit map memory; Fig. 4 illustrates the manner of obtaining fill/paint data from the contour data, using an EXOR operation; Fig. 5 is a modification of the flow chart shown in Fig. 1; Fig. 6 illustrates how the contours of another pattern to be filled or painted are stored in a bit map memory; Fig. 7 is a block diagram showing a hardware configuration of the pattern data generating system according to a second embodiment; Fig. 8 is a block diagram showing details of part of the hardware in Fig. 7; Fig. 9 is a flow chart explaining the operation of the pattern data generating system of the above second embodiment; Fig. 10 shows a pattern for explaining a conventional filling/painting operation; Fig. 11 shows figures used to explain the conventional filling/painting operation. Fig. 12 explains the timing of generating mode signals (M1, M2) used in the hardware of Fig. 8; and Fig. 13 is a block diagram showing the inner circuit configuration of the row data buffer (66) shown in Fig. 8. Embodiments of the present invention will be described below with reference to the accompanying drawings. Fig. 2 is a block diagram showing an arrangement of hardware used to realize a first embodiment of the present invention. Referring to Fig. 2, reference numeral 11 denotes an input unit comprising, e.g., a host computer; 12, a processor; 13, a memory; and 14, a display unit such as a CRT. These units are connected with each other through bus 15. In order to output a boundary of an area to be painted, input unit 11 sequentially outputs x- and y-coordinates at a start point and coordinate changes dx and dy at each point as data of a closed curve having a defined clockwise or counterclockwise direction. Each of changes dx and dy takes any one of +1, -1, and 0. On the basis of data dx and dy, processor 12 writes points of all the lines to be painted along a scan direction in a rectangular area (to be referred to as simply a memory hereinafter) of a two-dimensional bit map arranged in memory 13. In this case, a point on each line is written as one of its two end points in the memory, while a point offset by one point in the scan direction is written as the other. Alternatively, in place of input unit 11, processor 12 may output coordinate changes dx and dy. Processor 12 then performs calculations using data of points b0′, b1′, ..., b(w-2)′, and b(w-1)′ on one scan line written in the memory beforehand and writes calculated data in this memory or in a memory other than memory 13. The calculated data written in the memory is supplied as pattern data to display unit 14, and a pattern in which an area of the closed curve is painted is displayed. Pattern data is generated by using the above hardware in the following order. <1> All the data in the memory are cleared to be "0". <2> One of vertexes of a polygon is selected as a start point. <3> Points on the sides of the polygon are sequentially output clockwise from input unit 11, and differences (dx1,dy1) from the preceding points and differences (dx,dy) to the next points are sequentially output. Processor 12 sequentially outputs points representing a boundary in accordance with an algorithm shown in a flowchart of Fig. 1, and the generated points are written in the memory. When the points representing the boundary are to be written in the memory, an exclusive OR result of data d(x,y) of one bit of the memory corresponding to coordinates (x,y) and "1" is written. That is, the following relation is obtained: d(x,y) ← d(x,y) + "1" (2) <4> Assume that changes dx0 and dy0 from the start point to the next point are stored, changes throughout the sides of the polygon are similarly stored, and then the operation returns to the start point. In this case, processing shown in Fig. 1 is performed assuming that final changes are dx1 and dy1 and those from the start to next point are dx and dy. As a result, a point representing the boundary with respect to the start point is generated and written in the memory. <5> Assuming that one scan line includes x bits and bit data on the scan line is given as d0, d1, ..., d(w-1), new data d0′, d1′, ..., d(w-1)′ is generated by the following calculations and written as pattern data in the memory: In the flowchart shown in Fig. 1, dx and dy are given in step S1 (to be referred to as simply S hereinafter). In S2, the value of dy1 is checked. If the value is -1, the flow advances to S3; if 0, the flow advances to S4; and if +1, the flow advances to S5. In S3, the value of dy is checked. If the value is -1, the flow advances to S6; if 0, the flow advances to S7; and if +1, the flow advances to S8. In S6, a dot is plotted at point (x,y). Thereafter, point (x,y) is updated in S9, point (dx1,dy1) is updated in S10, and then the flow returns to S1. In S7 and S8, whether a right turn is to be made is checked. In this case, the right turn means that a vector of (dx,dy) is bent to the right with respect to a vector of (dx1,dy1). For example, assume that a coordinate system in which a right direction is a + direction of x and a left direction is that of y as shown in Fig. 3A is used. In this case, when the value of t given by the following equation is larger than 0 (t > 0), a right turn is to be made; when it is smaller than 0 (t < 0), a left turn is to be made; and when it equals 0 (t = 0), forward or backward movement is to be made: t = dx1·dy - dy1·dx (4) If no right turn is determined in any of S7 and S8, no dot is plotted at that point, and the flow advances to S9. If a right turn is determined in S7, a dot is plotted at point (x,y) in S6, and then the flow advances to S9. If a right turn is determined in S8, a dot is plotted at point (x,y) in S11, a dot is plotted at point (x+1,y) in S12, and then the flow advances to S9. In S4, whether a right turn is to be made is checked. If no right turn is determined in S4, no dot is plotted as described above. If a right turn is determined in S4, the flow advances to S13. In S13, the value of dy is checked. If the value is -1, a dot is plotted at point (x,y); and if +1, a dot is plotted at point (x+1,y). The flow then advances to S9. In S5, the value of dy is checked. If the value is -1, the flow advances to S15; if 0, it advances to S16; and if +1, it advances to S14 and a dot is plotted at point (x+1,y). In S15 and S16, whether a right turn is to be made is checked. If no right turn is determined in any of S15 and S16, no dot is plotted, and the flow advances to S9. If a right turn is determined in S15, a dot is plotted at point (x,y) in S11, and a dot is plotted at point (x+1,y) in S12. If a right turn is determined in S16, the flow advances to S14 and a dot is plotted at point (x+1,y). An operation of filling or painting a polygon having the closed curve as shown in Fig. 3A as its boundary in accordance with the above sequence will be described below. Assume that vertex p11 of the closed curve shown in Fig. 3A is selected as a start point. No data is written in point q11 stored in the memory shown in Fig. 3B and corresponding to point p11, i.e., point q11 is kept "0". Differences (dx,dy) = (0,-1) of next point p13 with respect to point p12 of the polygon are given. At this time, differences from preceding point p12 are given as (dx1,dy1) = (+1,-1). Since dy1 is -1 and dy = -1, "1" as an exclusive OR result between "-1" and "1" is written in coordinates (x,y), i.e., point q12 stored in the memory shown in Fig. 3B and corresponding to point p12. Differences (dx,dy) = (+1,0) of next point p14 with respect to point p13 are given. In this case, updated dy1 = -1 and dy = 0, and a right turn is to be made. In S6, therefore, "1" is written in coordinates (x,y), i.e., point q13 stored in the memory shown in Fig. 3B and corresponding to point p13. Differences (dx,dy) = (+1,+1) of next point p15 with respect to point p14 are given. In this case, dy1 = 0 and a right turn is to be made, and dy = +1. In S14, therefore, "1" is written in coordinates (x+1,y), i.e., point q14 stored in the memory shown in Fig. 3B and offset by one point to the right with respect to point p14. Differences (dx,dy) = (+1,-1) of next point p16 with respect to point p15 are given. In this case, dy1 = +1, dy = -1, and no right turn is to be made. Therefore, no dot is plotted at point p15. Differences (dx,dy) = (+1,+1) of next point p17 with respect to point p16 are given. In this case, dy1 = -1, dy = +1, and a right turn is to be made. In S11, therefore, "1" is written in coordinates (x,y), i.e., point q16A stored in the memory shown in Fig. 3B and corresponding to point p16. Then in S12, "1" is written in coordinates (x+1,y), i.e., point q16B stored in the memory shown in Fig. 3B and offset by one point to the right with respect to point p16. Differences (dx,dy) = (0,+1) of next point p18 with respect to point p17 are given. In this case, dy1 = +1 and dy = +1. In S14, therefore, "1" is written in coordinates (x+1,y), i.e., point q17 stored in the memory shown in Fig. 3B and offset by one point to the right with respect to point p17. Similarly, "1"s are written in points q18 and q19 stored in the memory shown in Fig. 3B and offset by one point each to the right with respect to points p18 and p19, respectively. Differences (dx,dy) = (-1,0) of next point p21 with respect to point p20 are given. In this case, dy1 = +1, dy = 0, and a right turn is to be made. In S14, therefore, "1" is written in coordinates (x+1,y), i.e., point q20 stored in the memory shown in Fig. 3B and offset by one point to the right with respect to point p20. Differences (dx,dy) = (-1,0) of point p22 with respect to point p21 are given. In this case, dy1 = +1, dy = 0, and movement to be made is not a right turn but a horizontal movement. Therefore, no dot is plotted at point p21. Differences (dx,dy) = (-1,-1) of next point p23 with respect to point p22 are given. In this case, dy1 = -1 and dy = -1. In S6, therefore, "1" is written in coordinates (x,y), i.e., point q22 stored in the memory shown in Fig. 3B and corresponding to point p22. Differences (dx,dy) = (-1,-1) of the next point (start point p11) with respect to point p23 are given. In this case, similar to the case of point p22, "1" is written in point q23 stored in the memory shown in Fig. 3B and corresponding to point p23. In this manner, the operation returns to start point p11. In this case, since final changes (dx1,dx1) are (-1,-1) and initial changes (dx,dy) are (+1,-1), dy1 = -1 and dy = -1 are obtained. In S6, therefore, "1" is written in coordinates (x,y), i.e., point q11 stored in the memory shown in Fig. 3B and corresponding to start point p11 for the first time. In this manner, for all the lines to be filled or painted along the scan direction, a point on each line is written as one of its two end points in the memory, while a point offset by one point in the scan direction is written as the other. Thereafter, calculations are performed in accordance with the sequence of process <5> using the data as shown in Fig. 3B, and calculation results are written in the memory. The above calculation can be performed by a hardware, or EXOR's 30-0 to 30-(w-1), as is shown in Fig. 4C. If one scan line includes w bits of b0, b1, ..., b(w-1) as shown in Fig. 4A, "0" as b0 in Fig. 4A is directly written in b0′ after calculation. An exclusive OR result between b0 and b1 shown in Fig. 4A is written in b1′ after calculation. In this case, since b0 = b1 = "0", "0" is written in b1′ after calculation. An exclusive OR result between b0, b1, and b2 shown in Fig. 4A is written in b2 after calculation. In this case, since b0 = b1 = "0" and b2 = "1", "1" is written in b2′ after calculation. Similar calculations are sequentially performed to obtain data as shown in Fig. 4B. As a result of calculations of all the scan lines shown in Fig. 3B, pattern data shown in Fig. 3C is obtained with respect to the input graphic pattern shown in Fig. 3A. Using this pattern data, a graphic pattern, in which the area of polygons having the closed curve shown in Fig. 3A as a boundary is filled or painted, can be accurately displayed. Incidentally, when a bit mask generator disclosed in Japanese Patent Application No. 63-20316, the inventors of which are the same as those of the present invention, is used to execute equation (3), the EXOR calculation speed can be further increased. According to the embodiment as described above, pattern data in which an area is surrounded by a closed curved can be generated. In addition, according to the above embodiment, unlike a conventional system, sorting need not be performed to realize high-speed processing. A modification of the above embodiment will be described below. In the above description, pattern data in which an area is surrounded by a closed curve is generated. However, pattern data in which a portion outside the above area is painted as shown in Fig. 3D can be generated. In this case, in place of the calculation of equation (3), the following calculation may be executed to the data shown in Fig. 3B for each scan line. In the above description, the closed curve is generated clockwise. In this modification, however, an algorithm shown in a flowchart of Fig. 5 in place of that shown in Fig. 1 may be used to process each point generated counterclockwise. In addition, in the above description, the area surrounded by the closed curve is filled or painted together with the boundary. The boundary, however, need not be included to perform filling or painting. In this case, the algorithm as shown in the flowchart of Fig. 5 may be used to process each point for a clockwise boundary, and that shown in the flowchart of Fig. 1 may be used to process each point for a counterclockwise boundary. As a result, data as shown in Fig. 3E is obtained from the boundary data as shown in Fig. 3A. When the calculation of equation (3) is executed to the data shown in Fig. 3E in units of scan lines, pattern data as shown in Fig. 3F is obtained. According to the above embodiment, filling or painting can be correctly performed to even boundary data as shown in Fig. 6A. That is, in this case, one scan line 21 shown in Fig. 6A has a boundary and four intersection points 22 to 25. Since two intersection points 23 and 24 are adjacent along a scan line, only a line connecting intersection points 22 and 25 may be painted. In this case, points 32, 33, and 34 are written as intersection points 22 to 25 as shown in Fig. 6B in accordance with procedure <3>. At this time, since point 33 is written twice, it becomes "0". Therefore, "1"s are written in two points 32 and 34 on scan line 21. As a result, correct pattern data in which an area including a boundary is filled or painted as shown in Fig. 6C is finally obtained. Fig. 7 is a block diagram showing an arrangement of hardware used to realize a second embodiment of the present invention. In the second embodiment, pattern data as described above is generated using exclusive hardware. This hardware comprises DDA unit 51, memory unit 52, control unit (CPU) 53, and bus 54 for connecting these units. DDA unit 51 has a DDA function and generates dx and dy signals. The dx and dy signals include two bits of DX0 and DX0, and DY0 and DY0, respectively. The dx signal is coded as shown in table 1 below. The dy signal is similarly coded as shown in table 2. DX0 DX0 dx 0 0 0 0 1 0 1 0 +1 1 1 -1 DY0 DY0 dy 0 0 0 0 1 0 1 0 +1 1 1 -1 Memory unit 52 is arranged as shown in a block diagram of Fig. 8. Referring to Fig. 8, reference numeral 61 denotes an n x m-bit memory cell array in which row and column directions correspond to x and y directions of a bit map, respectively; 62, an x counter comprising an up/down counter capable of holding and presetting an x-coordinate value; 63, a y counter comprising an up/down counter capable of holding and presetting a y-coordinate value; 64, a column decoder for decoding the contents in x counter 62 and generating a column selection signal; 65, a row decoder for decoding the contents in y counter 63 and generating a row selection signal; 66, a row data buffer for holding data of one row ( w bits) and having a calculation function to be described below; 67, a selector for dividing the w-bit data, held by row data buffer 66, into k ℓ-bits (ℓ x k = w), selecting one ℓ-bit data in accordance with part of a column address signal, and connecting the selected data to bus 54; and 68, a code generator for receiving the dx and dy signals and generating a 3-bit code for controlling the function of row data buffer 66. X counter 62 is preset by the value on bus 54 when 1-bit mode signal M1 is "0" (preset mode), and increments or decrements its contents on the basis of the dx signal when mode signal M1 is "1" (dx-dy input mode). Similarly, y counter 63 is preset by the value on bus 54 when mode signal M1 is "0", and increments or decrements its contents on the basis of the dy signal when mode signal M1 is "1". Buffer 66 has a calculation function and selectively performs the following four operations in accordance with 2-bit mode signal M2 (see Fig. 12A). [1] "0"s are written in one row selected by the row selection signal which is obtained from x counter 62 (M2 = 00). [2] The following operations are performed in accordance with a 3-bit code generated by code generator 68 (M2 = 01). 1) If the code is (0XX) and (100) (X is 0 or 1), nothing is performed. 2) If the code is (110), only a bit stored in the buffer and selected by the column selection signal is inverted and written in a row selected by the row selection signal. 3) If the code is (101), only a bit adjacent to a bit stored in the buffer and selected by the column selection signal in a direction of incrementing a column address is inverted and written in a row selected by the row selection signal. 4) If the code is (111), a bit stored in the buffer and selected by the column selection signal and a bit adjacent to the selected bit in a direction of incrementing a column address are inverted and written in a row selected by the row selection signal. [3] Data in the buffer is supplied to a bit mask generating circuit (not shown) for performing calculations given by equation (3), and a generated bit mask (e.g., the data as shown in Fig. 3C) is written in a row selected by the row selection signal (M2 = 10). [4] Data of one row selected by the row selection signal is fetched in the buffer and output to bus 54 through selector 67 (M2 = 11). Code generator 68 includes a register for storing dx1 and dy1 which are immediately preceding dx and dy, respectively, and generates 3-bit code D68 in response to inputs dx and dy in accordance with an algorithm as shown in a flowchart of Fig. 9. An example of the relation among dx, dy, dx1, and dy1 is shown in table 3 below: dY1 dY dX1 dX CODE D68 -1 -1 - - 110 0 - +1 110 - -1 000 +1 +1 +1 111 0 111 -1 000 0 +1 111 0 000 -1 000 -1 - 000 0 +1 +1 - 101 -1 - 000 0 - - 000 -1 +1 - 000 -1 - 110 +1 -1 +1 - 000 0 +1 000 0 000 -1 111 -1 +1 000 0 111 -1 111 0 - +1 000 - -1 101 +1 - - 101 Memory unit 52 shown in detail in Fig. 8 has the following five functions. (i) All the memory cells are cleared to be "0"s (M2 = 00). (ii) X- and y-coordinates are externally input through bus 54 and set as preset data in x and y counters 62 and 63, respectively (M2 = 01). (iii) The dx and dy signals are externally input through bus 54 to increment or decrement the contents in x and y counters 62 and 63, respectively, and the following processing is performed in correspondence with a code generated in accordance with the algorithm of the flowchart shown in Fig. 9 together with dx1 and dy1 (this is called a DDA mode; M2 = 01). 1) If the code is (110), the content in a memory cell at point (x,y) is inverted. 2) If the code is (101), the content in a memory cell at point (x+1,y) is inverted. 3) If the code is (110), the contents in memory cells at points (x,y) and (x+1,y) are inverted. (iv) Row data of all the rows are sequentially input to the bit mask generator, and obtained outputs are written (this is called a filling or painting mode; M2 = 10). (v) The contents in memory cell array 61 are read out in units of k bits (this is called a read mode; M2 = 11). Control unit 53 sets various parameters in DDA unit 51 through bus 54 to activate DDA unit 51 and outputs mode signals M1 and M2 (Figs. 12A and 12B) to memory unit 52 to control it. Filling or painting using the above hardware is performed as follows. (a) A closed curve is divided into partial curves or straight lines. (b) Parameters are set in DDA unit 51 to activate it (M2 = 00 in Fig. 12A). (c) DDA unit 51 generates dx and dy (Fig. 12B). (d) Data about a boundary is written in memory unit 52 in accordance with dx and dy (M2 = 01 in Fig. 12A). (e) Procedures (b) to (d) are repeated the number of times corresponding to the number of partial curves. This process can be executed at high speed by a pipe line operation technique. (f) Memory unit 52 is operated in the filling or painting mode, and pattern data is written in memory unit 52 (M2 = 10 in Fig. 12A). (g) In the read mode, the written pattern data is read out from memory unit 52 (M2 = 11 in Fig. 12A). In this manner, according to this embodiment, the special hardware is used to obtain filled or painted pattern data. In the above embodiment, assuming that an operation period of DDA unit 51 is T0; the number of points on a boundary is N; and a time required for filling or painting one scan line in memory unit 52 in the filling/painting mode is T1, time Tp required for the filling/painting processing is given by the following equation: Tp = T0 + N·T1 (6) As is apparent from this embodiment, the system according to the present invention can be easily formed into an exclusive hardware system, and filling or painting can be performed at high speed. According to the present invention as has been described above, sorting need not be performed unlike in a conventional system. When processing is performed in a software manner, therefore, a load on software processing can be reduced to increase a processing speed. In addition, since sorting is unnecessary, an exclusive hardware arrangement can be easily realized to enable high-speed processing. Furthermore, according to the present invention, by offsetting one of the end points of a line to be filled or painted from an actual coordinate point, filling or painting of lines can be easily performed. Also, since special software processing for vertexes performed in a conventional system is not required, high-speed filling/painting can be performed. incidentally, details of DDA unit 51 in Fig. 7 are substantially disclosed in the following literature: W.M. Newman, and R.F. Sproul, "Principle of Interactive Computer Graphics", pp. 20-28, McGraw-Hill, 1979 All disclosures of the above-identified literature are incorporated in the present specification. When the unit disclosed in the above literature is applied to the present invention, the aforementioned algorithm, identified by items (i) to (v) in the present specification, may be replaced by the following algorithm: Fig. 13 shows an internal circuit configuration of the row data buffer in Fig. 8. The w-bit (= k x ℓ bits) signal lines of row data from memory cell array 61 are connected to selector 66A. Selector 66A receives 2-bit mode signal M2 which can have four states (00; 01; 10; 11), as is shown in Fig. 12A, in response to the mode of the circuit operation of Fig. 8. Thus, the signal selection state of selector 66A is determined by mode signal M2. The row data selected by selector 66A is input to bit mask generator 66B. Generator 66B is provided with a hardware logic formed of EXOR gate array. The bit mask pattern obtained from bit mask generator 66B is input to drawing logic 66C. Logic 66C is responsive to the contents of code D68 (cf. table 3) generated by code generator 68. In response to code D68, generator 68 generates filling/painting pattern data in which bits of input bit mask pattern (or the column decode signal representing the x position) to be inverted have been inverted. The filling/painting pattern data for one row delivered from drawing logic 66C is temporarily stored or latched by row data latch 66D. The latched filling/painting pattern data of k x ℓ bits is input to selector 67. Selector 67 selects the ℓ-bit filling/painting pattern data designated by a selection signal from x counter 62 in Fig. 8. When an output enable signal becomes logic "1", selector 67 sends the selected ℓ-bit filling/painting pattern data to bus 54. Filling/painting pattern data in unit of ℓ-bit can thus be obtained in high speed. Incidentally, the aforementioned output enable signal is obtained from AND gate 66E which produces the logical product of 2-bit mode signal M2 (Fig. 12A). More specifically, when two bits of mode signal M2 are both logic "1", or M2 = "1,1", then the output enable signal becomes logic "1" so that the selected ℓ-bit data is sent to bus 54. Note that there are following Japanese Patent Applications which can be used with the present invention: (1) Japanese Patent Application No. 63-20314, filed on January 30, 1988; and (2) Japanese Patent Application No. 63-20316, filed on January 30, 1988. The inventors of the present invention are identical to the inventors of the above Japanese Patent Applications, and new patent applications corresponding to these Japanese Patent Applications will also be filed at U.S. Patent Office. All disclosures of the above Japanese Patent Applications and the corresponding U.S. Patent Applications are now incorporated in the specification of the present invention. While the invention has been described in connection with what is presently considered to be the most practical and preferred embodiment, it is to be understood that the invention is not limited to the disclosed embodiment but, on the contrary, is intended to cover various modifications and equivalent arrangements included within the scope of the appended claims, which scope is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent arrangements.

Claims: A pattern data generating system for generating pattern data used to fill or paint a region encircled by a closed curve on a bit map, said bit map being defined on an x-y plane on which a scan line (21) is presented, said pattern data generating system comprising: a bit map memory (13 or 61) for storing data of the bit map; first means (11 or 51) for generating data dx and dy representing a change in position on the x-y plane between a given point of the closed curve and a succeeding point, being adjacent to said given point, on the closed curve; second means (12 or 66B, 68; cf. Figs. 4A-4C) for detecting logical EXOR b0', b1' ..., b(w-2)' from data of points b0, b1, ..., b(j-1), according to the formula; and writing data of said EXOR b0', b1', ..., b(w-2)' into said bit map memory (13 or 61) at locations respectively corresponding to said points b0, b1, ..., b(j-1), wherein parameters w and j are integers provided that 0 ≦ j < w, and said scan line (21) contains w points b0, b1, ..., b(w-1); and third means (12 or 66C, 68), being responsive to said data dx and dy, for writing into said bit map memory (13 or 61) a first position data of each one end of one or more line components (22-23; 24-25) to be filled or painted and formed on said scan line (21), and for writing into said bit map memory (13 or 61) a second position data of each point of each of said line components (22-23; 24-25) which is shifted by one dot of the bit map in the scan direction. A pattern data generating system according to claim 1, characterized in that the change in position from said given point toward said succeeding point is a right turn or clockwise along said closed curve, and each said data dx and dy has a value of +1, -1, or 0. A pattern data generating system according to claim 2, characterized in that said second means (12) includes a computer (12) which executes the following steps: (Fig. 1) 1st step (s1) for detecting said data dx and dy which show a change in position on the x-y plane from the given point, e.g., p12, to the succeeding point, e.g., p13, being adjacent to the given point and being located on said closed curve, and for detecting data dx1 and dy1 which show another change in position on the x-y plane from the given point, e.g. p12, to a preceding point, e.g., p11, being adjacent to the given point and being located on said closed curve; 2nd step (s2) for checking the value of said data dy1; 3rd step (s3) for checking the value of said data dy when said data dy1 = -1; 4th step (s4) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy1 = 0; 5th step (s5) for checking the value of said data dy when said data dy1 = +1; 6th step (s6) for plotting a dot on a position (x, y) on said x-y plane when said data dy = -1 at the 3rd step (s3); 7th step (s7) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy = 0 at the 3rd step (s3); wherein if the position change is a right turn, the content of the 6th step (s6) is executed; 8th step (s8) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy = +1 at the 3rd step (s3); 9th step (s9) for updating coordinate data x and y of said x-y plane, after the content of the 6th step (s6) is executed, or if the 4th, 7th or 8th step (s4, s7, or s8) detects that the position change is not a right turn; and 10th step (s10) for updating said data dx1 and dy1, in conjunction with updating said coordinate data x and y completed at the 9th step (s9). A pattern data generating system according to claim 3, characterized in that said computer (12) further executes the following steps: (Fig. 1) 11th step (s11) for plotting a dot on a position (x, y) on said x-y plane if the 8th step (s8) detects that the position change is a right turn; 12th step (s12) for plotting a dot on a position (x+1, y) on said x-y plane, in conjunction with the plotting performed at the 11th step (s11), the content of the 9th step (s9) being executed thereafter; 13th step (s13) for checking the value of said data dy if the 4th step (s4) detects that the position change is a right turn; wherein the content of the 6th (s6) is executed when said data dy = -1; 14th step (s14) for plotting a dot on a position (x+1, y) on said x-y plane, if the 5th or 13th step (s5 or s13) detects that said data dy = +1, the 9th step (s9) being executed after completing the 14th step (s14); 15th step (s15) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy = -1 at the 5th step (s5); wherein if the position change is a right turn, the content of the 11th step (s11) is executed, and if the position change is not a right turn, the content of the 9th step (s9) is executed; and 16th step (s16) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy = 0 at the 5th step (s5); wherein if the position change is a right turn, the content of the 14th step (s14) is executed, and if the position change is not a right turn, the content of the 9th step (s9) is executed. A pattern data generating system according to claim 2, characterized in that said second means (12) includes a computer (12) which executes the following steps: (Fig. 9) 1st step (s1) for detecting said data dx and dy which show a change in position on the x-y plane from the given point, e.g., p12, to the succeeding point, e.g., p13, being adjacent to the given point and being located on said closed curve, and for detecting data dx1 and dy1 which show another change in position on the x-y plane from the given point, e.g. p12, to a preceding point, e.g., p11, being adjacent to the given point and being located on said closed curve; 2nd step (s2) for checking the value of said data dy1; 3rd step (s3) for checking the value of said data dy when said data dy1 = -1; 4th step (s4) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy1 = 0; 5th step (s5) for checking the value of said data dy when said data dy1 = +1; 6th step (s60) for outputting data "110" when said data dy = -1 at the 3rd step (s3); 7th step (s7) for checking whether or not the change in position from said given point (p12) toward said succeeding point (p13) is a right turn, when said data dy = 0 at the 3rd step (s3); wherein if the position change is a right turn, the content of the 6th step (s60) is executed; 8th step (s8) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is succeeded in right turn, when said data dy = +1 at the 3rd step (s3); 9th step (s70) for outputting data "000" if the 4th, 7th or 8th step (s4, s7, or s8) detects that the position change is not a right turn; and 10th step (s80) for outputting data "111" if the 8th step (s8) detects that the position change is a right turn; 11th step (s13) for checking the value of said data dy if the 4th step (s4) detects that the position change is succeeded in right turn; wherein the content of the 6th (s60) is executed when said data dy = -1; 12th step (s90) for outputting data "101" if the 5th or 13th step (s5 or s13) detects that said data dy = +1; 13th step (s15) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy = -1 at the 5th step (s5); wherein if the position change is a right turn, the content of the 10th step (s80) is executed, and if the position change is not a right turn, the content of the 9th step (s70) is executed; 14th step (s16) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a right turn, when said data dy = 0 at the 5th step (s5); wherein if the position change is a right turn, the content of the 12th step (s90) is executed, and if the position change is not a right turn, the content of the 9th step (s70) is executed; and 15th step (s100) for setting contents of said data dx and dy as those of said data dx1 and dy1, respectively, in accordance with said data "110", "000", "111", or "101", respectively obtained by the 6th, 9th, 10th, or 12th step (s60, s70, s80, s90). A pattern data generating system according to claim 1, characterized in that the change in position from said given point toward said succeeding point is a left turn or counterclockwise along said closed curve, and each said data dx and dy has a value of +1, -1, or 0. A pattern data generating system according to claim 6, characterized in that said second means (12) includes a computer (12) which executes the following steps: (Fig. 5) 1st step (s1) for detecting said data dx and dy which show a change in position on the x-y plane from the given point, e.g., p12, to the succeeding point, e.g., p13, being adjacent to the given point and being located on said closed curve, and for detecting data dx1 and dy1 which show another change in position on the x-y plane from the given point, e.g. p12, to a preceding point, e.g., p11, being adjacent to the given point and being located on said closed curve; 2nd step (s2) for checking the value of said data dy1; 3rd step (s3) for checking the value of said data dy when said data dy1 = -1; 4th step (s4) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a left turn, when said data dy1 = 0; 5th step (s5) for checking the value of said data dy when said data dy1 = +1; 6th step (s6) for plotting a dot on a position (x, y) on said x-y plane when said data dy = -1 at the 3rd step (s3); 7th step (s7) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a left turn, when said data dy = 0 at the 3rd step (s3); wherein if the position change is a left turn, the content of the 6th step (s6) is executed; 8th step (s8) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a left turn, when step data dy = +1 at the 3rd step (s3); 9th step (s9) for updating coordinate data x and y of said x-y plane, after the content of the 6th step (s6) is executed, or if the 4th, 7th or 8th step (s4, s7, or s8) detects that the position change is not a left turn; and 10th step (s10) for updating said data dx1 and dy1, in conjunction with updating said coordinate data x and y completed at the 9th step (s9). A pattern data generating system according to claim 7, characterized in that said computer (12) further executes the following steps: (Fig. 5) 11th step (s11) for plotting a dot on a position (x, y) on said x-y plane if the 8th step (s8) detects that the position change is a left turn; 12th step (s12) for plotting a dot on a position (x+1, y) on said x-y plane, in conjunction with the plotting performed at the 11th step (s11), the content of the 9th step (s9) being executed thereafter; 13th step (s13) for checking the value of said data dy if the 4th step (s4) detects that the position change is succeeded in left turn; wherein the content of the 6th (s6) is executed when said data dy = -1; 14th step (s14) for plotting a dot on a position (x+1, y) on said x-y plane, if the 5th or 13th step (s5 or s13) detects that said data dy = +1, the 9th step (s9) being executed after completing the 14th step (s14); 15th step (s15) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a left turn, when said data dy = -1 at the 5th step (s5); wherein if the position change is a left turn, the content of the 11th step (s11) is executed, and if the position change is not a left turn, the content of the 9th step (s9) is executed; and 16th step (s16) for checking whether or not the change in position from said given point, e.g. p12, toward said succeeding point, e.g. p13, is a left turn, when said data dy = 0 at the 5th step (s5); wherein if the position change is a left turn, the content of the 14th step (s14) is executed, and if the position change is not a left turn, the content of the 9th step (s9) is executed. A pattern data generating system according to claim 1, characterized by further comprising: an x-counter (62) for counting said data dx to provide an x count value; a column decoder (64), coupled to said x-counter (62), for outputting column data corresponding to said x count value; a y-counter (63) for counting said data dy to provide a y count value; a row decoder (65), coupled to said y-counter (63), for outputting row data corresponding to said y count value; a bit map memory cell array (61) coupled to said column decoder (64) and said row decoder (65) and being addressed in accordance with said column and row data; a code generator (68) for generating a code (D68 in table 3) in accordance with contents of said data dx and dy; a row data buffer (66), coupled to said bit map memory cell array (61) and said code generator (68), and being responsive to said code (D68), for performing a filling or painting operation with respect to data stored in said bit map memory cell array (61). A pattern data generating system according to claim 1, characterized in that said second means (12 or 66C, 68) includes: means (62) for providing first data (dx, dx1) in response to said data dx; means (63) for providing second data (dy, dy1) in response to said data dy; hardware logic means (68) for generating a logic code (D68) from contents of said first and second data (dx, dx1; dy dy1) in accordance with a predetermined truth table (table 3); a memory (61), coupled to said first data providing means (62) and said second data providing means (64), for storing given bit map data; means (66), coupled to said memory (61) and said hardware logic means (68), for performing a filling or painting operation with respect to the bit map data stored in said memory (61), said filling or painting operation being performed to be based on contents on said logic code (D68).

Inventors: KAI, NAOYUKI C/O PATENT DIVISION, MINAGAWA, TSUTOMU C/O PATENT DIVISION, OHHASHI, MASAHIDE C/O PATENT DIVISION
Applicants: KABUSHIKI KAISHA TOSHIBA
Application year: 1989
Main classification: G09G1
IPC codes: G09G5, G06T11