JPH06150015A - Creation method for file polygon - Google Patents

Creation method for file polygon

Info

Publication number
JPH06150015A
JPH06150015A JP31602692A JP31602692A JPH06150015A JP H06150015 A JPH06150015 A JP H06150015A JP 31602692 A JP31602692 A JP 31602692A JP 31602692 A JP31602692 A JP 31602692A JP H06150015 A JPH06150015 A JP H06150015A
Authority
JP
Japan
Prior art keywords
polygon
painting
fill
data
line segment
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.)
Pending
Application number
JP31602692A
Other languages
Japanese (ja)
Inventor
Ryohei Sakaguchi
良平 坂口
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.)
Hewlett Packard Japan Inc
Original Assignee
Yokogawa Hewlett Packard Ltd
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 Yokogawa Hewlett Packard Ltd filed Critical Yokogawa Hewlett Packard Ltd
Priority to JP31602692A priority Critical patent/JPH06150015A/en
Publication of JPH06150015A publication Critical patent/JPH06150015A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Generation (AREA)

Abstract

PURPOSE:To enable high-speed painting-out (fill plotting) regardless of the shape of a polygon by creating fill plotting data inside a memory and exclusively ORing respective line segments concerning the respective fill plotting data. CONSTITUTION:A fill plot processing area including the polygon is decided, and the fill plotting data of an area held between the respective line segments constituting the polygon, two straight lines pulled out from both of terminals of the line segment in a specified direction and the outer edge of the processing area are created inside the memory. Then, the respective line segments are exclusively ORed concerning the respective fill plotting data. Namely, this processing is applied to a star-shaped polygon 2 (which apexes are shown by P1-P5) composed of a pentagon and five triangles and when creating a fill polygon 2', the fill polygon 2' is created by successively exclusively ORing fill plotting data 21-25 formed by respective line segments concerning the star- shaped polygon 2 created inside a fill plotting processing area 20.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、コンピュータ図形処理
におけるフィルポリゴン(塗りつぶしたポリゴン)の作
成方法に関し、ポリゴンの形状の如何によらず高速な塗
りつぶし(塗描)が可能なフィルポリゴンの作成方法に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for creating fill polygons (painted polygons) in computer graphic processing, and a method for creating fill polygons capable of high-speed painting (painting) regardless of the shape of the polygons. Regarding

【0002】[0002]

【技術背景】従来、任意形状のフィルポリゴンを作成す
る場合、水平方向にスキャンして塗描領域を求め、これ
を垂直方向に画素単位で順次ずらして、ポリゴン全体を
塗描する方法が採用されている。この方法では、描かれ
たポリゴンを、所定領域内で水平スキャンを画素単位で
垂直方向にずらして行い、スキャンラインをポリゴンと
交差させ、X座標が小さい方から数えて奇数番目の交差
点と偶数番目の交差点に存在する画素を、スキャンライ
ンに沿って塗描している。
2. Description of the Related Art Conventionally, when a fill polygon having an arbitrary shape is created, a method of scanning the horizontal direction to obtain a paint area and sequentially shifting the area in pixel units in the vertical direction to paint the entire polygon has been adopted. ing. In this method, the drawn polygon is horizontally scanned in a predetermined area in pixel units in the vertical direction, the scan line is intersected with the polygon, and the odd-numbered intersections and even-numbered intersections counting from the smallest X coordinate are counted. Pixels existing at the intersections are painted along the scan line.

【0003】例えば、図7に示すように、任意形状のポ
リゴン(同図では、Pn1〜Pn5の頂点を持つ、5つ
の三角形と1つの五角形とから成る星形ポリゴン6)
を、Y座標がYnである水平ラインによりスキャンする
と、スキャンラインLは星形ポリゴン6とPn1,Pn
2,Pn3,Pn4で交差するので、Pn1からPn
2、およびPn3からPn4までを塗描する。そして、
この水平ラインについてのスキャンを画素単位で垂直方
向にずらして行うことで、星形ポリゴン6を構成する3
角形の内部が塗描される。なお、図7では、上方から下
方にスキャンしつつYnの高さまで塗描されている状態
を示している。このような塗描方法は、各種のソフトウ
ェアに利用されており、ハードウェア化(グラフッィク
用のプロセッサに上記塗描機能を組み込むこと)も比較
的容易である。
For example, as shown in FIG. 7, a polygon having an arbitrary shape (in this figure, a star-shaped polygon 6 having five triangles and vertices Pn1 to Pn5 and one pentagon).
, Is scanned by a horizontal line whose Y coordinate is Yn, the scan line L becomes a star polygon 6 and Pn1, Pn.
Since it intersects at 2, Pn3, Pn4, Pn1 to Pn
2, and Pn3 to Pn4 are painted. And
The star-shaped polygons 6 are formed by shifting the scanning of this horizontal line in the vertical direction pixel by pixel.
The inside of the prism is painted. Note that FIG. 7 shows a state in which painting is performed up to the height of Yn while scanning from the upper side to the lower side. Such a painting method is used in various kinds of software, and it is relatively easy to implement it as hardware (incorporating the painting function into a graphics processor).

【0004】しかし、上記塗描方法は、次に述べるよう
な欠点を有している。 (1)スキャンラインLとポリゴン6との交点を記憶す
るメモリ領域(テーブル)が必要となる。このため、あ
るY座標のスキャンラインLと、これに交差するポリゴ
ン6を構成する線分(P1−P2,P4−P5,P2−
P3,P5−P1)との交点のX座標(Xn1,Xn
2,Xn3,Xn4)を求めてテーブルに登録しなくて
はならないため、テーブルの大きさによっては、扱える
ポリゴンの線の数に制限を設けざるを得ない。 (2)計算回数が多いため、前記ポリゴンを構成する各
線分と、前記線分の両端から特定方向に引き出した二直
線と、上記塗描処理領域の外縁と、に挟まれる領域の塗
描データをメモリ内に作成するスピードが遅い。すなわ
ち、あるY座標にポリゴン6を構成する線分が含まれて
いるか否かを判断する計算、交差点のX座標の計算、交
差点をX座標の小さい順または大きい順にソートする計
算等を、塗描処理領域内においてY方向に並んだ画素の
数と同回数行う必要がある。
However, the above painting method has the following drawbacks. (1) A memory area (table) for storing the intersection of the scan line L and the polygon 6 is required. Therefore, the scan line L of a certain Y coordinate and the line segments (P1-P2, P4-P5, P2-
X coordinate (Xn1, Xn) of the intersection with P3, P5-P1)
2, Xn3, Xn4) must be obtained and registered in the table. Therefore, the number of polygon lines that can be handled must be limited depending on the size of the table. (2) Since the number of calculations is large, the painting data of the area sandwiched between each line segment forming the polygon, two straight lines drawn from both ends of the line in a specific direction, and the outer edge of the painting processing area Is slow to create in memory. That is, the calculation for determining whether or not a certain Y coordinate includes a line segment forming the polygon 6, the calculation for the X coordinate of the intersection, the calculation for sorting the intersection in ascending or descending order of the X coordinate, etc. It is necessary to perform the same number of times as the number of pixels arranged in the Y direction in the processing area.

【0005】このような方法に対して、任意形状のポリ
ゴンを多数の三角形に分解し、各三角形の内部を塗描す
るといった方法も従来知られているが、この方法はアル
ゴリズムが複雑となる等ため、塗描プログラムにバグが
生じる可能性が多い。
In contrast to such a method, a method in which a polygon having an arbitrary shape is decomposed into a large number of triangles and the inside of each triangle is painted is known, but this method requires a complicated algorithm. Therefore, there is a possibility that a bug will occur in the painting program.

【0006】[0006]

【発明の目的】本発明は、ポリゴンの形状の如何によら
ず高速な塗りつぶし(塗描)が可能なフィルポリゴンの
作成方法を提供することを目的とする。
SUMMARY OF THE INVENTION It is an object of the present invention to provide a method for creating a fill polygon that enables high-speed painting (painting) regardless of the shape of the polygon.

【0007】[0007]

【発明の概要】上記の目的を達成するために、本発明の
フィルポリゴンの作成方法では、まず、第1のステップ
で、ポリゴンを含む塗描処理領域を定める。この塗描処
理領域の形状は、通常、画素の並び方向(一般には水
平,垂直方向)を辺の方向とする長方形(正方形を含
む)とするが、必ずしもこれに限らない。例えば、円形
であったとしても、フィルポリゴンの作成は可能であ
る。この塗描処理領域の位置や大きさは、ポリゴンの描
画の終了と同時に決定されることもあるし、例えば、予
め作成されたポリゴンの形状データがメモリ内に存在す
るような場合において該ポリゴンを塗描するようなとき
には、ポリゴンの指定により決定される。
SUMMARY OF THE INVENTION In order to achieve the above object, in a fill polygon creating method of the present invention, first, in a first step, a painting processing area including a polygon is defined. The shape of the painting processing area is usually a rectangle (including a square) whose side direction is the pixel arrangement direction (generally, the horizontal and vertical directions), but the shape is not necessarily limited to this. For example, even if the shape is circular, it is possible to create a fill polygon. The position and size of the painting processing area may be determined at the same time when the drawing of the polygon is completed. For example, when the shape data of the polygon created in advance exists in the memory, When painting, it is determined by designating a polygon.

【0008】第2のステップでは、前記ポリゴンを構成
する各線分と、該線分の両端から特定方向に引き出した
二直線と、上記処理領域の外縁とに挟まれる領域の塗描
データをメモリ内に作成する。
In the second step, the painting data of the area sandwiched by each line segment forming the polygon, two straight lines drawn from both ends of the polygon in a specific direction, and the outer edge of the processing area are stored in the memory. To create.

【0009】ここで、特定方向とは、処理のし易さか
ら、通常画素の並び方向(水平または垂直方向)が選ば
れる。塗描処理領域が、水平,垂直方向の辺を持つ長方
形である場合には、ポリゴンを構成する各線分と長方形
の一辺とが構成する領域(塗描領域)は、該線分を斜辺
とし、該線分の両端から水平に引き出された二直線を上
底,下底とする直角台形(一方の底角が直角である台
形)となる。なお、塗描処理領域の外縁が、ポリゴンを
構成する線分と接している場合には、塗描領域は、該線
分を斜辺とし該線分の一端から引き出された直線を底辺
とする直角三角形となる。台形の塗描領域は三角形と四
角形の組合せであることから、この場合には塗描領域
を、三角形と四角形のみで構成することができる。三角
形と四角形については、塗描専用のプロセッサも提供さ
れているので、より高速に塗描処理を行うこともでき
る。
Here, the specific direction is usually the direction in which the pixels are arranged (horizontal or vertical direction) for ease of processing. When the painting processing area is a rectangle having horizontal and vertical sides, the area (painting area) formed by each line segment forming a polygon and one side of the rectangle has the line segment as a hypotenuse, It becomes a right-angled trapezoid (a trapezoid in which one base angle is a right angle) with two straight lines drawn horizontally from both ends of the line segment as the upper base and the lower base. When the outer edge of the painting processing area is in contact with a line segment that constitutes a polygon, the painting area is a right angle with the line segment as a hypotenuse and a straight line drawn from one end of the line segment as the base. It becomes a triangle. Since the trapezoidal painted area is a combination of a triangle and a quadrangle, in this case, the painted area can be composed of only the triangle and the quadrangle. For triangles and quadrangles, a processor dedicated to painting is also provided, so that painting processing can be performed at higher speed.

【0010】第3のステップでは、前記各線分について
の各塗描データについて、排他的論理和を演算する。こ
の演算は、どの線分について先に塗描データを作成する
かは任意であり、例えば、ポリゴンが3つの線分A,
B,Cにより構成される場合、最初にCについて、次に
Bについての塗描データを作成し、これらの排他的論理
和をとってもよいし、最初にBについて、次にAについ
ての塗描データを作成し、これらの排他的論理和をとっ
てもよい。
In the third step, an exclusive OR is calculated for each drawing data for each line segment. In this calculation, it is arbitrary for which line segment the paint data is created first. For example, the line segment A having three polygons,
In the case of being composed of B and C, it is possible to first create the painting data for C and then for B, and take the exclusive OR of these, or the painting data for B first and then A. May be created and the exclusive OR of these may be taken.

【0011】ポリゴンは、直線により構成されるが、ス
プライン曲線等も微視的に見ると直線の集合とすること
ができる。したがって、本発明には、広く曲線により構
成された図形を含んでいる。また、ポリゴンは通常の四
角形、五角形等、それを構成する線分同士が交差してい
ない図形であってもよいし、数字の「8」のように線分
同士が交差する図形であってもよい。ポリゴンは、通常
は3以上の線分が必要とされるが、2つの線分により構
成される図形(L字形)も本発明のポリゴンに含まれ
る。この場合には、開いた線分の先端同士を結ぶ仮想線
を、ポリゴンを構成する線分とみなすことで本発明が適
用される。さらに、3以上の線分から構成されていて
も、完全には閉じていない図形(例えば、コ字形等)に
ついても、本発明は適用できる。このような、閉じてい
ない図形についても、何れの線分とも接続されていない
線分の先端同士を結ぶ仮想線を、ポリゴンを構成する線
分とみなすことで本発明が適用される。
The polygon is composed of straight lines, but a spline curve and the like can be made into a set of straight lines when viewed microscopically. Therefore, the present invention includes figures that are broadly constructed by curves. Further, the polygon may be a normal quadrangle, a pentagon, or a figure in which the line segments forming the polygon do not intersect, or may be a figure in which the line segments intersect, such as the numeral “8”. Good. Normally, three or more line segments are required for a polygon, but a figure (L-shaped) composed of two line segments is also included in the polygon of the present invention. In this case, the present invention is applied by considering the virtual line connecting the open ends of the line segments as the line segment forming the polygon. Furthermore, the present invention can be applied to a figure (for example, a U-shape, etc.) that is not completely closed even if it is composed of three or more line segments. The present invention is also applied to such an unclosed figure by regarding a virtual line that connects the tips of line segments that are not connected to any line segment as a line segment that constitutes a polygon.

【0011】本発明では、必要とするメモリ領域は作成
したいポリゴンのサイズに依存するが、扱えるポリゴン
の線分の数に制限はない。したがって、スプライン曲線
が複雑に入り組んだポリゴンの作成も容易にできる。ま
た、本発明では、スキャンラインとポリゴンを構成する
線分との交点を求める等の複雑な計算の必要はないの
で、高速なフィルポリゴンの作成がなされる。
In the present invention, the required memory area depends on the size of the polygon to be created, but the number of polygon line segments that can be handled is not limited. Therefore, it is possible to easily create a polygon having complicated spline curves. Further, according to the present invention, since it is not necessary to perform complicated calculation such as obtaining an intersection between a scan line and a line segment forming a polygon, a fill polygon can be created at high speed.

【0012】[0012]

【実施例】図1の流れ図、図3の塗描過程図により図2
に示すポリゴン1を塗描する場合を詳細に説明する。図
6に本発明のフィルポリゴンの作成方法の実施に使用す
るハードウェアの一例を示す。同図では、バス51には
CPU52、ROM53、RAM54、入力装置55、
出力装置56が接続された様子が示されている。CPU
52はROM53や図示しない補助記憶装置等からRA
M54に読み込まれたプログラムによって動作する。こ
のプログラムは、マウス,タブレット,キーボード等の
入力装置55からのデータを受け取ったり、計算を行っ
たりするほか、表示装置,プリンタ等の出力装置56に
データを転送したり、RAM54や前記補助記憶装置等
に計算結果の書き込みを行ったりする。本実施例では、
以下に述べる処理や判断は、CPU52がROM53ま
たはRAM54に書き込まれたプログラムにより行われ
る。また、ポリゴンの各頂点の座標は、予め入力されて
RAM54に記憶されているものとする。なお、以下に
述べるS1〜S6は図1に示すように、本発明における
処理の流れを示している。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The flow chart of FIG. 1 and the painting process chart of FIG.
The case of painting the polygon 1 shown in (3) will be described in detail. FIG. 6 shows an example of hardware used for implementing the fill polygon creating method of the present invention. In the figure, the bus 51 includes a CPU 52, a ROM 53, a RAM 54, an input device 55,
It is shown that the output device 56 is connected. CPU
Reference numeral 52 denotes RA from the ROM 53 or an auxiliary storage device (not shown).
It operates according to the program read in M54. This program receives data from an input device 55 such as a mouse, a tablet, a keyboard and performs calculations, transfers the data to an output device 56 such as a display device and a printer, RAM 54 and the auxiliary storage device. Write the calculation result to etc. In this embodiment,
The processes and judgments described below are performed by the program written in the ROM 53 or the RAM 54 by the CPU 52. Further, the coordinates of each vertex of the polygon are preliminarily input and stored in the RAM 54. Note that S1 to S6 described below show the flow of processing in the present invention, as shown in FIG.

【0013】(1)S1では、最初に塗描処理領域を定
める。この処理領域の決定は、上記RAM54に記憶さ
れているポリゴンの各頂点座標により決定することがで
きる。図2では、説明の便宜上、塗描処理領域10はポ
リゴン1のX,Y方向最大値よりやや大きく、X,Y方
向最小値よりもやや小さく設定してあるが、塗描処理領
域10の大きさを、X,Y方向最大値,最小値に合わせ
て定めることもできることは勿論である。なお、ここで
は塗描処理領域10のX,Y方向の最大値をそれぞれX
max,Ymaxとし、X,Y方向の最小値をそれぞれ
Xmin,Yminとしてある。
(1) In S1, the painting processing area is first determined. This processing area can be determined by the coordinates of each vertex of the polygon stored in the RAM 54. In FIG. 2, for convenience of description, the painting processing area 10 is set to be slightly larger than the maximum value in the X and Y directions of the polygon 1 and slightly smaller than the minimum value in the X and Y directions. It is needless to say that the height can be determined in accordance with the maximum and minimum values in the X and Y directions. Note that here, the maximum values in the X and Y directions of the painting processing area 10 are respectively set to X.
max and Ymax, and the minimum values in the X and Y directions are Xmin and Ymin, respectively.

【0014】(2)S2では「次に処理するべきベクタ
が存在するか」否かが判断され、該ベクタが存在すれ
ば、処理対象となっているベクタ〔(Xα,Yα),
(Xβ,Yβ)〕(α,β=1,2,・・・、α≠β)
についての処理が行われる。ここで、ベクタ〔(Xα,
Yα),(Xβ,Yβ)〕とは、塗描処理対象となる線
分を座標表示したものであり、本実施例では表1で表さ
れる。
(2) In S2, it is judged whether or not there is a vector to be processed next. If the vector exists, the vector to be processed [(Xα, Yα),
(Xβ, Yβ)] (α, β = 1, 2, ..., α ≠ β)
Is performed. Here, the vector [(Xα,
Y [alpha]), (X [beta], Y [beta])] is a coordinate display of a line segment to be painted, and is represented by Table 1 in this embodiment.

【0015】[0015]

【表1】 線 分 ベ ク タ P1−P2:〔(X1,Y1),(X2,Y2)〕 P2−P3:〔(X2,Y2),(X3,Y3)〕 ・ ・ ・ ・ ・ ・ P5−P1:〔(X5,Y5),(X1,Y1)〕[Table 1] Line segment vectors P1-P2: [(X1, Y1), (X2, Y2)] P2-P3: [(X2, Y2), (X3, Y3)] -P1: [(X5, Y5), (X1, Y1)]

【0016】ここでは、処理が開始されたばかりである
ので、「次に処理すべきベクタ」が存在している。現在
処理するべきベクタは、当初から分かっているものとす
る。なお、処理の順番には特別な規則があるわけではな
いが、ここでは上記表1に掲げられた順にその後の処理
が進められるものとする。したがって、まず〔(X1,
Y1),(X2,Y2)〕が処理対象となる。
Since the process has just started, there is a "vector to be processed next". It is assumed that the vector to be currently processed is known from the beginning. Although there is no special rule in the order of processing, it is assumed here that the subsequent processing is performed in the order shown in Table 1 above. Therefore, first, [(X1,
Y1), (X2, Y2)] is the processing target.

【0017】(3)S3では、処理対象となるベクタの
各Y座標が等しいか否か判断される。これらの座標が等
しい場合には、後述するように処理が中断され、S1に
戻り、等しくない場合には次の処理(S4)に移行す
る。ここでは、Y1≠Y2であるので、処理はS4に移
行する。
(3) In S3, it is determined whether or not the Y coordinates of the vector to be processed are equal. If these coordinates are the same, the process is interrupted as will be described later, the process returns to S1, and if they are not the same, the process proceeds to the next process (S4). Here, since Y1 ≠ Y2, the process proceeds to S4.

【0018】(4)S4では、処理対象となるベクタ
〔(Xα,Yα),(Xβ,Yβ)〕と、その両端座
標(Xα,Yα),(Xβ,Yβ)からX軸に平行に正
の方向に向けて引いた2本の線と、塗描処理領域10
のY軸に平行な右側の辺、とに挟まれる領域に形成され
る塗描データがメモリ(RAM4)に格納される。この
場合には、塗描対象となるベクタは〔(X1,Y1),
(X2,Y2)〕であるので、その塗描データは図3
(A)下段で示すようになる(該塗描データ領域を
「1」で、非塗描データ領域を「0」で示す)。そし
て、この塗描処理領域10についての塗描データと、そ
の際に塗描処理領域についてのすでに作成されている塗
描データ(前回作成の塗描データ)とのXORが演算さ
れる。ここでは、「すでに作成されているデータ」は、
存在していないことから、塗描処理領域10全体につい
て「0」(図3(A)の上段参照)である。したがっ
て、この場合演算後の塗描データは、図3(B)上段に
示すように、同図(A)下段と同一である。
(4) In S4, the vector [(Xα, Yα), (Xβ, Yβ)] to be processed and the coordinates (Xα, Yα), (Xβ, Yβ) at both ends of the vector are positively parallel to the X axis. Two lines drawn in the direction of the
The painting data formed in the area sandwiched between the right side parallel to the Y-axis and is stored in the memory (RAM 4). In this case, the vector to be painted is [(X1, Y1),
(X2, Y2)], the painting data is shown in FIG.
(A) As shown in the lower part (the paint data area is indicated by "1" and the non-painting data area is indicated by "0"). Then, the XOR of the paint data for this paint processing area 10 and the paint data that has already been created for the paint processing area (paint data that was created last time) is calculated. Here, "data already created" is
Since it does not exist, it is “0” for the entire painting processing area 10 (see the upper part of FIG. 3A). Therefore, in this case, the painting data after calculation is the same as the lower part of FIG. 3A as shown in the upper part of FIG.

【0019】なお、上記塗描データを作成は、メモリ上
での台形(図3(A)下段等参照)の塗描処理を意味し
ている。この場合、台形の塗描はどのような方法でもよ
く、水平ラインについてのスキャンを画素単位で垂直方
向にずらして行う方法でもよいし、前述したように台形
を直角三角形と長方形に分解して塗描する方法でもよ
い。
The creation of the painting data means a painting process of a trapezoid (see the lower stage of FIG. 3A) on the memory. In this case, the trapezoidal painting may be performed by any method, or by scanning the horizontal lines by shifting them in pixel units in the vertical direction, or by separating the trapezoid into right-angled triangles and rectangles as described above. It may be drawn.

【0020】(5)次に、塗描されている台形状のデー
タ領域の上底または下底から、画素1列(線1本)を消
去または付加する(S6)。本実施例では、XY座標
を、画素を基準に(画素の中心を基準に)に定めている
ため、上記消去を実行しておかないと、ポリゴン1につ
いての塗描の全処理が終了した後、非塗描領域に不要な
水平塗描線が現れたり、塗描領域に不要な水平非塗描線
が現れたりする場合がある。本実施例では、S5におい
て、Yα>Yβの判断を行い、台形の上底から上記画素
1列の消去または付加を行うような場合分けを行ってい
る。この場合分けに応じ、上記関係が成立するときに
は、現在の塗描データと、線分(Xα,Yα)−(Xm
ax,Yα)が塗描された処理領域とのXORが演算さ
れ(S6a)、上記関係が成立しないときは、現在の塗
描データと、線分(Xβ,Yβ)−(Xmax,Yβ)
が塗描された処理領域とのXORが演算される(S6
b)。この後、処理はS2に移行する。今の場合、Y1
<Y2であるので、S6bに処理が移行し、図3(B)
上段に示した塗描データと、同図(B)下段に示す線分
とのXORが演算され、図3(C)上段に示す塗描デー
タが作成される。
(5) Next, one column of pixels (one line) is erased or added from the upper or lower bottom of the painted trapezoidal data area (S6). In this embodiment, the XY coordinates are determined on the basis of the pixel (on the basis of the center of the pixel). Therefore, unless the erasure is performed, the entire painting process for the polygon 1 is completed. Unnecessary horizontal painting lines may appear in the non-painting area, or unwanted horizontal non-painting lines may appear in the painting area. In the present embodiment, in S5, it is determined whether Yα> Yβ, and the one column of pixels is erased or added from the upper bottom of the trapezoid. When the above relationship is established according to the case classification, the current painting data and the line segment (Xα, Yα)-(Xm
ax, Yα) is calculated with respect to the processing area where the painting is performed (S6a), and when the above relationship is not established, the current painting data and the line segment (Xβ, Yβ)-(Xmax, Yβ)
XOR with the processing area on which is painted is calculated (S6
b). After this, the processing shifts to S2. In this case, Y1
Since <Y2, the process moves to S6b, and the process shown in FIG.
The XOR of the painting data shown in the upper part and the line segment shown in the lower part of FIG. 3B is calculated, and the painting data shown in the upper part of FIG. 3C is created.

【0021】(6)次に、P2−P3、すなわちベクタ
〔(X2,Y2),(X3,Y3)〕について、上記と
同様の処理が行われる。すなわち、S2において、図3
(C)に示すように、〔(X2,Y2),(X3,Y
3)〕について塗描データが作成され(下段参照)、こ
れと上段に示した塗描データとのXORが演算される。
この結果、塗描データは、図3(D)上段に示すよう
に、上記2つの塗描データ間に「0」の線が形成された
データに書き換えられる。S5での判断により、処理は
S6aに移行し、図3(D)下段に示す塗描データと、
上記図3(D)上段に示す塗描データとのXORが演算
される。この結果、図3(E)上段に示すように、上記
塗描データ間の「0」の線は消去される。
(6) Next, with respect to P2-P3, that is, the vector [(X2, Y2), (X3, Y3)], the same processing as described above is performed. That is, in S2, as shown in FIG.
As shown in (C), [(X2, Y2), (X3, Y
3)], the paint data is created (see the lower part), and the XOR between this and the paint data shown in the upper part is calculated.
As a result, the paint data is rewritten to data in which a line of "0" is formed between the two paint data, as shown in the upper part of FIG. According to the determination in S5, the process proceeds to S6a, and the painting data shown in the lower part of FIG.
XOR with the painting data shown in the upper part of FIG. 3D is calculated. As a result, as shown in the upper part of FIG. 3 (E), the line of "0" between the painting data is erased.

【0022】(7)ついで、P3−P4すなわち、ベク
タ〔(X3,Y3),(X4,Y4)〕についてS2,
S3の処理が行われる。ここでは、Y3=Y4であるこ
とから、S3の判断により、ベクタ〔(X3,Y3),
(X4,Y4)〕についてのその後の処理はなされず、
P4−P5、すなわちベクタ〔(X4,Y4),(X
5,Y5)〕についてのS2,S3,S4の処理が行わ
れる。S4では、図3(E)に示すように、下段に示す
ベクタ〔(X4,Y4),(X5,Y5)〕についての
塗描データと、上段に示したすでに作成されている塗描
データとのXORが演算され、図3(F)上段に示す塗
描データが作成される。
(7) Next, P2-P4, that is, S2 for the vector [(X3, Y3), (X4, Y4)]
The process of S3 is performed. Here, since Y3 = Y4, the vector [(X3, Y3),
The subsequent processing for (X4, Y4)] is not performed,
P4-P5, that is, the vector [(X4, Y4), (X
5, Y5)], the processing of S2, S3, S4 is performed. In S4, as shown in FIG. 3 (E), the paint data for the vector [(X4, Y4), (X5, Y5)] shown in the lower row and the already created paint data shown in the upper row are stored. XOR is calculated, and the painting data shown in the upper part of FIG.

【0023】この結果、処理はS5を経てS6に移行
し、図3(F)下段に示す塗描データ(図3(E)下段
の台形の上底に相当する線)と、前述の同(F)上段に
示す塗描データとのXORが演算され、図3(G)に示
す塗描データが作成される。 (8)さらに、P4−P5、すなわちベクタ〔(X4,
Y4),(X5,Y5)〕についてS2の処理が行われ
る。S2では、〔(X4,Y4),(X5,Y5)〕
が、「次に処理するべきベクタベクタ」を有していない
ことから、処理は終了する。
As a result, the processing shifts from S5 to S6, and the painting data shown in the lower part of FIG. 3 (F) (the line corresponding to the upper base of the trapezoid in the lower part of FIG. 3 (E)) and the above-mentioned ( F) The XOR with the painting data shown in the upper part is calculated, and the painting data shown in FIG. 3G is created. (8) Furthermore, P4-P5, that is, the vector [(X4,
The processing of S2 is performed for Y4), (X5, Y5)]. In S2, [(X4, Y4), (X5, Y5)]
However, since it does not have the "vector vector to be processed next", the processing ends.

【0024】図4は、上記(1)〜(8)に述べた処理
を、五角形と5つの三角形により構成された星形ポリゴ
ン2(頂点をP1〜P5で示す)に適用して、フィルポ
リゴン2′を作成する場合の説明図である。同図に示す
ように、塗描処理領域20内に作成された星形ポリゴン
2は、各線分により形成される塗描データ21〜25と
の間で順次XORが演算され、フィルポリゴン2′が作
成される。
In FIG. 4, the processing described in (1) to (8) above is applied to a star polygon 2 (vertices are indicated by P1 to P5) composed of a pentagon and five triangles to fill a polygon. It is explanatory drawing at the time of creating 2 '. As shown in the figure, the star polygon 2 created in the painting processing area 20 is sequentially XORed with the painting data 21 to 25 formed by each line segment, and the fill polygon 2'is obtained. Created.

【0025】図5は、同じく上記(1)〜(8)に述べ
た処理を、白抜きの星形ポリゴン3に適用して、フィル
ポリゴン3′を作成する場合の説明図である。同図で
は、塗描処理領域30内に作成された星形ポリゴン3
(頂点をP1〜P10で示す)は、各線分により形成さ
れる塗描データ31〜40との間でトーナメント方式で
順次XORが演算され、フィルポリゴン3′が作成され
ている。
FIG. 5 is an explanatory diagram of a case where the processing described in the above (1) to (8) is applied to the white star polygon 3 to form the fill polygon 3 '. In the figure, the star-shaped polygon 3 created in the painting processing area 30.
The vertices (indicated by P1 to P10) are sequentially XORed with the paint data 31 to 40 formed by each line segment by a tournament method to create a fill polygon 3 '.

【0026】以上のようにして作成されるフィルポリゴ
ンの塗描の面種は、いわゆるベタ塗りに限らず、縞模様
や梨地等のハッチングが含まれることは言うまでもな
い。
It is needless to say that the surface type for painting the fill polygons created as described above is not limited to so-called solid painting but also includes hatching such as striped patterns and satin finish.

【0027】[0027]

【発明の効果】【The invention's effect】

(1)スキャンラインとポリゴンを構成する線分との交
点を求める等の複雑な計算の必要はなく、線の描画と同
等の計算量のみで、高速にフィルポリゴンの作成をする
ことができる。 (2)扱えるポリゴンの線分の数に制限はない。したが
って、スプライン曲線が複雑に入り組んだポリゴンの作
成が可能となる。 (3)グラフィックプロセッサを用いたり、専用のハー
ドウェア化も容易であり、CAD等の図形処理装置に有
効であるばかりでなく、アウトラインフォントの作成を
行うレーザプリンタ等の図形出力装置にも有効である。
(1) It is not necessary to perform complicated calculation such as obtaining an intersection between a scan line and a line segment that constitutes a polygon, and a fill polygon can be created at high speed with a calculation amount equivalent to that of drawing a line. (2) There is no limit to the number of polygon line segments that can be handled. Therefore, it is possible to create a polygon having a complicated spline curve. (3) Not only is it effective for graphic processing devices such as CAD because it uses a graphic processor and can be easily implemented as dedicated hardware, but it is also effective for graphic output devices such as laser printers that create outline fonts. is there.

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

【図1】本発明の処理の流れの一例を示す図である。FIG. 1 is a diagram showing an example of a processing flow of the present invention.

【図2】本発明の実施例を説明するために例示されたポ
リゴンを示す図である。
FIG. 2 is a diagram showing polygons exemplified for explaining an embodiment of the present invention.

【図3】図2のポリゴンを用いた本発明の実施例の説明
図である。
FIG. 3 is an explanatory diagram of an embodiment of the present invention using the polygon of FIG.

【図4】本発明の他の実施例の説明図である。FIG. 4 is an explanatory diagram of another embodiment of the present invention.

【図5】本発明のさらに他の実施例の説明図である。FIG. 5 is an explanatory diagram of still another embodiment of the present invention.

【図6】本発明において使用するハードウェア構成を示
す図である。
FIG. 6 is a diagram showing a hardware configuration used in the present invention.

【図7】従来のポリゴンの塗描方法を示す図である。FIG. 7 is a diagram showing a conventional polygon painting method.

【手続補正書】[Procedure amendment]

【提出日】平成4年12月6日[Submission date] December 6, 1992

【手続補正1】[Procedure Amendment 1]

【補正対象書類名】図面[Document name to be corrected] Drawing

【補正対象項目名】図1[Name of item to be corrected] Figure 1

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【図1】 [Figure 1]

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 任意形状ポリゴンの塗描方法であって、
(1)前記ポリゴンを含む塗描処理領域を定めるステッ
プ、(2)前記ポリゴンを構成する各線分と、前記線分
の両端から特定方向に引き出した二直線と、上記塗描処
理領域の外縁と、に挟まれる領域の塗描データをメモリ
内に作成するステップ、(3)前記各線分についての各
塗描データについて、排他的論理和を演算するステッ
プ、とからなることを特徴とするフィルポリゴンの作成
方法。
1. A method of painting an arbitrarily shaped polygon, comprising:
(1) a step of defining a painting processing area including the polygon, (2) each line segment forming the polygon, two straight lines drawn in a specific direction from both ends of the line segment, and an outer edge of the painting processing area. And a step of (3) calculating an exclusive OR of each painting data of each line segment in the memory, How to create.
【請求項2】 任意形状ポリゴンの塗描方法であって、
(1)前記ポリゴンを含む長方形の塗描処理領域を定め
るステップ、(2)前記ポリゴンを構成する各線分と、
上記線分の両端から前記長方形の特定の一辺と、上記線
分の両端から前記一辺に引き出した二直線と、に挟まれ
る台形または三角形領域の塗描データをメモリ内に作成
するステップ、(3)前記各線分についての各塗描デー
タについて、排他的論理和を演算するステップ、とから
なることを特徴とするフィルポリゴンの作成方法。
2. A method of painting an arbitrarily shaped polygon, comprising:
(1) a step of defining a rectangular painting processing area including the polygon, (2) each line segment forming the polygon,
Creating in a memory the paint data of a trapezoidal or triangular area sandwiched between a specific side of the rectangle from both ends of the line segment and two straight lines drawn from the ends of the line segment to the side; ) A step of calculating an exclusive OR of each painting data of each line segment, and a method of creating a fill polygon.
JP31602692A 1992-10-31 1992-10-31 Creation method for file polygon Pending JPH06150015A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP31602692A JPH06150015A (en) 1992-10-31 1992-10-31 Creation method for file polygon

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP31602692A JPH06150015A (en) 1992-10-31 1992-10-31 Creation method for file polygon

Publications (1)

Publication Number Publication Date
JPH06150015A true JPH06150015A (en) 1994-05-31

Family

ID=18072427

Family Applications (1)

Application Number Title Priority Date Filing Date
JP31602692A Pending JPH06150015A (en) 1992-10-31 1992-10-31 Creation method for file polygon

Country Status (1)

Country Link
JP (1) JPH06150015A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111985033A (en) * 2020-08-19 2020-11-24 北京博能科技股份有限公司 CAD drawing processing method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111985033A (en) * 2020-08-19 2020-11-24 北京博能科技股份有限公司 CAD drawing processing method and device and electronic equipment
CN111985033B (en) * 2020-08-19 2024-02-02 北京博能科技股份有限公司 CAD drawing processing method and device and electronic equipment

Similar Documents

Publication Publication Date Title
US6788301B2 (en) Active pixel determination for line generation in regionalized rasterizer displays
JP3840014B2 (en) Scan conversion execution apparatus for graphics display system
JP4327105B2 (en) Drawing method, image generation apparatus, and electronic information device
US4897805A (en) Method and apparatus for performing polygon fills in graphical applications
EP0323558A2 (en) Polygon filling method
US7898549B1 (en) Faster clears for three-dimensional modeling applications
US5461703A (en) Pixel image edge enhancement method and system
US20020158881A1 (en) Apparatus and method for acceleration of 2D vector graphics using 3D graphics hardware
JP2681367B2 (en) Graphic processing method and apparatus thereof
JP2634851B2 (en) Image processing device
US6992670B2 (en) Active region determination for line generation in regionalized rasterizer displays
JPH06150015A (en) Creation method for file polygon
JPS634380A (en) Computer graphic processor
EP1139294B1 (en) Graphical image system and apparatus
EP0268038B1 (en) Graphics processing system
KR100544803B1 (en) Fast processing of image primitives
US6791547B2 (en) Auxiliary active region determination for line width generation in regionalized rasterizer displays
JPH0350686A (en) Graphic processing system
JP2614111B2 (en) A method for detecting the correlation between a straight line display element and a rectangular window
CN115049564A (en) Picture sharpening processing method and processing terminal
JP2782904B2 (en) Polygon fill method
JP4320604B2 (en) Image processing method and image processing apparatus
JPH0371377A (en) Image processing method
JPH10261095A (en) Device and method for processing image
JPH0279178A (en) Implicit-surface elimination system