Graphic drawing method and graphic drawing device

Abstract: A graphic processing device is composed of a main storage device (102), a drawing control device (105) and a drawing device (110). The main storage device (102) stores data relative to the coordinates of plural graphics (103, 104). The drawing control device (105) reads out the data relative to the coordinates of the plural graphics stored in the main storage device, scans the coordinate data to calculate the coordinates of intersecting points of a scanning line and the plural graphics for each position of the scanning line. The drawing control device also decides an over­ lapping area (AND area) or a common area (OR area) of the plural graphics on the basis of the coordinates of the intersecting points of the plural graphics and the scanning line. The drawing device draws the overlapping area (AND area) and the common area (OR area) of the plural graphics as a graphic.

Description: BACKGROUND OF THE INVENTION The present invention relates to a graphic drawing method and graphic drawing device for drawing a graphic in a specified area, and more particularly to a graphic drawing method and graphic drawing device which can draw a high-definition and high-resolution graphic with a small storage capacity when clipping any optional shape. Previously known techniques for clipping any optional shape include a working area technique and a square clipping technique. In the working area technique, in order to clip an optional shape, a clip frame memory having the same size as that of a frame memory is provided as a working area and a storage area, and a clipped graphic is once drawn on the clip frame memory; in actually drawing a graphic, the filling-over thereof is made with reference to the clipped graphic stored in the clip frame memory. Incidentally, as disclosed in JP-A-59-85573, a graphic can be drawn by clipping for each scanning line using a memory corresponding to one scanning line. On the other hand, in the square clipping technique, in order to clip any optional shape at a high speed, the clipped area is divided into minute square regions; in actually drawing a graphic, clipping for the plural minute regions thus formed is carried out to approximate the optional shape. The prior art techniques mentioned above have the following disadvantages. The working area technique provides poor efficiency of use of memory since the clipping memory having a large size is required for an output device with a high resolution such as a printer. On the other hand, the square clipping technique has no problem of using efficiency of memory, but it cannot be used when high drawing quality is required in e.g. a printer owing to its approximation manner. SUMMARY OF THE INVENTION An object of the present invention is to provide a graphic drawing method and a graphic drawing device which can perform graphic processing with high drawing quality at a high speed and in a smaller memory storage than in the prior art. More specifically, an object of the present invention is to provide a graphic processing device which can perform graphic clipping processing with high memory using efficiency and high drawing efficiency without using a memory and approximation means for clipping an optional shape, and a graphic processing system and graphic drawing method using the graphic drawing device. In order to attain the above object, in accordance with the present invention, there is provided a graphic processing device comprising graphic-to-be-clipped storage means for storing a graphic-to-be-clipped specifying a region-to-be-drawn, graphic-to-be-drawn storage means for storing a graphic-to-be-drawn to be defined by the region-to-be-drawn, coordinate calculation means for calculating the coordinates of intersecting points of the stored graphic-to-be-clipped and graphic-to-be-drawn and individual scanning lines, and graphic area-to-be-drawn decision means for deciding an overlapping area of the graphic-to-be-clipped and the graphic-to-be-drawn on each scanning line from each coordinate value acquired by the coordinate calculation means, wherein the graphic corresponding to the overlapping area decided by the graphic region-to-be-drawn decision means is drawn. Moreover, in order to attain the above object, in accordance with the present invention, there is provided a method comprising the steps of storing a graphic-to-be-clipped specifying a region-to-be-drawn and a graphic-to-be-drawn to be defined by the region-to-be-drawn, calculating the coordinates of intersecting points of the stored graphic-to-be-clipped and graphic-to-be-drawn and individual scanning lines, deciding an overlapping area of the graphic-to-be-clipped and the graphic-to-be-drawn on each scanning line from each coordinate value thus acquired, wherein the graphic corresponding to the overlapping area of the overlapping area decision means is drawn. In operation, the graphic-to-be-clipped storage means and the drawing graphic storage means store the coordinate data, e.g. contour segment data, of a graphic-to-be-clipped and a graphic-to-be-drawn, respectively. The coordinate calculation means extracts the coordinate data (contour segment data) from the graphic-to-be-clipped storage means and the graphic-to-be-drawn storage means to acquire the coordinates of intersecting points of the coordinate data and scanning lines in raster scanning. Using the coordinates of the intersecting points, the graphic area-to-be-drawn decision means decides the overlapping area of the graphic-to-be-clipped and the graphic-to-be-drawn on each scanning line. The graphic corresponding to the overlapping area decided by the graphic area-to-be-drawn decision means is drawn. In this way, a clipping processing is carried out using the coordinate values so that it is not necessary to use a clipping frame memory for decision of the overlapping area. Moreover, the clipping processing for clipping an optional shape can be realized without making square approximation so that it can be carried out with high memory using efficiency and high drawing quality. Incidentally, it is assumed in this specification that a graphic includes a character as well as a common graphic such as a triangle. Although the clipping processing has been explained in connection with acquiring an overlapping area (AND area) of the graphic, the present invention can be applied to acquiring a common area (OR area) of the graphic. In accordance with the present invention, unlike the prior art, the clipping frame memory for clipping any shape is not required and square approximation for the clipping is not also required so that a graphic processing device which can carry out the high speed clipping with high memory using efficiency and high drawing quality can be provided. DE 33 35 162 discloses a device and a method for generating, displaying and manipulating graphics on a computer. According to this prior art, the areas of graphics to be drawn are defined by means of so-called "inversion points". The inversion point is defined as being a point for which the logical states of all points the coordinates of which are on the right of or below this point are inverted. The set of inversion points is stored and represents the complete information of the respective area, without storing all points forming this area. The graphic to be drawn is scanned, and the starting and endpoints on the scanning lines are the inversion points. This system leads to a reduction in the necessary memory size. On the other hand, the present invention relates to the determination of overlapping of graphics based on region-to-be-drawn and region-to-be-clipped scanning signals, with consideration of the intersection points of the graphics with the scanning lines, and the overlapping decision being made on the basis of attribute-added intersection point coordinate data. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram showing an arrangement of the present invention; Fig. 2 is a block diagram for explaining a graphic drawing method according to the present invention; Fig. 3 is a view for explaining an example of the graphic processing method according to the present invention; Fig. 4 is a block diagram for explaining a second embodiment of the present invention; Fig. 5 is a block diagram for explaining a third embodiment according to the present invention; and Fig. 6 is a view for explaining an example of the graphic processing method according to the third embodiment of the present invention. DESCRIPTION OF THE PREFERRED EMBODIMENTS An embodiment of the present invention will be explained below. An entire system arrangement of the present invention is shown in Fig. 1. A control unit 101 controls the entire system. A graphic-to-be-drawn and a graphic-to-be-clipped are stored in the corresponding storage portions 103 and 104 in main storage 102. In drawing a graphic, the control unit 101 commands that a graphic drawing unit 105 draws a graphic using the graphic information stored in the main memory 102. The graphic drawing control unit 105 extracts each item of graphic information from the main memory 102 to calculate the intersecting points of each side of a graphic-to-be-clipped and each scanning point in a frame memory 109 using a coordinate calculation unit 106. A series of coordinate points thus acquired are sent to a graphic region-to-be-drawn decision unit 107 to decide a starting point and an end point of the region-to-be-drawn from their values. A graphic creation control unit 108 fills the region-to-be-drawn on the corresponding scanning line using the starting point and the end point. By successively carrying out the above processing for each scanning line, the graphic clipped by a graphic-to-be-clipped on the basis of the coordinates of the intersecting points is stored as graphic data in the frame memory 109. The graphic stored in the frame memory 109 is drawn by a drawing device (CRT). Now referring to Figs. 2 and 3, the processings for drawing a graphic will be explained. A graphic-to-be-drawn and a graphic-to-be-clipped as shown in Fig. 3 are stored in graphic-to-be-drawn storage means 103 and graphic-to-be clipped storage means 104. A scanning-line scanning unit 200 successively updates the scanning line to be processed for filling for each scanning line in the frame memory 109. The filling for each scanning line will be explained below. A coordinate-to-be-drawn calculation means 1061 successively extracts graphic segment data 220 from the graphic-to-be-drawn storage means 103 and calculate the intersecting points of the graphic segment data 220 and a scanning line at issue to acquire intersecting-point coordinate-data-to-be-drawn 222. A coordinate-to-be-drawn calculation means 1062 successively extracts segment-data-to-be-drawn 221 representative of the graphic-to-be-clipped from the graphic-to-be-clipped storage means 104 and calculates the intersecting points of the segment data 221 and a scanning line at issue to acquire clipping intersecting-point-coordinate-data-to-be-clipped 223. A rearrangement means 205 rearranges the intersecting-point-coordinate-data-to-be-drawn 221 and the clipping intersecting-point-coordinate-data to be-clipped 223 in the order of a scanning direction to provide attribute-added intersecting-point coordinate data 224. The data 224 are composed of attribute values, which discriminate between the graphic-to-be-clipped data and the graphic-to-be-clipped data, and coordinate values. For example, in the case of Fig. 3, the coordinates of the intersecting points of the graphic-to-be-drawn 303 on a scanning line 302 are d1 (304), d2 (306), and those of the graphic-to-be-clipped 301 are c1 (305) and c2 (307). The rearrangement means 205 rearranges these coordinate data in the order of a scanning direction as shown in Fig. 3, i.e. in the order of d1, c1, d2 and c2. An attribute decision means 206 extracts the attribute-added intersecting-point coordinate data 224 one by one; it decides its attribute to provide an attribute decision signal 225 discriminating between the drawing graphic-to-be-drawn data and the graphic-to-be-clipped data, and also outputs its coordinate value as an intersecting-point coordinate value 226. A region-to-be-drawn decision means 207, which is activated when the attribute signal 225 indicates the graphic-to-be-drawn, decides the coordinate value from the attribute decision signal 225 and the intersecting-point 226 if it is a starting point or an ending point of the drawing graphic, if the coordinate point is the drawing starting point, a drawing signal area signal 227 is made 'on' whereas if the coordinate point is the drawing ending point, the signal 227 is made 'off'. On the other hand, a region-to-be-clipped decision means 208, which is activated when the attribute signal 225 indicates the graphic-to-be-drawn, decides the coordinate value from the attribute decision signal 225 and the intersecting-point 226 if it is a starting point or an ending point of the graphic-to-be-clipped; if the coordinate point is the clipping starting point, an area-to-be-clipped signal 228 is made 'on' whereas if the coordinate point is the clipping ending point, the signal 227 is made 'off'. In this embodiment, the region-to-be-drawn decision means 207 and the region-to-be-clipped decision means 208 decide the region-to-be-drawn and the region-to-be-clipped on the basis of an even-odd rule. More specifically, the decision means 207 and 208, if the intersecting point is located at an odd number from the left side, decides the corresponding data to be a region starting point to make the region signal 'on', and if the intersecting point is located at an even number from the left side, decides the corresponding data to be a region ending point to make the region signal 'off'. In this way, when the attribute-added intersecting-point coordinate data 224 (d1-304, c1-306, d2-305 and c2-307) are successively received as the attribute decision signal 225 and the intersecting-point coordinate value 226 through the attribute decision means 206, the region-to-be-drawn decision means 207 changes the region-to-be-drawn signal 227 as shown in Fig. 3, and the region-to-be-clipped decision means 208 changes the region-to-be-clipped signal 228. An area-to-be-drawn decision means 209, in response to the region-to-be-drawn signal 227 and region-to-be-clipped signal 228, decides that the drawing is valid when both region signals are valid, i.e. 'on' to make a drawing valid region signal 229 'on' as shown in Fig. 3. A graphic production means 108 recognizes the intersecting-point 226 as a drawing (filling) starting point at the rising edge of the drawing valid region signal 229 and as a drawing ending point at the trailing edge thereof and fills the segment 312 on a scanning line delimited by the starting point and ending point on the frame memory 109. The above operation is carried out for all the attribute-added intersecting-point coordinates 224 to fill the scanning line at issue. By carrying out the operation described above for all the scanning lines, in accordance with this embodiment, the processing of clipping any shape can be performed without using a working memory. Incidentally, although this embodiment has been explained in connection with a common graphic, it can be applied to a character in place of the graphic. Embodiment 2 A second embodiment of the present invention will be explained with reference to Fig. 4. In this embodiment, in addition to the arrangement of the previous embodiment, there is provided means for setting the scanning region of a graphic-to-be-clipped. The graphic-to-be-clipped scanning region setting means is provided to acquire the minimum and maximum values of the graphic-to-be-clipped in the direction of a scanning line. Specifically, in Fig. 4, the means 400 sets the scanning region of the graphic-to-be-clipped with reference to the clipping segment data of the graphic-to-be-clipped from a graphic-to-be-clipped storage means 104. Namely, the means 400 sets the minimum and maximum scanning line values in the scanning line direction and sends these two values to a scanning line scanning unit 200. The scanning line scanning unit 200 scans, in actually drawing a graphic, only the segment of the scanning line delimited by the minimum and maximum scanning line values. In this way, by scanning only the area where a graphic-to-be-clipped is located, the clipping processing can be performed at a higher speed than in the previous embodiment. Also, means for setting the scanning region of a graphic-to-be-drawn may be provided to provide the same effect. Moreover, this embodiment may be also applied to writing a graphic as well as drawing the graphic. Embodiment 3 A third embodiment of the present invention will be explained with reference to Fig. 5. In this embodiment, in addition to the arrangement of Fig. 2, there are provided a multiple region-to-be-drawn decision unit 501 and a multiple region-to-be-clipped decision unit 502 in order to process plural drawing graphics and plural clipping graphics. A processing example in this embodiment is shown in Fig. 6. If there are plural graphics to be drawn, a drawing coordinate calculation unit 1061 calculates the coordinates of the respective graphics to be drawn on each scanning line. First, attributes corresponding to the graphics are added to the coordinates, and a series of these drawing coordinate points are rearranged in the direction of a scanning line. Next, a flag indicative of the region-to-be-drawn for each graphic is prepared and its initial value is set for 'off'. The rearranged coordinates are extracted one by one to decide from the attribute of each coordinate which graphic the coordinate corresponds to. If that coordinate is a drawing starting point, the flag corresponding to that graphic is made 'on'; if that coordinate is a drawing ending point, the flag corresponding to that graphic is made 'off'. A multiple region-to-be-drawn decision unit 501 decides the coordinate when either one of all the graphic flags turns 'on' to be a drawing starting point and sends it to a graphic area-to-be-drawn decision unit 107. On the other hand, the decision unit 501 decides the coordinate when all the graphic flags turn 'off' to be a drawing ending point and sends it, to the decision unit 107. In this way, an area to be drawn (a common area, i.e. OR area for the respective graphics) can be acquired on the basis of a series of the coordinate points. Also in the case where there are plural clipping graphics, a clipping coordinate calculation unit 1062 calculates the coordinates of the respective clipping graphics on each scanning line. First, attributes corresponding to the graphics are added to the coordinates, and a series of these clipping coordinate points are rearranged in the direction of a scanning line. Next, a flag indicative of the clipping region for each graphic is prepared and its initial value is set for 'off'. The rearranged coordinates are extracted one by one to decide from the attribute of each coordinate which graphic-to-be-clipped the coordinate corresponds to. If that coordinate is a clipping starting point, the flag corresponding to that graphic-to-be-clipped is made 'on'; if that coordinate is a clipping ending point, the flag corresponding to that graphic-to-be-clipped is made 'off'. A multiple clipping region decision unit 502 decides the coordinate when either all the graphic-to-be-clipped flags turns 'on' to be a clipping starting point and sends it to a graphic area-to-be-drawn decision unit 107. On the other hand, the decision unit 502 decides the coordinate when either one of the graphic flags turns 'off' to be a clipping ending point and sends it to the decision unit 107. In this way, an area to be clipped (an overlapping area, i.e. AND area for the respective graphics) can be acquired on the basis of a series of the coordinate points. Although in this embodiment, two drawing or clipping graphics are multiplexed, three or more drawing or clipping graphics multiplexed can be processed in the same way.

Claims: Method for drawing graphics on a computer system, comprising the steps of: (A) storing coordinate data relative to coordinates of one or a plurality of graphics-to-be-drawn (303) and relative to coordinates of one or a plurality of graphics-to-be-clipped (301) each specifying an area to be drawn, in storage means (102; 103, 104), (B) reading out the data from the storage means (102; 103, 104), (C) scanning successively the graphics to be processed, in scanning lines (302) based on the read coordinate data, (D) calculating the coordinates of the intersection points (304, 306) of the scanning lines (302) with the graphics-to-be-drawn (303) and the coordinates of the intersection points (305, 307) of the scanning lines (302) with the graphics-to-be-clipped (301), and adding attribute data to the calculated coordinates of the intersection points (304-307), the attribute data indicating to which graphic the coordinates belong, to obtain attribute-added intersection-point coordinate data (224), (E) deciding an overlapping area (AND area) or a common area (OR area) of the graphics (303, 301) on the basis of the attribute-added intersection-point coordinate data (224), and (F) drawing the decided overlapping area (AND area) or common area (OR area) of the graphics (303, 301) (Figs. 2, 3). The method according to claim 1, wherein the data stored in step (A) and read out in step (B) are contour segment data (220, 221) of the respective graphics (303, 301). Graphic processing device for carrying out the method according to claims 1 and 2, comprising: (I) graphic-to-be-drawn storage means (103) for storing coordinate data relative to coordinates of graphics-to-be-drawn (303), (II) graphic-to-be-clipped storage means (104) for storing coordinate data relative to coordinates of graphics-to-be-clipped (301) specifying the area-to-be-drawn of the graphics-to-be-drawn (303), (III) scanning means (200) for successively scanning the graphics to be processed in scanning lines (302) based on the stored coordinate data read out from the storage means (103, 104), (IV) coordinate calculation means (1061, 1062) for calculating the coordinates of the intersection points (304, 306) of the scanning lines (302) with the graphics-to-be-drawn (303) and the coordinates of the intersection points (305, 307) of the scanning lines (302) with the graphics-to-be-clipped (301), (V) rearrangement means (205) for adding attribute data to be calculated coordinates of the intersection points (304-307), the attribute data indicating to which graphic the coordinates belong, to obtain attribute-added intersection-point coordinate data (224), (VI) area-to-be-drawn decision means (209) for deciding an overlapping area (AND area) or a common area (OR area) of the graphics (303, 301) on the basis of the attribute-added intersection-point coordinate data (224), and (VII) graphic drawing means (108) for drawing the decided overlapping area (AND area) or common area (OR area) of the graphics (303, 301) (Figs. 2, 3). The device according to claim 3, wherein the data stored in the storage means (103, 104) are contour segment data (220, 221) of the graphics (303, 301). The device according to claim 3 and/or 4, wherein the rearrangement means (205) are designed to rearrange the coordinate values in the order of the scanning direction. The device according to one or a plurality of claims 3 to 5, wherein attribute decision means (206) are provided extracting the attribute-added intersection-point coordinate data (224) one by one from the rearrangement means (205) and providing an attribute decision signal (225) discriminating between the data of the graphics-to-be drawn (303) and the graphics-to-be-clipped (301), the attribute decision signal (225) being applied to region-to-be-drawn decision means (207) and to region-to-be-clipped decision means (208), the region-to-be-drawn decision means (207), which are activated when the attribute decision signal (225) indicates a graphic-to-be-drawn, deciding whether the coordinate points are a starting point or an ending point of the graphics-to-be-drawn (303) on the basis of the attribute decision signal (225) and the respective coordinate values, and the region-to-be-clipped decision means (208), which are activated when the attribute decision signal (225) indicates a graphic-to-be-drawn, deciding whether the coordinate points are a starting point or an ending point of the graphics-to-be-clipped (301) on the basis of the attribute decision signal (225) and the respective coordinate values, the signals (227, 228) of these means (207, 208) being applied to the area-to-be-drawn decision means (209). The device according to one or a plurality of claims 3 to 6, further comprising scanning region setting means (400) for setting the region of scanning to be carried out for the data relative to coordinates of the graphic-to-be-clipped and/or the graphic-to-be-drawn. The device according to one or a plurality of claims 3 to 7, wherein the coordinate calculation means (1061, 1062) in scanning the coordinate data, simultaneously calculate the coordinates of intersecting points (304-307) of the scanning line (302) with the graphics (303, 301). The device according to one or a plurality of claims 3 to 8, further comprising storage means (109) for temporarily storing the graphic data from the graphic drawing means (108). The device according to one or a plurality of claims 3 to 8, further comprising a graphic drawing device (110) for drawing the graphic data from the graphic drawing means (108) or the storage means (109).

Inventors: KAWABATA ATSUSHI, MIURA SHUUICHI, TAKI YUJI, YAMAASHI KIMIYA, KAWABATA, ATSUSHI, MIURA, SHUUICHI, TAKI, YUJI, YAMAASHI, KIMIYA
Applicants: HITACHI LTD, HITACHI, LTD.
Application year: 1990
Main classification: G09G5
IPC codes: G06T15, G06T11, G09G5