JPH03278190A - Polygon painting-out system - Google Patents

Polygon painting-out system

Info

Publication number
JPH03278190A
JPH03278190A JP2078081A JP7808190A JPH03278190A JP H03278190 A JPH03278190 A JP H03278190A JP 2078081 A JP2078081 A JP 2078081A JP 7808190 A JP7808190 A JP 7808190A JP H03278190 A JPH03278190 A JP H03278190A
Authority
JP
Japan
Prior art keywords
fill
polygon
value
coordinates
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2078081A
Other languages
Japanese (ja)
Other versions
JP2782904B2 (en
Inventor
Mitsuo Ouchi
大内 光郎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2078081A priority Critical patent/JP2782904B2/en
Publication of JPH03278190A publication Critical patent/JPH03278190A/en
Application granted granted Critical
Publication of JP2782904B2 publication Critical patent/JP2782904B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Landscapes

  • Image Generation (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

PURPOSE:To quickly paint out a polygon in the case of desired EO fill as well as NZ fill by taking trapezoid fill as a processing base and repeating a simple processing independently of the complexity of the original polygon. CONSTITUTION:The polygon painting-out system consists of a CPU 1, a main storage 2, a bit map memory 3, and a display controller 4. Data in a rectangular area, namely, a winding number (WN) value is read with one picture element as the unit, and binary output '0' is obtained when the WN value is '0', and binary output '1' is obtained when it is not '0', and data is written in a desired position on the bit map memory in accordance with the output value '1'/'0'. The operation is performed in the case of a non-zero winding number rule (NZ fill). In the case of an even/odd winding number rule (EO fill), '0' is outputted for the even WB and '1' is outputted for the odd WN at the time of binarizing the WN value. Thus, the polygon is quickly filled by both of rules of EO fill and NZ fill.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、ディスプレイやプリンタに文字や図形を表示
あるいは印字する際の図形描画における多角形塗りつぶ
し方式に関し、特に外形が線分で定義された多角形内を
塗りつぶす多角形塗りつぶし方式に関する。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a polygonal filling method for drawing figures when displaying or printing characters or figures on a display or a printer, and particularly relates to a polygon filling method for drawing figures when the outer shape is defined by line segments. This paper relates to a polygon filling method that fills in the inside of a polygon.

〔従来の技術〕[Conventional technology]

ディスプレイ上に図形・文字を表示する技術は、急速に
進歩しており、より美しい図形・文字を表示するなめに
様々な方式を提案されてきた。
The technology for displaying figures and characters on a display is rapidly progressing, and various methods have been proposed for displaying more beautiful figures and characters.

特に文字を表示する方式は、ビットマツプ・フォント方
式、アウトライン・フォント方式と呼ばれる方式が主流
である。
In particular, the mainstream methods for displaying characters are the bitmap font method and the outline font method.

ビットマツプ・フォント方式は、文字をm X nビッ
トのパターンとしてROMなどに格納しておき、画面の
1画素ごとに複数のビットを対応させたビットマツプ・
メモリの任意の位置にそのパターンをそのまま転送する
方式である。この方式は、どんな複雑な文字を表示する
場合でもmXnビットのデータを転送するたけで済むた
め、処理が単純で高速であり様々なディスプレイ装置で
主流となっている方式である。しかしながら、この方式
には文字を拡大あるいは縮小した時に次の様な欠点がで
でくる。拡大時には斜めの線にジャギーとよばれる階段
状のギザギザが生じ見栄えが良くない、縮小時には点や
線がぬけるため文字品質が悪くなるなどである。
The bitmap font method stores characters as m x n bit patterns in a ROM, etc., and creates a bitmap font in which multiple bits correspond to each pixel on the screen.
This method transfers the pattern as is to any location in memory. In this method, no matter how complex characters are displayed, only mXn bits of data need to be transferred, so the processing is simple and fast, and it is the method that has become the mainstream in various display devices. However, this method has the following drawbacks when enlarging or reducing characters. When enlarged, diagonal lines have a step-like jagged appearance called jaggies, which does not look good, and when reduced, dots and lines disappear, resulting in poor character quality.

そこで文字を拡大・縮小しても品質が劣化しないアウト
ライン・フォント方式がクローズアップされている。こ
の方式を説明すると、文字情報として文字の外形(アウ
トライン)を定義する線分の頂点の座標をフォントとし
て持たせておき、文字を表示する際にはこれらの頂点間
を直線あるいは曲線で描画し、続いてこの図形内を塗り
つぶす。このようにして生成される文字は、拡大・縮小
するときに、座標値を変換すればよく、その後は上述し
た塗りつぶしを行えば良い。このようにすると、与えら
れる頂点と頂点の間は直線あるいは曲線で補間されるの
でジャギーや線抜けがなくなり、拡大縮小率に関係なく
美しい字体をそのまま保つことができる。
Therefore, the outline font method, which does not degrade quality even when the characters are enlarged or reduced, is attracting attention. To explain this method, the font contains the coordinates of the vertices of line segments that define the outline of the character as character information, and when displaying the character, a straight line or curve is drawn between these vertices. , then fill in this shape. When enlarging or reducing characters generated in this manner, the coordinate values may be converted, and then the above-mentioned filling may be performed. In this way, the vertices between the given vertices are interpolated using straight lines or curved lines, eliminating jaggies and missing lines, and allowing beautiful fonts to be maintained regardless of the scaling ratio.

アウトライン・フォントの実際の描画方法について説明
する。まず、フォントROMに格納された文字の外形を
定義する線分の両端点のXY座標を読出し、拡大縮小率
に応して座標変換を行う。
We will explain how to actually draw outline fonts. First, the XY coordinates of both end points of a line segment defining the outer shape of a character stored in the font ROM are read out, and coordinate conversion is performed in accordance with the scaling ratio.

この座標変換は、一般によく知られているアフィン変換
と呼ばれる3×3の行列演算であり、変換後の座標値を
もとに、文字の外形内を塗りつぶすものである。この方
法には2種類あり、EVEN/○DD  WINDIN
G  NUMBERルールによる塗りつぶしく以下EO
フィルと呼ぶ)とN0N−ZEROWIND、ING 
 NUMBERルール(以下NZファイルと呼ぶ)であ
る。
This coordinate transformation is a generally well-known 3×3 matrix operation called affine transformation, and is used to fill in the outer shape of a character based on the coordinate values after the transformation. There are two types of this method: EVEN/○DD WINDIN
Fill in the following EO according to G NUMBER rules
Phil) and N0N-ZEROWIND, ING
This is the NUMBER rule (hereinafter referred to as NZ file).

WINDING  NUMBER(以下WNという)と
は、第5図(A)に示すように、多角形を構成する線分
を左から検査し、交差した線分が下向きであれば、その
線分の右側の領域のWNを+1し、上向きであれは−1
してえちれる数値である。このWNをベースにして、ど
の部分を塗りつぶすかを決定する方法に2種類あり、こ
れがEOファルとNZフィルである。EOフィルは、第
5図(B)に示すようにWNが奇数の部分だけを塗りつ
ぶすもので、NZフィルは、第5図(C)に示すように
WNが0でない部分を塗りつぶすものである。したがっ
て、同じ多角形でも塗りつぶす規則により結果が異なる
WINDING NUMBER (hereinafter referred to as WN) is, as shown in Figure 5 (A), the line segments that make up the polygon are inspected from the left, and if the intersecting line segments are pointing downward, the right side of the line segment is Add 1 to the WN of the area, -1 if it is upward.
This is an impressive number. There are two methods for determining which part to fill in based on this WN, and these are EO fill and NZ fill. The EO fill fills in only the portions where the WN is an odd number, as shown in FIG. 5(B), and the NZ fill fills in the portions where the WN is not 0, as shown in FIG. 5(C). Therefore, even if the polygon is the same, the results will vary depending on the filling rule.

EOフィルについては、台形フィルを描画するハードウ
ェアを用いて多角形内を塗りつぶす方式が知られている
。まず、台形の4頂点をどう選ぶかについて述べる。こ
の4頂点のうち、2点は多角形を構成する線分の両端点
であり、他の2点は全頂点のX座標のうちの最小値X□
1nによって決定する点である。つまり、台形は文字外
形のある線分の両端点の座標を(χ1.Y1)、(X2
゜Y2)としたときに、この線分を右辺とし、左辺が(
XmIn、Y1)、(X、、、1.、Y2)の線分とし
て与えられるものである。この台形を“0′クリアされ
たビットマツプ・メモリ上へ描画する。
Regarding the EO fill, a method is known in which the inside of a polygon is filled using hardware that draws a trapezoidal fill. First, we will discuss how to select the four vertices of the trapezoid. Two of these four vertices are the end points of the line segments that make up the polygon, and the other two points are the minimum value X□ of the X coordinates of all vertices.
This is the point determined by 1n. In other words, for a trapezoid, the coordinates of both end points of a line segment with a character outline are (χ1.Y1), (X2
゜Y2), this line segment is the right side, and the left side is (
It is given as a line segment of XmIn, Y1) and (X, , 1., Y2). This trapezoid is drawn on the bitmap memory cleared to "0".

ビットマツプ・メモリ上へ書込む際のデータ処理として
、書込むビット位置のデータをリードし、そのデータと
′1″を排他的ORしてからメモリ上に書込むようにす
る。こうして全ての線分について台形描画を行うと所望
のアウトライン文字の内側だけが1゛となる。これは、
排他的ORで描画するために、ビットマツプ・メモリ上
の左から右へむかって、奇数番目に交差した点からつぎ
の点までが“1″となり、偶数番口に交差した点から次
の点までは0“どなるからである。
Data processing when writing to the bitmap memory involves reading the data at the bit position to be written, exclusive ORing that data with '1', and then writing to the memory.In this way, all line segments If you draw a trapezoid for , only the inside of the desired outline character will be 1゛.This means that
In order to draw with exclusive OR, from left to right on the bitmap memory, from the odd numbered point to the next point is "1", and from the even numbered point to the next point This is because 0 is a roar.

このようにE○フィルによる多角形内塗りつぶしは、台
形フィルを高速に描画できるハードウェアを利用して、
高速にアウトライン文字を描画することができる。
In this way, filling the inside of a polygon with E○ fill uses hardware that can draw trapezoidal fill at high speed.
You can draw outline characters at high speed.

一方、NZフィルを実現する方法としては、多角形の上
から1ラインずつ検査し、1ライン上に存在する線分と
の交点を算出しながら、どの範囲が塗りつぶすべき領域
であるかを判定し描画する方法が使用されている。この
方法は、NZフィルはもちろん、処理の一部を変更する
だけでEOフィルにも適用できるのて、広く使用されて
いる。
On the other hand, a method to implement NZ fill is to inspect each line from the top of the polygon, calculate the intersections with line segments existing on one line, and determine which area should be filled. The method of drawing is used. This method is widely used because it can be applied not only to NZ fills but also to EO fills by simply changing a part of the processing.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

しかし、従来の台形フィルによる方法は、EOフィルに
関しては高速に処理できたが、NZフィルに関しては使
用できなかった。一方、1ライン単位に領域を判定する
方法は、1ライン上に存在する交点の数が多くなると各
交点の座標を計算する時間、交点のソーティング時間が
膨大になり処理が低速であるという欠点をもっていた。
However, although the conventional trapezoidal fill method could process EO fills at high speed, it could not be used for NZ fills. On the other hand, the method of determining the area on a line-by-line basis has the drawback that when the number of intersections existing on one line increases, the time required to calculate the coordinates of each intersection and the time required to sort the intersections becomes enormous, resulting in slow processing speed. there was.

EOフィルに関しては、前述した台形フィルによる方法
の方が一般に十倍高速である。
Regarding EO fills, the trapezoidal fill method described above is generally ten times faster.

本発明の目的は、このような問題を解決し、多角形塗り
つぶしを2段階の処理に分けることによってE○フィル
、NZフィルのいずれの方法に対しても使用できると共
に、高速に塗りつぶしができる多角形塗りつぶし方式を
提供することにある。
The purpose of the present invention is to solve these problems and to divide polygon filling into two-stage processing, so that it can be used for both the E○ fill and NZ fill methods, and it is also possible to fill in polygons at high speed. The purpose is to provide a square filling method.

〔課題を解決するための手段〕[Means to solve the problem]

本発明の構成は、ディスプレイやプリンタに文字や図形
を表示あるいは印字するために画素ごとに対応したメモ
リを備え、このメモリ上に座標系を定義し、多角形の頂
点群の座標を入力として多角形の内部に位置する前記メ
モリ上のビットを塗りつぶす多角形塗りつぶし方式にお
いて、前記頂点群の座標値から予め定めた方法て基準点
の座標値Xをもとめる第1の工程と、前記頂点群のうち
の頂点Aからつぎの頂点Bへの移動方向をもとめる第2
の工程と、前記頂点Aの座標(Xl。
The configuration of the present invention includes a memory corresponding to each pixel in order to display or print characters and figures on a display or printer, a coordinate system is defined on this memory, and the coordinates of a group of vertices of a polygon are input. In the polygon filling method of filling in bits on the memory located inside the rectangle, a first step of determining the coordinate value X of a reference point from the coordinate values of the group of vertices by a predetermined method; The second step is to find the direction of movement from vertex A to the next vertex B.
and the coordinates of the vertex A (Xl.

Y1)と前記頂点Bの座標(X2、Y2)と、前記座標
値Xを参照した座標(X、Y1)と座標(X、Y2)で
決定される台形内を塗りつぶす第3の工程と、この第3
の工程において前記台形内を塗りつぶす際に、前記移動
方向により前記メモリに書かれている内容をリード/モ
ディファイ/ライトする演算モードを少なくとも複数の
算術演算の中から選択する第4の工程と、前記第1から
第4の工程によって前記全頂点に関する台形塗りつぶし
処理を終了した後、前記多角形に外接する長方形内のデ
ータを検査して、特定の基準でデータを変更して別の領
域に書込む第5の工程とを備えることを特徴とする。
Y1), the coordinates (X2, Y2) of the vertex B, the coordinates (X, Y1) and the coordinates (X, Y2) with reference to the coordinate value Third
a fourth step of selecting, from at least a plurality of arithmetic operations, an operation mode for reading/modifying/writing the contents written in the memory according to the movement direction when filling the inside of the trapezoid in the step; After completing the trapezoid filling process for all the vertices in the first to fourth steps, the data within the rectangle circumscribing the polygon is inspected, the data is changed based on specific criteria, and the data is written in another area. The method is characterized by comprising a fifth step.

〔実施例〕〔Example〕

次に本発明について図面を参照して説明する。 Next, the present invention will be explained with reference to the drawings.

第1図は本発明の第1の実施例を説明するフローチャー
ト、第2図は第1図を実現するシステムのハードウェア
構成図である。本実施例は、ソフトウェア手段によって
多角形塗りつぶしを行う場合について述べる。第2図に
おいて、1はCPU、2は主記憶、3はビットマツプ・
メモ9 す、4は表示コントローラである。
FIG. 1 is a flowchart explaining a first embodiment of the present invention, and FIG. 2 is a hardware configuration diagram of a system that implements FIG. In this embodiment, a case will be described in which polygon filling is performed by software means. In Figure 2, 1 is the CPU, 2 is the main memory, and 3 is the bitmap.
Memo 9 4 is the display controller.

まず、本実施例の処理の流れについて説明する。NZフ
ィル、E○フィルいずれもワークメモリを使用し、これ
を主記憶2上の一部にマツピングする。CPUIはこの
ワークメモリ上でWNを計算しなから図形の元情報を生
成していく。主記憶2には、ワークメモリだけでなくc
pulが処理を実行するためのプログラムやデータが格
納される。このあと、CPUIはこのWN情報をベース
に、ビットマツプ・メモリ3上に最終図形を描画するの
である。ワークメモリは、WN値を格納するために使用
するので、WN値の最大値、最小値をあらかしめ想定し
て1画素に相当するビット数を決定しておく。本実施例
では、1ラスク上に14本以下の線分しか存在しないと
いう前提のもとで、WNは4ビツトで表現し、つまりW
Nの取り得る値の範囲は、−7≦WN≦7である。ビッ
トマツプ・メモリ3に描画された内容は表示コントロー
ラ4を介してディスプレイに表示される。
First, the flow of processing in this embodiment will be explained. Both the NZ fill and the E○ fill use a work memory and map this to a part of the main memory 2. The CPU calculates WN on this work memory and then generates the original information of the figure. Main memory 2 includes not only work memory but also c
Programs and data for pul to execute processing are stored. Thereafter, the CPU draws the final figure on the bitmap memory 3 based on this WN information. Since the work memory is used to store WN values, the number of bits corresponding to one pixel is determined in advance by assuming the maximum and minimum values of the WN values. In this example, WN is expressed in 4 bits on the premise that there are only 14 or less line segments on one rask, that is, W
The range of possible values of N is -7≦WN≦7. The contents drawn in the bitmap memory 3 are displayed on the display via the display controller 4.

 0 次に、第1図を用いて多角形塗りつぶしの方式いついて
詳細に説明する。まず、ステップ101〜103のルー
プにおいて、ステップ101で゛多角形を形成する線分
の端点の座標(X、Y)をすべてリードし、ステップ1
02において最大値X maX + Ymax +最小
値Xm1n+Ymlnを検出する。全座標についてこの
処理を終了後、ここで求めた最大、最小値は使用するワ
ークメモリの大きさを決定するために用い、(Xm1n
、Y、、、In)と(XmaXY、naX)を対角線の
端点とする長方形内を処理の対象とする。この領域はW
N値の格納用として使用するのて、初期設定としてステ
ップ104においてこの領域内のデータを“0″クリア
しておく。
0 Next, the polygon filling method will be explained in detail using FIG. First, in the loop of steps 101 to 103, in step 101, all the coordinates (X, Y) of the end points of the line segments forming the polygon are read, and in step 1
02, maximum value X maX + Ymax + minimum value Xm1n+Ymln is detected. After completing this process for all coordinates, the maximum and minimum values obtained here are used to determine the size of the work memory to be used, and (Xm1n
, Y, , In) and (XmaXY, naX) as the end points of the diagonal line are the objects of processing. This area is W
Since this area is used to store the N value, the data in this area is cleared to "0" in step 104 as an initial setting.

次に、ステップ105において多角形上の連続する2点
の座標値をリードする。台形はこの2点ノJu標値(X
 1 、 Y 1 )、(X2、Y2)を右辺、(X、
、、In、Y1)、(X、In、Y2)を左辺として決
定される。つまり、この台形の上底と下底はX軸に平行
である。台形フィルの演算モードは、ステップ106に
おいて2点の座標のY座標により決定する。つまり、Y
lとY2を比較し、Yl>Y2てあれば” + ’I 
”モード、Y1≦Y2であれば゛−1°″モードとする
Next, in step 105, the coordinate values of two consecutive points on the polygon are read. The trapezoid is the Ju target value (X
1 , Y 1 ), (X2, Y2) on the right side, (X,
, In, Y1) and (X, In, Y2) are determined as the left side. That is, the upper and lower bases of this trapezoid are parallel to the X axis. The calculation mode of the trapezoidal fill is determined in step 106 based on the Y coordinates of the two points. In other words, Y
Compare l and Y2, and if Yl>Y2, " + 'I
If Y1≦Y2, the mode is set to “−1°” mode.

ここまでが台形フィルの前処理であり、以降台形フィル
の実際の動作となる。
The steps up to this point are the pre-processing of the trapezoidal fill, and the actual operation of the trapezoidal fill follows.

台形フィルは、ステップ107〜1]1のループで構成
され、1ラインごとの描画を繰り返すことによって実現
する。あるラインの処理に入る際には、ステップ107
において右辺を直線発生により座標を生成し、1ライン
上の処理データの範囲を決定する。このライン」−のデ
ータをステップ108によって、1画素ずつリードし、
前述した演算モードにしたがってその画素値に+1ある
いは−1したあと、同じ番地にリライトする(ステップ
109)。この処理を1ライン上の全画素について実行
する。さらに、この処理を全ラインに繰り返すと1つの
台形フィルの処理が完了する。
The trapezoidal fill is composed of a loop of steps 107 to 1]1, and is realized by repeating drawing for each line. When starting processing a certain line, step 107
, coordinates are generated by generating a straight line on the right side, and the range of processing data on one line is determined. The data on this line is read pixel by pixel in step 108,
After the pixel value is incremented by +1 or -1 according to the calculation mode described above, it is rewritten to the same address (step 109). This process is executed for all pixels on one line. Furthermore, if this process is repeated for all lines, the process for one trapezoidal fill is completed.

引続いて、ステップ112において全ての頂点について
の台形フィル処理が終了したかどうかをチエツクし、終
了していない場合には、つぎの頂点についての処理を繰
り返し実行する。全頂点について終了すると、その多角
形内のWN値が全て決定される。
Subsequently, in step 112, it is checked whether the trapezoid fill processing for all vertices has been completed, and if not, the processing for the next vertex is repeatedly executed. Once all vertices are completed, all WN values within the polygon have been determined.

次に、実際にビットマツプ・メモリ3への書込みになる
。NZフィルかEOフィルかによって処理が異なるのは
この部分である。この処理は基本的には、多値のWN値
から110の2値の値を生成することである。
Next, the actual writing to the bitmap memory 3 begins. It is in this part that the processing differs depending on whether it is an NZ fill or an EO fill. This process basically involves generating 110 binary values from multivalued WN values.

まず、NZフィルについて説明する。ワークメモリ上の
(Xm+n 、 Ymln )と(x、、、、、、y−
、りを対角線の端点とする長方形は処理の対象となる多
角形に外接する領域である。この領域内について処理を
進める。ステップ113において、この矩形領域内のデ
ータつまりWN値を1画素分づつリードし、ステップ1
15においてWN値が′“O″であれば“O”、WN値
が” o ”以外であれば′1“°とし2値の出力を得
る。この出力値の110の従って、データをビットマツ
プ・メモリ上の所望の位置に書込む。本実施例では、こ
の出 3 カイ直が“1′″であれば゛、ステップ116において
、相当するビットを′1′″て描画し、出力値が“′0
″であれば描画しないで、ステップ117にジャンプす
るようにしている。これを矩形領域内の全WN値につい
て実行すると処理が完了する。
First, the NZ fill will be explained. (Xm+n, Ymln) and (x, , , , y-
A rectangle whose diagonal end points are , and ri is an area circumscribing the polygon to be processed. Proceed with the processing within this area. In step 113, the data in this rectangular area, that is, the WN value, is read one pixel at a time, and in step 1
In step 15, if the WN value is ``O'', it is set to ``O'', and if the WN value is other than ``o'', it is set to ``1'' and a binary output is obtained. In this embodiment, if the output value is "1", the corresponding bit is written as "1" in step 116, and the output value becomes "1". '0
'', the process jumps to step 117 without drawing. When this is executed for all WN values within the rectangular area, the process is completed.

これはNZフィルの場合である。EOフィルの場合はW
N値を2値化する際に、ステップ115の代りにステッ
プ14を実行し、WNが偶数であれば’o”、奇数であ
れば′1°°を出力するように変更されるだけである。
This is the case for the NZ Phil. W for EO fill
When binarizing the N value, step 14 is executed instead of step 115, and the only change is to output 'o' if WN is an even number and '1°° if it is an odd number. .

以上によって、E○フィル、NZフィルの両方の規則に
よる多角形フィルを実行できる。この場合、どんな多角
形を塗りつぶす際にも、上述したフローと全く同様に処
理することができる。
As described above, polygon fill can be performed using both the E○ fill and NZ fill rules. In this case, any polygon can be filled in in exactly the same way as the flow described above.

本発明においては、第1の処理で、従来の台形フィルを
行う際に、ビットマツプ・メモリへの書込みの段階で論
理演算だけでなく算術演算をサポートし、台形の左右直
線の方向によりその算術演算の種類を変更し、第2の処
理として、第1の処理を多角形の全ての線分に対して実
行した後 4 に、メモリに格納されているWN値を全て検査しフィル
の種類に応してそのWNに対応するビットマツプ・メモ
リ上に描画するか否かを判定するという新しい処理を導
入することにより、E○フィル、NZフィルいずれの方
法による多角形内塗りつぶしをも実現できるようにして
いる。
In the present invention, in the first process, when performing a conventional trapezoidal fill, not only logical operations but also arithmetic operations are supported at the stage of writing to the bitmap memory, and the arithmetic operations are performed depending on the direction of the left and right straight lines of the trapezoid. As a second process, after performing the first process on all line segments of the polygon, all WN values stored in memory are inspected and the process is performed according to the type of fill. By introducing a new process that determines whether or not to draw on the bitmap memory corresponding to the WN, it is possible to fill the inside of a polygon using either the E○ fill method or the NZ fill method. There is.

第3図は本発明の第2の実施例を実施するハードウェア
のブロック図、第4図は第3図の台形フィル・プロセッ
サのブロック図であり、本実施例は第1の実施例の一部
をハードウェア化し、高速化した多角形塗りつぶし装置
であり、処理のながれは第1図に示したフローチャート
と同しである。本実施例は、第1の実施例に第2図に台
形フィル・プロセッサ5が付加されたものである。
FIG. 3 is a block diagram of hardware implementing the second embodiment of the present invention, and FIG. 4 is a block diagram of the trapezoidal fill processor of FIG. 3. This embodiment is an example of the first embodiment. This is a polygon filling device which is made faster by converting the section into hardware, and the flow of processing is the same as the flowchart shown in FIG. In this embodiment, the trapezoidal fill processor 5 shown in FIG. 2 is added to the first embodiment.

ビットマツプ・メモリ3は、台形フィル・プロセッサ5
のワークエリアとしても使用され、またCPUIがビッ
トマツプ・メモリ3を直接アクセスできるようなバスを
用意している。これは、台形フィル・プロセッサ5がア
クセスするメモリをCPU1のバスと切り離すことによ
って高速化を図る目的がある。したかって、第1の実施
例との相違点は、ワークメモリをビットマツプ・メモリ
3にマツピングしたこと、フローの一部を台形フィル・
プロセッサ5に実行させたことだけである。ここでは台
形フィル・プロセッサ5の動作を中心に説明する。
The bitmap memory 3 has a trapezoidal fill processor 5.
The bitmap memory 3 is also used as a work area, and a bus is provided so that the CPU can directly access the bitmap memory 3. The purpose of this is to increase the speed by separating the memory accessed by the trapezoidal fill processor 5 from the bus of the CPU 1. Therefore, the difference from the first embodiment is that the work memory is mapped to the bitmap memory 3, and a part of the flow is mapped to the bitmap memory 3.
It is just what the processor 5 was made to execute. Here, the operation of the trapezoidal fill processor 5 will be mainly explained.

台形フィル・プロセッサ5が処理する内容は、第1図の
フローチャー1〜のステップ107〜]11の部分てあ
り、この部分をハードウェア化するために第4図の構成
をとった。台形フィル プロセッサの設計のポイントは
、1ライン上の複数の画素に対する処理をワード単位に
一括して実行するようにしている。本実施例では、1ワ
ード16ビツトとし、4画素分のデータを一括して演算
する演算回路などを備えた。
The contents processed by the trapezoidal fill processor 5 are the steps 107 to 11 of the flowchart 1 to 1 in FIG. 1, and the configuration shown in FIG. 4 is adopted to implement this part in hardware. The key point in the design of the trapezoidal fill processor is to execute processing for multiple pixels on one line in units of words at once. In this embodiment, each word is 16 bits, and includes an arithmetic circuit that collectively calculates data for four pixels.

第4図において、10はリードデータ レジスタ、11
はライトデータ・レジスタ、12〜15は演算回路、1
6はアドレス発生回路、17はDDA発生回路、18は
ピクセル・カウンタ、19は加算値生成回路、20はエ
ンドフラグである。
In FIG. 4, 10 is a read data register, 11
is a write data register, 12 to 15 are arithmetic circuits, 1
6 is an address generation circuit, 17 is a DDA generation circuit, 18 is a pixel counter, 19 is an addition value generation circuit, and 20 is an end flag.

ステップ107は、DDA生成回路17により行われ、
この結果、1ライン上の描画すべきピクセル数が決定さ
れる。つづくステップ108109を1ワ一ド単位で処
理するようにしている。これは、ビットマツプ・メモリ
3がらリードした1ワードのデータをリードデータ・レ
ジスタ10に格納し、そのデータに対して演算回路12
〜15を同時に動作させる。1ワードは16ビツトなの
で、各演算回路にはWN値のビット数に相当する4ビツ
トずつデータが入力される。リードデータ・レジスタ1
oの内容と共に演算回路12〜15に入力されるのが加
算値である。この加算値は、加算値生成回路19で生成
され、各演算回路ごとに独立した値を出力する。この加
算値の生成条件は、まず、ステップ106で決定された
演算モードが” + 1 ”モードの場合“1″、演算
モードが−1″の場合パ−1°”、さらに、ピクセル・
カウンタ18から出力されるエンド・フラグ 7 20がアクティブのときには演算モードによらず0″′
になる。このエンド フラグ20は1ラインの最終ワー
ドに含まれる複数の画素のうち、演算の対象にならない
画素に対してアクティブになる。こうして演算回路12
〜15て演算された個々のデータは、再び1ワードにパ
ックされてライトデータ・レジスタ11に格納され、ビ
ットマツプ・メモリ3にリライトされる。
Step 107 is performed by the DDA generation circuit 17,
As a result, the number of pixels to be drawn on one line is determined. The following step 108109 is processed in units of one word. This stores one word of data read from the bitmap memory 3 in the read data register 10, and then sends the data to the arithmetic circuit 12.
- 15 are operated at the same time. Since one word is 16 bits, each arithmetic circuit receives 4 bits of data corresponding to the number of bits of the WN value. Read data register 1
The addition value is input to the calculation circuits 12 to 15 together with the contents of o. This added value is generated by the added value generation circuit 19, which outputs an independent value for each arithmetic circuit. The conditions for generating this addition value are: "1" if the calculation mode determined in step 106 is "+1" mode, "par-1°" if the calculation mode is -1", and
When the end flag 7 20 output from the counter 18 is active, it is 0'' regardless of the calculation mode.
become. This end flag 20 becomes active for pixels that are not subject to calculation among a plurality of pixels included in the final word of one line. In this way, the arithmetic circuit 12
The individual data calculated in steps 1 to 15 are packed into one word again, stored in the write data register 11, and rewritten in the bitmap memory 3.

ステップ1.10はピクセル・カウンタ18で処理され
る。つまり、DDA発生回路17で決定された1ライン
上のピクセル数を初期値として1ワ一ド分処理が終了す
るごとに、このピクセル・カウンタ18の内容を4ずつ
減算する。この結果が負になれば1ラインの処理が終了
する。ステップ111はアドレス発生回路16で行われ
、アドレス発生回路16には座標Y1からY2を減算し
た値が格納されており、この回数すなわちライン数分ア
ドレスを発生すると処理を終了するようになっている。
Step 1.10 is processed in pixel counter 18. That is, the contents of the pixel counter 18 are decremented by 4 each time the processing for one word is completed using the number of pixels on one line determined by the DDA generation circuit 17 as an initial value. If this result becomes negative, the processing of one line ends. Step 111 is performed by the address generation circuit 16, and the address generation circuit 16 stores the value obtained by subtracting Y2 from the coordinates Y1, and the process ends when addresses are generated this number of times, that is, the number of lines. .

なお、本実施例てはWN値を4ビツトとじた 8 が、この数値に制限されるものではない。またWN値を
もとにしたビットマツプ・メモリへの書込みに関して、
データを書込むか否かを区別することにしたが、WN値
の判定をもとに、カラーや演算モードを選択するように
構成することも容易に実現できる。さらに、描画する際
に任意形状のクリッピング領域を定義しておき、その領
域内だけが描画できる範囲とした装置においても、クリ
ッピング領域をあらかじめ本方式で生成し、実際の多角
形をWN値をもとにビットマツプ・メモリへ書込む際に
、クリッピング領域をマスクとして扱った3オペランド
演算を応用して実現することも考えられる。要するに、
本発明は、多角形の内側か外側かをE○ルール、NZル
ールいずれの規則によってもほとんど同一の処理で判定
できるような方式であって、その後の描画形態などの付
帯的な事項に制限されるものでない。
In this embodiment, the WN value is 8, which is 4 bits, but the value is not limited to this value. Regarding writing to bitmap memory based on WN value,
Although a distinction has been made between whether or not to write data, it is also possible to easily implement a configuration in which the color or calculation mode is selected based on the determination of the WN value. Furthermore, even in devices where a clipping area of an arbitrary shape is defined when drawing, and only the area within that area can be drawn, the clipping area can be generated in advance using this method, and the actual polygon can be shaped using the WN value. It is also conceivable to realize this by applying a three-operand operation that treats the clipping area as a mask when writing to the bitmap memory. in short,
The present invention is a method that can determine whether a polygon is inside or outside using almost the same process using either the E○ rule or the NZ rule, and is limited to incidental matters such as the subsequent drawing form. It's not something you can do.

〔発明の効果〕〔Effect of the invention〕

以上述べたように、本発明によれば、台形フィルを処理
の基本としており、もとの多角形の複雑さに依存せず単
純な処理を繰り返して実行することにより、所望のEO
フィル、NZフィルのいずれの多角形塗りつぶしをも高
速に実行てきるといプ効果がある。
As described above, according to the present invention, the trapezoidal fill is the basis of processing, and by repeatedly performing simple processing without depending on the complexity of the original polygon, the desired EO
It has the effect of being able to perform polygon filling at high speed for both fill and NZ fill.

【図面の簡単な説明】[Brief explanation of drawings]

第1図は本発明の第1の実施例を説明するフローチャー
ト、第2図は第1図を実施するハードウェアのフロック
図、第3図は本発明の第2の実施例を説明するハードウ
ェアのブロック図、第4図は第3図の台形フィル・プロ
セッサのブロック図、第5図(A)〜(C)は多角形塗
りつぶしの説明図である。 1・・・CPU、2・・・主記憶、3・・・ビットマツ
プ・メモリ、4・・・表示コントローラ、5・・・台形
フィル・コントローラ、10・・・リードデータ・レジ
スタ、11・・・ライトデータ・レジスタ、12〜゛1
5・・・演算回路、16・・・アドレス生成回路、17
・・・DDA生成回路、18・・・ピクセル・カウンタ
、19・・・加算生成回路、20・・・エンド・フラグ
、01〜1 7・・・処理ステップ。  1−
FIG. 1 is a flowchart explaining a first embodiment of the present invention, FIG. 2 is a block diagram of hardware for implementing FIG. 1, and FIG. 3 is a hardware block diagram for explaining a second embodiment of the present invention. 4 is a block diagram of the trapezoidal fill processor of FIG. 3, and FIGS. 5(A) to 5(C) are explanatory diagrams of polygon filling. DESCRIPTION OF SYMBOLS 1... CPU, 2... Main memory, 3... Bitmap memory, 4... Display controller, 5... Trapezoidal fill controller, 10... Read data register, 11... Write data register, 12-1
5... Arithmetic circuit, 16... Address generation circuit, 17
...DDA generation circuit, 18...Pixel counter, 19...Addition generation circuit, 20...End flag, 01-17...Processing step. 1-

Claims (1)

【特許請求の範囲】[Claims] ディスプレイやプリンタに文字や図形を表示あるいは印
字するために画素ごとに対応したメモリを備え、このメ
モリ上に座標系を定義し、多角形の頂点群の座標を入力
として多角形の内部に位置する前記メモリ上のビットを
塗りつぶす多角形塗りつぶし方式において、前記頂点群
の座標値から予め定めた方法で基準点の座標値Xをもと
める第1の工程と、前記頂点群のうちの頂点Aからつぎ
の頂点Bへの移動方向をもとめる第2の工程と、前記頂
点Aの座標(X1、Y1)と前記頂点Bの座標(X2、
Y2)と、前記座標値Xを参照した座標(X、Y1)と
座標(X、Y2)で決定される台形内を塗りつぶす第3
の工程と、この第3の工程において前記台形内を塗りつ
ぶす際に、前記移動方向により前記メモリに書かれてい
る内容をリード/モディファイ/ライトする演算モード
を少なくとも複数の算術演算の中から選択する第4の工
程と、前記第1から第4の工程によって前記全頂点に関
する台形塗りつぶし処理を終了した後、前記多角形に外
接する長方形内のデータを検査して、特定の基準でデー
タを変更して別の領域に書込む第5の工程とを備えるこ
とを特徴とする多角形塗りつぶし方式。
In order to display or print characters and figures on a display or printer, it has a memory corresponding to each pixel, defines a coordinate system on this memory, and uses the coordinates of the polygon's vertices as input to locate inside the polygon. In the polygon filling method of filling in the bits on the memory, a first step is to obtain the coordinate value X of the reference point from the coordinate value of the group of vertices using a predetermined method; A second step of determining the moving direction to the vertex B, and determining the coordinates of the vertex A (X1, Y1) and the coordinates of the vertex B (X2,
Y2), the third color that fills the inside of the trapezoid determined by the coordinates (X, Y1) and coordinates (X, Y2) with reference to the coordinate value X.
and in this third step, when filling the inside of the trapezoid, an operation mode for reading/modifying/writing the contents written in the memory according to the movement direction is selected from at least a plurality of arithmetic operations. After completing the trapezoid filling process for all the vertices through the fourth step and the first to fourth steps, the data within the rectangle circumscribing the polygon is inspected and the data is changed based on a specific standard. and a fifth step of writing in another area.
JP2078081A 1990-03-27 1990-03-27 Polygon fill method Expired - Lifetime JP2782904B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2078081A JP2782904B2 (en) 1990-03-27 1990-03-27 Polygon fill method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2078081A JP2782904B2 (en) 1990-03-27 1990-03-27 Polygon fill method

Publications (2)

Publication Number Publication Date
JPH03278190A true JPH03278190A (en) 1991-12-09
JP2782904B2 JP2782904B2 (en) 1998-08-06

Family

ID=13651896

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2078081A Expired - Lifetime JP2782904B2 (en) 1990-03-27 1990-03-27 Polygon fill method

Country Status (1)

Country Link
JP (1) JP2782904B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06162212A (en) * 1992-11-25 1994-06-10 Nec Corp Polygon painting-out device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06162212A (en) * 1992-11-25 1994-06-10 Nec Corp Polygon painting-out device

Also Published As

Publication number Publication date
JP2782904B2 (en) 1998-08-06

Similar Documents

Publication Publication Date Title
US5016001A (en) Pattern data generating system
JPS6158083A (en) Fast memory system, data processing method and memory segment
US5489920A (en) Method for determining the optimum angle for displaying a line on raster output devices
JPH0540463A (en) Multi-level character generator
US20150325022A1 (en) Technique for processing a character string for graphical representation on a man/machine interface
JPH01296389A (en) Method and device for processing graphic
US5519412A (en) Pattern processing method
EP0062669A1 (en) Graphic and textual image generator for a raster scan display.
JPH05120441A (en) Vector picture plotting device
KR100361387B1 (en) Polygon drawing method and polygon drawing apparatus
JPH0554149A (en) Edge list preparing device
JPH03278190A (en) Polygon painting-out system
JPH10247241A (en) Convolution scanning line rendering
JP3603593B2 (en) Image processing method and apparatus
JPS6339947B2 (en)
JP2806679B2 (en) Character generator
JP3129717B2 (en) Image processing apparatus and image processing method
JP2835056B2 (en) High quality character pattern generation method
JP3517982B2 (en) Drawing device
JP2836617B2 (en) Rendering processor
JPH02168361A (en) Pattern data preparing device to prepare coordinates data and processor
JPH0350686A (en) Graphic processing system
JPH0823741B2 (en) How to process vector characters or graphics
JP2000259845A (en) Method and device for plotting polygon
JPH0950272A (en) Method and device for outline font generation