JP2005251076A - Image processing method and image processing device - Google Patents
Image processing method and image processing device Download PDFInfo
- Publication number
- JP2005251076A JP2005251076A JP2004063889A JP2004063889A JP2005251076A JP 2005251076 A JP2005251076 A JP 2005251076A JP 2004063889 A JP2004063889 A JP 2004063889A JP 2004063889 A JP2004063889 A JP 2004063889A JP 2005251076 A JP2005251076 A JP 2005251076A
- Authority
- JP
- Japan
- Prior art keywords
- line
- straight line
- scanning
- scanning line
- coordinates
- 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
Links
Images
Abstract
Description
本発明は、幅のある直線の表示処理の改良を図った画像処理方法および装置に関する。 The present invention relates to an image processing method and apparatus for improving display processing of a wide straight line.
従来、各種のソフトウエアにおいて、モニタに複数の直線を表示することはしばしば行われ、また、単に幅のない直線だけでなく、幅のある直線の表示も必要とされる。この幅のある直線の表示においては、通常、直線の始点と終点の座標および直線の幅がCPU(中央処理装置)によって指定され、画像処理装置がその3データをドットデータに変換し、モニタの2次元平面の表示ドット数に対応する記憶容量を有するフレームバッファに書き込む。このフレームバッファ内のドットデータが液晶等によるモニタへ出力されて直線表示が行われる(特許文献1参照)。なお、フレームバッファとしては、書き込み用/読み出し用の2バッファが設けられる。
ところで、周知のように、画像処理装置は、通常、LSIによって作成され、フレームバッファも1チップLSIの中に作成されることが望ましい。しかし、フレームバッファは記憶容量が大きく、大きなチップ面積を必要とする。したがって、画像処理装置においては、フレームバッファではなく、1表示ライン(走査線)のドット数に対応する記憶容量のラインバッファの方が記憶容量が小さくて済むため、低コスト化、小型化の点で好ましい。
しかしながら、直線の始点と終点の座標および直線の幅の3データを所定ラインのドットデータに変換する処理は時間がかかり、このため、従来、ラインバッファによっては幅がある直線表示ができないという問題があった。
By the way, as is well known, it is desirable that the image processing apparatus is normally created by an LSI, and the frame buffer is also created in a one-chip LSI. However, the frame buffer has a large storage capacity and requires a large chip area. Therefore, in the image processing apparatus, a line buffer having a storage capacity corresponding to the number of dots of one display line (scanning line), rather than a frame buffer, requires a smaller storage capacity. Is preferable.
However, it takes time to convert the three data of the coordinates of the start and end points of the straight line and the width of the straight line into dot data of a predetermined line, and therefore, conventionally, there is a problem that a straight line with a width cannot be displayed depending on the line buffer. there were.
また、従来の画像処理装置にあっては、幅のある直線を表示する時、図16に示すように、端部がモニタの走査線に対して平行あるいは直交する直線となり、図17に示すように、描画する直線に対して端部が直交する直線にはならない問題があった。
本発明は上記事情を考慮してなされたもので、その目的は、ラインバッファによって幅がある直線の表示を可能とする画像処理装置を提供することにある。また、この発明の他の目的は、端部が描画する直線に対して直交する直線となる画像処理装置を提供することにある。
Further, in the conventional image processing apparatus, when displaying a straight line having a width, as shown in FIG. 16, the end becomes a straight line that is parallel or orthogonal to the scanning line of the monitor, as shown in FIG. In addition, there is a problem that the end portion does not become a straight line perpendicular to the drawn straight line.
The present invention has been made in view of the above circumstances, and an object of the present invention is to provide an image processing apparatus capable of displaying a straight line having a width by a line buffer. Another object of the present invention is to provide an image processing apparatus that forms a straight line orthogonal to a straight line drawn by an end portion.
この発明は上記の課題を解決するためになされたもので、請求項1に記載の発明は、表示装置の走査線の各表示ドットに対応する記憶位置を有するラインバッファに、前記走査線の走査開始前に直線の表示データを書き込み、該書き込んだ表示データを前記走査線の走査タイミングに合わせて前記表示装置へ出力して前記直線の表示を行う画像処理方法において、前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を計算し、前記走査線が描画範囲外であった時直線の描画を中止する第1の処理と、前記走査線が描画範囲内であった時、前記走査線と直線の左側線、右側線との各交点の座標を求め、求めた座標値に基づいて描画ドットを決定する第2の処理と、決定された描画ドットに対応する前記ラインバッファの記憶位置に表示データを書き込む第3の処理とを有することを特徴とする画像処理方法である。 The present invention has been made in order to solve the above-described problems. According to the first aspect of the present invention, scanning of the scanning line is performed in a line buffer having a storage position corresponding to each display dot of the scanning line of the display device. In the image processing method for writing the straight line display data before the start and outputting the written display data to the display device in accordance with the scanning timing of the scanning line to display the straight line, the start point coordinates and the end point of the straight line A first process of calculating a vertical drawing range of the straight line based on the coordinates and the line width, and stopping the straight line drawing when the scanning line is out of the drawing range; If there is, second processing for determining the coordinates of each intersection of the scanning line and the left and right lines of the straight line, and determining the drawing dots based on the determined coordinate values, and corresponding to the determined drawing dots The line bar The image processing method characterized by having a third processing and writing display data into the storage position of the file.
請求項2に記載の発明は、表示装置の走査線の各表示ドットに対応する記憶位置を有するラインバッファに、前記走査線の走査開始前に直線の表示データを書き込み、該書き込んだ表示データを前記走査線の走査タイミングに合わせて前記表示装置へ出力して前記直線の表示を行う画像処理方法において、前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を計算し、前記走査線が描画範囲外であった時直線の描画を中止する第1の処理と、前記走査線が描画範囲内であった時、前記直線の傾きを前記始点座標および終点座標に基づいて計算する第2の処理と、前記直線の傾きが走査線に対し45度〜135度であった場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記直線の中心線と前記走査線の交点の座標を求めると共に、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線方向長さを計算し、前記交点座標および前記走査線方向長さから前記走査線と前記直線の左側線、右側線との各交点の座標を求める第3の処理と、前記直線の傾きが前記走査線に対し0度〜45度または135度〜180度であった場合に、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線垂直方向長さを計算し、前記直線の始点座標、終点座標、前記走査線垂直方向長さおよび前記走査線の座標から前記走査線と前記直線の左側線、右側線との各交点の座標を求める第4の処理と、前記第3または第4の処理によって求めた座標値に基づいて描画ドットを決定する第5の処理と、決定された描画ドットに対応するラインバッファの記憶位置に表示データを書き込む第6の処理とを有することを特徴とする画像処理方法である。 According to a second aspect of the present invention, straight line display data is written to a line buffer having a storage position corresponding to each display dot of the scanning line of the display device before the scanning of the scanning line is started, and the written display data is stored in the line buffer. In the image processing method for displaying the straight line by outputting to the display device in accordance with the scanning timing of the scanning line, the vertical drawing range of the straight line is determined based on the start point coordinate, end point coordinate, and line width of the straight line. A first process for calculating and stopping straight line drawing when the scanning line is outside the drawing range; and when the scanning line is within the drawing range, the slope of the straight line is set to the start point coordinate and the end point coordinate. A second process based on the straight line, and when the inclination of the straight line is 45 degrees to 135 degrees with respect to the scanning line, the straight line start point coordinate, the end point coordinate, and the scanning line coordinate During ~ Calculating the coordinates of the intersection of the line and the scanning line, and calculating the scanning line direction length of the straight line based on the start point coordinate, the end point coordinate, and the line width of the straight line, from the intersection point coordinate and the scanning line direction length Third processing for obtaining coordinates of intersections between the scanning line and the left and right lines of the straight line, and the inclination of the straight line was 0 to 45 degrees or 135 to 180 degrees with respect to the scanning line In this case, the scanning line vertical length of the straight line is calculated based on the starting point coordinate, end point coordinate and line width of the straight line, and the straight line starting point coordinate, end point coordinate, scanning line vertical length and the scanning line are calculated. The drawing dot is determined based on the fourth process for obtaining the coordinates of the intersections of the scanning line and the left and right lines of the straight line from the coordinates and the coordinate value obtained by the third or fourth process. The fifth process and the determined drawing The image processing method characterized by having a sixth process of writing display data in the storage position of the line buffer corresponding to the bets.
請求項3に記載の発明は、請求項2に記載の画像処理方法において、前記走査線が、前記直線の予め決められた端点範囲を通過するか否かを判断する第7の処理と、前記走査線が前記端点範囲を通過する場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記走査線方向の描画ドットの限界値を求める第8の処理とを有し、前記第6の処理は、前記第7の処理の結果が「通過」であった場合に、前記ラインバッファの記憶位置に表示データを書き込む際において前記第8の処理によって求められた限界値の外の描画ドットの書き込みを行わないことを特徴とする。 According to a third aspect of the present invention, in the image processing method according to the second aspect, a seventh process for determining whether or not the scanning line passes a predetermined end point range of the straight line, And when the scanning line passes through the end point range, an eighth process of obtaining a limit value of the drawing dots in the scanning line direction based on the start point coordinate, the end point coordinate, and the coordinate of the scan line of the straight line, In the sixth process, when the result of the seventh process is “pass”, when the display data is written in the storage position of the line buffer, the limit value obtained by the eighth process is exceeded. The drawing dots are not written.
請求項4に記載の発明は、表示装置の走査線の各表示ドットに対応する記憶位置を有するラインバッファに、前記走査線の走査開始前に直線の表示データを書き込み、該書き込んだ表示データを前記走査線の走査タイミングに合わせて前記表示装置へ出力して前記直線の表示を行う画像処理装置において、前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を演算する演算手段と、前記走査線が前記演算手段によって求められた描画範囲内であった時直線描画の指示を出力する制御手段と、前記制御手段からの指示を受け、前記走査線と前記直線の左側線、右側線との各交点の座標を求める交点座標演算手段と、前記交点座標演算手段によって求められた座標値に基づいて描画ドットを決定する描画ドット決定手段と、決定された描画ドットに対応する前記ラインバッファの記憶位置に表示データを書き込む書込手段とを具備することを特徴とする画像処理装置である。 According to a fourth aspect of the present invention, linear display data is written to a line buffer having a storage position corresponding to each display dot of a scanning line of a display device before the scanning of the scanning line is started, and the written display data is stored in the line buffer. In the image processing apparatus that displays the straight line by outputting to the display device in accordance with the scanning timing of the scanning line, the vertical drawing range of the straight line is determined based on the start point coordinate, end point coordinate, and line width of the straight line. A calculating means for calculating; a control means for outputting a straight line drawing instruction when the scanning line is within a drawing range obtained by the calculating means; and receiving the instruction from the controlling means, the scanning line and the straight line Intersection coordinate calculation means for obtaining the coordinates of each intersection with the left line and the right line of the image, and a drawing dot determination for determining a drawing dot based on the coordinate value obtained by the intersection coordinate calculation means An image processing apparatus characterized by comprising: means, and a writing means for writing the display data in the storage position of said line buffer corresponding to the determined drawing dots.
請求項5に記載の発明は、表示装置の走査線の各表示ドットに対応する記憶位置を有するラインバッファに、前記走査線の走査開始前に直線の表示データを書き込み、該書き込んだ表示データを前記走査線の走査タイミングに合わせて前記表示装置へ出力して前記直線の表示を行う画像処理装置において、前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を演算する第1の演算手段と、前記走査線が前記第1の演算手段によって演算された描画範囲内であった時直線描画の指示を出力する制御手段と、前記直線描画の指示を受けて前記直線の始点座標および終点座標に基づいて前記直線の傾きを演算する第2の演算手段と、前記直線の傾きが走査線に対し45度〜135度であった場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記直線の中心線と前記走査線の交点の座標を求めると共に、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線方向長さを計算し、前記交点座標および前記走査線方向長さから前記走査線と直線の左側線、右側線との各交点の座標を求める第3の演算手段と、前記直線の傾きが走査線に対し0度〜45度または135度〜180度であった場合は、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線垂直方向長さを計算し、前記直線の始点座標、終点座標、前記走査線垂直方向長さおよび前記走査線の座標から前記走査線と前記直線の左側線、右側線との各交点の座標を求める第4の演算手段と、前記第3または第4の演算手段によって求められた座標値に基づいて描画ドットを決定する描画ドット決定手段と、決定された描画ドットに対応するラインバッファの記憶位置に表示データを書き込む書込手段とを具備することを特徴とする画像処理装置である。 According to a fifth aspect of the present invention, linear display data is written to a line buffer having a storage position corresponding to each display dot of the scanning line of the display device before the scanning of the scanning line is started, and the written display data is stored in the line buffer. In the image processing apparatus that displays the straight line by outputting to the display device in accordance with the scanning timing of the scanning line, the vertical drawing range of the straight line is determined based on the start point coordinate, end point coordinate, and line width of the straight line. A first calculating means for calculating; a control means for outputting a straight line drawing instruction when the scanning line is within a drawing range calculated by the first calculating means; A second calculation means for calculating the inclination of the straight line based on the start point coordinate and the end point coordinate of the straight line, and the start point of the straight line when the straight line has an inclination of 45 to 135 degrees with respect to the scanning line. The coordinates of the intersection of the straight line center line and the scanning line are obtained based on the mark, the end point coordinate and the scanning line coordinate, and the scanning line direction of the straight line based on the starting point coordinate, the end point coordinate and the line width of the straight line A third computing means for calculating a length and calculating coordinates of each intersection between the scanning line and the left and right lines of the straight line from the intersection coordinates and the length in the scanning line direction; When the angle is 0 degree to 45 degrees or 135 degrees to 180 degrees, the length of the straight line in the scanning line vertical direction is calculated based on the start point coordinates, end point coordinates, and line width of the straight line, and the start point of the straight line Fourth computing means for obtaining coordinates of intersections of the scanning line and the left and right lines of the straight line from the coordinates, end point coordinates, the scanning line vertical length and the scanning line coordinates; Obtained by the fourth computing means An image processing apparatus comprising: a drawing dot determining unit that determines a drawing dot based on a standard value; and a writing unit that writes display data to a storage position of a line buffer corresponding to the determined drawing dot. is there.
請求項6に記載の発明は、請求項5に記載の画像処理装置において、前記走査線が、前記直線の予め決められた端点範囲を通過するか否かを判断する判断手段と、前記走査線が前記端点範囲を通過する場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記走査線方向の描画ドットの限界値を求める第5の演算手段とを有し、前記書込手段は、前記判断手段の結果が「通過」であった場合に、前記ラインバッファの記憶位置に表示データを書き込む際において前記第5の演算手段によって求められた限界値の外の描画ドットの書き込みを行わないことを特徴とする。 A sixth aspect of the present invention is the image processing apparatus according to the fifth aspect, wherein the scanning line determines whether or not the scanning line passes a predetermined end point range of the straight line, and the scanning line. 5th calculating means for obtaining the limit value of the drawing dots in the scanning line direction based on the start point coordinates, the end point coordinates of the straight line, and the coordinates of the scanning line when passing through the end point range, When the result of the determination means is “pass”, the writing means writes drawing dots outside the limit value obtained by the fifth calculation means when writing display data to the storage position of the line buffer. Is not performed.
この発明によれば、幅がある直線の表示をラインバッファ方式による画像処理装置によって行うことができる効果がある。また、請求項3および請求項6の発明によれば、直線の端部を直線の中心線に対して直交する線とすることができ、これにより、直線端部の表示を見栄え良くすることができる。
According to the present invention, there is an effect that a straight line having a width can be displayed by an image processing apparatus using a line buffer system. According to the invention of
以下、図面を参照し、この発明の実施の形態について説明する。図2はこの発明の一実施の形態によるラインバッファ方式の画像処理装置1を適用したディスプレイ装置の構成を示すブロック図である。この図において、2はスプライトパターンが記憶されたパターンメモリ、3は画像表示を制御するCPU(中央処理装置)、4はCRT(ブラウン管)によるモニタである。 Embodiments of the present invention will be described below with reference to the drawings. FIG. 2 is a block diagram showing the configuration of a display apparatus to which the line buffer type image processing apparatus 1 according to one embodiment of the present invention is applied. In this figure, 2 is a pattern memory in which sprite patterns are stored, 3 is a CPU (central processing unit) for controlling image display, and 4 is a monitor using a CRT (CRT).
画像処理装置1において、11はパターンメモリインターフェイス、12はCPUインターフェイス、Bはバスラインである。14はカラーコードをRGBカラーデータに変換するカラーパレットである。パターンメモリ2にはスプライトパターンの画像データがカラーコードによって記憶されており、カラーパレット14はそのカラーコードをRGBカラーデータに変換するためのものである。15は汎用テーブル、16はデータ一時記憶用のレジスタである。汎用テーブル15はCPU3によって書き込みが行われるテーブルであり、図3に示すように、レイヤ設定テーブル15aおよび直線属性テーブル15bを有している。
In the
レイヤ設定テーブル15aは、複数のレイヤから構成される。図4は各レイヤを示す図であり、この図に示すように、レイヤ#0が最初に描画され、レイヤ#1、#2・・・がその上に順次上書きされる。各レイヤはスプライト表示レイヤまたは直線表示レイヤであり、スプライト表示レイヤにはスプライトの属性データが記憶され、また、直線表示レイヤには直線属性テーブル15bの始点アドレス、終点アドレスが記憶される。ここで、スプライト属性データには、スプライト識別番号、表示位置を指示する表示位置データ、拡大/縮小等を指示するレンダリングデータ等がある。また、直線属性テーブル15bには、直線の属性、すなわち、直線の始点座標、終点座標、直線の幅、直線の色を指定する各データが記憶される。
The layer setting table 15a is composed of a plurality of layers. FIG. 4 is a diagram showing each layer. As shown in this figure,
図3の例によって具体的に説明すると、現在、レイヤ設定テーブル15aに#0〜#6の7レイヤが設定されており、レイヤ#2が直線表示レイヤであり、それ以外のレイヤ#0、#1、#3〜#6がスプライト表示レイヤとなっている。そして、レイヤ#0、#1、#3〜#6には各々1つのスプライトのスプライト属性が書き込まれている。一方、レイヤ#2には、始点アドレスとしてアドレス「200h」が、終点アドレスとしてアドレス「238h」が書き込まれている。この始点アドレスおよび終点アドレスが指示する直線属性テーブル15bの記憶領域には、直線#0〜#7の8本の直線の属性が順次書き込まれている。
Specifically, referring to the example of FIG. 3, currently, seven
次に図2に戻り、スプライトプレーンジェネレータ18はレイヤ設定テーブル15aの各レイヤから順次スプライト属性データを読み出し、読み出した属性データのスプライト識別番号をパターンメモリインターフェイス11へ出力する。パターンメモリインターフェイス11はその識別番号のスプライトパターンの画像データをパターンメモリ2から読み出し、スプライトプレーンジェネレータ18へ出力する。スプライトプレーンジェネレータ18はその画像データをカラーパレット14へ出力してRGBカラーデータに変換し、変換後のカラーデータをスプライト属性データと共にスプライトレンダリングプロセッサ19へ出力する。
Next, returning to FIG. 2, the sprite plane generator 18 sequentially reads the sprite attribute data from each layer of the layer setting table 15 a and outputs the sprite identification number of the read attribute data to the
スプライトレンダリングプロセッサ19は、スプライトプレーンジェネレータ18から受けたカラーデータに対し、スプライト属性データに含まれるレンダリングデータに基づく拡大/縮小、回転等の処理を施した後ラインバッファ20に書き込む。直線プレーンジェネレータ22は、レイヤ設定テーブル15aの直線表示レイヤから始点アドレス、終点アドレスを読み出し、読み出したアドレスに基づいて直線属性テーブル15bから直線属性データを読み出す。そして、読み出した直線属性データを直線レンダリングプロセッサ23へ出力する。この場合、直線の色を指定するカラーコードをカラーパレット14によってRGBカラーデータに変換する。
The sprite rendering
直線レンダリングプロセッサ23は、直線属性データに含まれる始点座標、終点座標、線幅に基づいて所定ラインに表示すべき直線の表示ドットを求め、求めた表示ドットに対応するラインバッファ20の記憶位置に直線属性データに含まれるカラーコードをカラーパレット14で変換したRGBカラーデータを書き込む。
The straight
ラインバッファ20は、モニタ4の1水平表示ラインの各表示ドットに対応する記憶スロットを有するバッファメモリであり、2個のバッファが設けられている。そして、それら2個のバッファが交互に書き込み用バッファおよび読み出し用バッファとして使用される。クロック発生回路25は基準クロックパルスを発生し、各部へ出力する。CRTコントローラ26は、クロック発生回路25から出力されるクロックパルスに基づいてモニタ4を駆動する各種のパルス信号、すなわち、水平走査パルス、垂直走査パルス等を発生し、モニタ4およびフレームデータコントローラ27へ出力する。フレームデータコントローラ27は、ラインバッファ20からカラーデータを読み出し、水平走査パルスに従ってDAC(ディジタル・アナログ・コンバータ)28a〜28cへ出力する。DAC28a〜28cはカラーデータをアナログカラー信号に変換し、モニタ4へ出力する。
次に、ラインバッファ方式による直線描画の過程の概略を図1、図5、図6を参照して説明する。
The
Next, an outline of a line drawing process by the line buffer method will be described with reference to FIGS. 1, 5, and 6. FIG.
図1は、図2に示す構成から直線表示のための構成を抽出して描いた機能ブロック図である。直線を表示する場合は、CPU3が直線の始点座標、終点座標、線幅、線色等の属性データを直線属性テーブル15bに設定する。直線描画ブロックRB(図2における直線プレーンジェネレータ22、直線レンダリングプロセッサ23が対応)は表示する直線毎に直線属性テーブル15bの設定データを読み出し、そこに設定された属性にしたがって、表示位置の計算を行い、ラインバッファ20a、20b上の表示位置に属性データの線色に対応するカラーデータを描画する。
FIG. 1 is a functional block diagram drawn by extracting a configuration for linear display from the configuration shown in FIG. When displaying a straight line, the
表示インタフェースブロックDI(図2におけるフレームデータコントローラ27、DAC28a〜28cが対応)は、CRTCブロック26において生成されたモニタ4のスキャンタイミングにしたがって、ラインバッファ20a、20bからカラーデータを読み出し、モニタ4ヘドットデータとして送出する。
The display interface block DI (corresponding to the
ラインバッファ20a、20bは描画用、表示用のダブルバッファで構成され、1表示直線毎に描画と表示を切り替える。モニタ4は0ラインからNラインを順次表示する。ラインバッファ方式では、図5に示すように、2つのラインバッファ20a、20bがそれぞれ描画と表示を繰り返し行う。例えば、ラインバッファ20aが0ライン目を表示している間は、他方のラインバッファ20bに1ライン目の表示データを描画する。0ライン目の表示が終了した時点で、ラインバッファ20a、20bの描画と表示を切り替え、ラインバッファ20bに描画した1ライン目のデータを表示する。1ライン目を表示している間に、他方のラインバッファ20aには2ライン目の表示データを描画する。ラインバッファ方式はフレームバッファ方式に比べてメモリ容量が少なくて済むという利点があるが、前ラインでの描画パラメータを保持できないという欠点がある。
The line buffers 20a and 20b are composed of double buffers for drawing and display, and switch between drawing and display for each display line. The
図6に示す始点(LSX, LSY)から終点(LEX,LEY)へ幅LWの直線を描画する場合、ラインバッファ方式で描画するために描画ラインYN毎に、描画開始ドットDRS、描画終了ドットDREを計算し、DRSからDREまでのドットに対応するラインバッファアドレスに線色で指定された色のカラーデータを書き込む。 When a straight line having a width LW is drawn from the start point (LSX, LSY) to the end point (LEX, LEY) shown in FIG. 6, in order to draw by the line buffer method, the drawing start dot DRS and the drawing end dot DRE are drawn for each drawing line YN. And the color data of the color specified by the line color is written to the line buffer address corresponding to the dots from DRS to DRE.
次に、上述した直線描画処理の過程を図7〜図15を参照して詳細に説明する。
図7は直線描画処理の過程を示すフローチャート、図8は描画基準点を説明するための図である。図8に示すように、線幅LWが偶数幅(偶数ドット幅)の場合はグリッド上の始点および終点座標がそのまま描画基準点となり、線幅LWが奇数幅の場合はグリッドの始点および終点の座標それぞれのX座標およびY座標に0.5を加算した点が描画基準点となる。ここで、奇数幅の場合に、描画基準点をずらすのは、直線を滑らかに表示するためである。また、以下の説明においては、始点、終点のX、Y座標をそれぞれ次の表示によって表す。
始点(LSX,LSY)
終点(LEX,LEY)
また、座標の原点をモニタの左上角とする。
Next, the process of the straight line drawing process described above will be described in detail with reference to FIGS.
FIG. 7 is a flowchart showing a process of straight line drawing processing, and FIG. 8 is a diagram for explaining drawing reference points. As shown in FIG. 8, when the line width LW is an even width (even dot width), the start point and end point coordinates on the grid are directly used as drawing reference points, and when the line width LW is an odd width, the start point and end point of the grid are used. A point obtained by adding 0.5 to the X coordinate and Y coordinate of each coordinate is a drawing reference point. Here, in the case of an odd width, the drawing reference point is shifted in order to display a straight line smoothly. In the following description, the X and Y coordinates of the start point and end point are represented by the following displays, respectively.
Start point (LSX, LSY)
End point (LEX, LEY)
The origin of coordinates is the upper left corner of the monitor.
以下、図7のフローチャートの各ステップS1〜S12について順に説明する。
(S1)直線属性テーブルデータロード
直線描画ブロックRB(図1)は、モニタ4の各走査線の走査開始前において、直線属性テーブル15bから直線属性データを順次読み出し描画する。この属性データには、直線の始点座標、終点座標、線幅、線色を示すデータが含まれている。
Hereinafter, steps S1 to S12 in the flowchart of FIG. 7 will be described in order.
(S1) Line attribute table data load The line drawing block RB (FIG. 1) sequentially reads and draws line attribute data from the line attribute table 15b before the scanning of each scanning line of the
(S2)Y方向描画範囲の計算
描画を行う走査線(Y=YNとする)が、描画すべき直線内であるか(直線に交差するか)否かを判定するために、直線描画範囲(Y方向の描画範囲)の最小値Ymin、最大値Ymaxをそれぞれ次の式によって求める。この直線描画範囲は直線の幅が奇数幅であるか、偶数幅であるかによって異なる。
奇数幅 Ymin=min(LSY,LEY)+0.5-LW/2
Ymax=max(LSY,LEY)+0.5+LW/2
偶数幅 Ymin=min(LSY,LEY)-LW/2
Ymax=max(LSY,LEY)+LW/2
ここで、min( , )、max( , )はそれぞれ小の方をとる、大の方をとるという意味の関数である。また、「0.5」は、図8に示すように、線幅が奇数の場合に始点、終点の座標と描画基準点とをずらすための値である。この0.5ずらすことによって、直線表示の不自然さを少なくすることができる。
(S2) Calculation of Y-direction drawing range In order to determine whether or not the scanning line (Y = YN) for drawing is within the straight line to be drawn (crosses the straight line), a straight line drawing range ( The minimum value Ymin and the maximum value Ymax of the drawing range in the Y direction are respectively obtained by the following equations. This straight line drawing range varies depending on whether the width of the straight line is an odd width or an even width.
Odd width Ymin = min (LSY, LEY) + 0.5-LW / 2
Ymax = max (LSY, LEY) + 0.5 + LW / 2
Even width Ymin = min (LSY, LEY) -LW / 2
Ymax = max (LSY, LEY) + LW / 2
Here, min (,) and max (,) are functions that mean the smaller one and the larger one, respectively. Further, “0.5” is a value for shifting the start point and end point coordinates and the drawing reference point when the line width is an odd number, as shown in FIG. By shifting the distance by 0.5, the unnaturalness of the straight line display can be reduced.
また、走査線が上記YminとYmaxの間であって、次の端点処理範囲内であった時は端点処理を行った後、描画範囲内か否かを判断する。
奇数幅 LSY+0.5-LW/2≦YN<LSY+0.5+LW/2
LEY+0.5-LW/2≦YN<LEY+0.5+LW/2
偶数幅 LSY-LW/2≦YN<LSY+LW/2
LEY-LW/2≦YN<LEY+LW/2
なお、端点処理については後述する。
When the scanning line is between Ymin and Ymax and within the next end point processing range, it is determined whether or not the scanning line is within the drawing range after end point processing is performed.
Odd width LSY + 0.5-LW / 2 ≦ YN <LSY + 0.5 + LW / 2
LEY + 0.5-LW / 2 ≦ YN <LEY + 0.5 + LW / 2
Even width LSY-LW / 2 ≦ YN <LSY + LW / 2
LEY-LW / 2 ≦ YN <LEY + LW / 2
The end point processing will be described later.
(S3)描画範囲内か否かの判定
描画対象の走査線がYminより小の場合、あるいは、Ymaxより大の場合は描画範囲外となり、その直線についての描画処理は行われず(ステップS3の判断が「NO」)次の直線の処理へ進む。また、上記端点処理範囲内の場合は、端点処理を行った後、描画範囲内か否かが判断される。端点処理を行った後、描画範囲内と判断された場合、および、描画対象の走査線が上記YminとYmaxの間であって、端点処理範囲より内側であった場合は以下の描画処理が行われる(ステップS3の判断が「YES」)。
(S3) Determination of whether or not the drawing range is satisfied If the scanning line to be drawn is smaller than Ymin or larger than Ymax, the drawing line is outside the drawing range, and the drawing process for the straight line is not performed (determination in step S3). "NO") Proceed to the next straight line processing. In the case of the end point processing range, after end point processing is performed, it is determined whether or not it is within the drawing range. After the end point processing, if it is determined that it is within the drawing range, and if the scanning line to be drawn is between Ymin and Ymax and inside the end point processing range, the following drawing processing is performed. (The determination in step S3 is “YES”).
(S4)傾きの計算、方向の判定
直線描画は始点から終点に向かって描画を行う。そのため始点と終点の位置により描画方法が異なる。また、直線の傾き(|LEX-LSX|/|LEY-LSY|の値)によっても描画方法が異なる。そこで、描画に先立って直線の傾きおよび直線の方向を求める。
(S4) Inclination calculation and direction determination Straight line drawing is performed from the start point to the end point. Therefore, the drawing method differs depending on the position of the start point and the end point. The drawing method also differs depending on the slope of the straight line (value of | LEX-LSX | / | LEY-LSY |). Therefore, prior to drawing, the inclination of the straight line and the direction of the straight line are obtained.
○傾きの計算
直線の傾きDX、DYの値を計算する。いま、直線を図9に符号Lによって示すものとすると、傾きDX、DYは次の式によって求められる。
DX=Lx/Ly=(LEX-LSX)/(LEY-LSY)
DY=Ly/Lx=(LEY-LSY)/(LEX-LSX)
この傾きDX、DYは、実際には次のように計算する。まず、
△X=1/(LEX-LSX)
△Y=1/ (LEY-LSY)
を求める。この△X、△Yは逆数ROMに予め複数の計算値を記憶させておく。次に、
DX= (LEX-LSX) ×△Y
DY=(LEY-LSY)×△X
なる演算を行って傾きDX、DYを求める。
○ Calculation of slope Calculate the values of straight line slopes DX and DY. Assuming that a straight line is indicated by a symbol L in FIG. 9, the slopes DX and DY are obtained by the following equations.
DX = Lx / Ly = (LEX-LSX) / (LEY-LSY)
DY = Ly / Lx = (LEY-LSY) / (LEX-LSX)
The slopes DX and DY are actually calculated as follows. First,
△ X = 1 / (LEX-LSX)
△ Y = 1 / (LEY-LSY)
Ask for. ΔX and ΔY store a plurality of calculated values in the reciprocal ROM in advance. next,
DX = (LEX-LSX) × △ Y
DY = (LEY-LSY) × △ X
Calculate the slopes DX and DY by performing the following calculation.
○方向の判定
いま、図10に示す直交座標における原点を直線の始点とし、直線終点がどの領域にあるかによって直線の方向を判定する。図10における斜めの線は直交座標軸に対し45度の直線である。そして、直線の終点が図に示すハッチングを付した領域以外にある場合を水平方向直線、ハッチングを付した領域にある場合を垂直方向直線、X軸上にある場合を水平直線、Y軸上にある場合を垂直直線とし、各直線毎に描画処理方法を分けている。
具体的には、次の演算によって直線種別が求められる。
|LEX-LSX|/|LEY-LSY|>1:水平方向直線
|LEX-LSX|/|LEY-LSY|≦1:垂直方向直線
LEX-LSX=0 LEY-LSY≠0 :垂直直線
LEX-LSX≠0 LEY-LSY=0 :水平直線
○ Direction Determination Now, the origin of the orthogonal coordinates shown in FIG. 10 is used as the starting point of the straight line, and the direction of the straight line is determined depending on which region the straight line end point is. The diagonal line in FIG. 10 is a straight line of 45 degrees with respect to the orthogonal coordinate axis. If the end point of the straight line is outside the hatched area shown in the figure, the straight line is in the horizontal direction, the straight line is in the hatched area, the straight line is on the X axis, the horizontal straight line is on the Y axis. A certain case is defined as a vertical straight line, and the drawing processing method is divided for each straight line.
Specifically, the straight line type is obtained by the following calculation.
| LEX-LSX | / | LEY-LSY |> 1: Horizontal straight line
| LEX-LSX | / | LEY-LSY | ≦ 1: Vertical straight line
LEX-LSX = 0 LEY-LSY ≠ 0: Vertical straight line
LEX-LSX ≠ 0 LEY-LSY = 0: Horizontal straight line
なお、図の領域0〜3は次の式から求められる。
LEX-LSX≧O LEY-LSY≧0 領域0
LEX-LSX<O LEY-LSY≧0 領域1
LEX-LSX<0 LEY-LSY<0 領域2
LEX-LSX≧0 LEY-LSY<0 領域3
In addition, the area | regions 0-3 of a figure are calculated | required from the following formula.
LEX-LSX ≧ O LEY-LSY ≧ 0
LEX-LSX <O LEY-LSY ≧ 0 Area 1
LEX-LSX <0 LEY-LSY <0
LEX-LSX ≧ 0 LEY-LSY <0
(S5〜S7)直線種別の判定
上記の演算結果にしたがって直線種別が判定され、その判定結果にしたがって次の各処理に移行する。
垂直方向直線→ステップS8
水平方向直線→ステップS9
垂直直線→ステップS10
水平直線→ステップS11
(S5 to S7) Determination of Line Type The line type is determined according to the above calculation result, and the process proceeds to each of the following processes according to the determination result.
Vertical straight line → Step S8
Horizontal straight line → Step S9
Vertical straight line → Step S10
Horizontal straight line → Step S11
(S8)垂直方向直線描画
垂直方向直線の描画の過程を図11〜図14を参照して説明する。
(1)直線中心点XNの計算
始点と終点を結ぶ直線L1(図11)と描画対象の走査線を表すラインH(Y=YN+0.5)の交差する点のX座標XNを次式によって求める。X座標XNは奇数幅と偶数幅で求め方が異なる。
奇数幅 XN =(LSX+0.5) + ((YN+0.5 ) - (LSY+0.5)) ×DX
偶数幅 XN = LSX + ((YN+0.5 ) - LSY ) ×DX
(S8) Vertical Straight Line Drawing The process of drawing a vertical straight line will be described with reference to FIGS.
(1) Calculation of straight line center point XN The X coordinate XN of the point where the straight line L1 (FIG. 11) connecting the start point and the end point intersects the line H (Y = YN + 0.5) representing the scanning line to be drawn is obtained by the following equation. . The X coordinate XN is obtained differently for odd and even widths.
Odd width XN = (LSX + 0.5) + ((YN + 0.5)-(LSY + 0.5)) × DX
Even width XN = LSX + ((YN + 0.5)-LSY) × DX
(2)描画実行幅Wdrの計算
設定された線幅LW(図6)から実行幅を計算する。この計算は、実際にはROMに複数の計算結果を用意しておき、それを読み出すことによって求める。
Wdr = round(√(1+ |DX|2)× LW,0)
なお、round(A,0)はAの小数点以下を4捨5入する関数である。
(3)ラインHと直線の左側線L2との交点の座標XLr、直線の右側線L3との交点の座標XRrを次式によって求める。
XLr = XN-Wdr/2
XRr = XN+Wdr/2
(2) Calculation of drawing execution width Wdr The execution width is calculated from the set line width LW (FIG. 6). This calculation is actually obtained by preparing a plurality of calculation results in the ROM and reading them out.
Wdr = round (√ (1+ | DX | 2 ) × LW, 0)
Note that round (A, 0) is a function that rounds off the decimal part of A to four.
(3) The coordinates XLr of the intersection between the line H and the straight line L2 and the coordinate XRr of the intersection with the straight line L3 are obtained by the following equations.
XLr = XN-Wdr / 2
XRr = XN + Wdr / 2
(4)X方向描画制限値XMAX、XMINの計算
走査線のY座標YNが前述した端点処理範囲内(ステップS2参照)の時は、X方向の描画範囲から描画制限値XMAX、XMINを求め、その制限値の範囲内において描画ドットを求める(端点処理という)。X方向の描画範囲は、図12に示すように、直線Lの始点および終点において直線Lに直角に引いた直線M1、M2の間である。そして、描画制限値XMAX、XMINは次の過程によって求められる。
(4) Calculation of X direction drawing limit values XMAX and XMIN When the Y coordinate YN of the scanning line is within the end point processing range described above (see step S2), the drawing limit values XMAX and XMIN are obtained from the X direction drawing range, A drawing dot is obtained within the range of the limit value (referred to as end point processing). The drawing range in the X direction is between straight lines M1 and M2 drawn at right angles to the straight line L at the start and end points of the straight line L, as shown in FIG. The drawing limit values XMAX and XMIN are obtained by the following process.
まず、図13に示す直線の始点(LSX, LSY)によって決まるX方向描画範囲XSlimitを次式によって求める。
奇数幅 XSlimit = (LSX+0.5)-((YN+0.5)-(LSY+0.5))× DY
偶数幅 XSlimit = LSX -((YN+0.5)- LSY )× DY
次に、図14に示す直線の終点(LEX, LEY)によって決まるX方向描画範囲XElimitを次式によって求める。
奇数幅 XElimit = (LEX+0.5)-((YN+0.5)-(LEY+0.5))× DY
偶数幅 XElimit = LEX -((YN+0.5)- LEY )× DY
First, the X-direction drawing range XSlimit determined by the starting point (LSX, LSY) of the straight line shown in FIG.
Odd width XSlimit = (LSX + 0.5)-((YN + 0.5)-(LSY + 0.5)) × DY
Even width XSlimit = LSX-((YN + 0.5)-LSY) × DY
Next, the X-direction drawing range XElimit determined by the end point (LEX, LEY) of the straight line shown in FIG.
Odd width XElimit = (LEX + 0.5)-((YN + 0.5)-(LEY + 0.5)) × DY
Even width XElimit = LEX-((YN + 0.5)-LEY) × DY
X方向描画制限値XMIN、XMAXは図10に示す領域0〜3、XSlimit、XElimitから以下のように決まる。
領域0 : XMIN = XSlimit XMAX = XElinit
領域1 : XMIN = XElimit XMAX = XSlimit
領域2 : XMIN = XElimit XMAX = XSlimit
領域3 : XMIN = XSlimit XMAX = XElimit
The X direction drawing limit values XMIN and XMAX are determined as follows from the
Area 0: XMIN = XSlimit XMAX = XElinit
Region 1: XMIN = XElimit XMAX = XSlimit
Region 2: XMIN = XElimit XMAX = XSlimit
Region 3: XMIN = XSlimit XMAX = XElimit
(5)描画開始ドッド(DRS)及び描画終了ドット(DRE)の計算
これまでに計算したXLr、XRr、XMIN、XMAXの値より描画開始ドットDRS、描画終了ドットDREを以下の式によって計算する。
DRS = round(max(XLr、XMIN),0)
DRE = round(min(XRr、XMAX),0)
(6)ラインバッファヘの描画
DRSからDREまでのドットに対応したラインバッファのアドレスに、指定された線色データを書き込む(図13、図14のハッチング参照)。ただしこの場合、DREの1つ前のドットまでで、DREのドットは含まれない。
(5) Calculation of drawing start dot (DRS) and drawing end dot (DRE) The drawing start dot DRS and the drawing end dot DRE are calculated from the values of XLr, XRr, XMIN, and XMAX calculated so far by the following equations.
DRS = round (max (XLr, XMIN), 0)
DRE = round (min (XRr, XMAX), 0)
(6) Drawing to the line buffer
The designated line color data is written to the address of the line buffer corresponding to the dots from DRS to DRE (see hatching in FIGS. 13 and 14). However, in this case, the dots up to the previous dot of DRE are not included.
(S9)水平方向直線描画
水平方向直線の描画の過程を図15を参照して説明する。
(1)描画実行幅Wdrの計算
設定された線幅LWから実行幅Wdrを計算する。ここで、実行幅Wdrは、図15に示すように走査線に対し垂直方向となる。この計算は、実際にはROMに複数の計算結果を用意しておき、それを読み出すことによって求める。
Wdr = round(√(1+ |DY|2)× LW,0)
(S9) Horizontal Straight Line Drawing A horizontal straight line drawing process will be described with reference to FIG.
(1) Calculation of drawing execution width Wdr The execution width Wdr is calculated from the set line width LW. Here, the execution width Wdr is perpendicular to the scanning line as shown in FIG. This calculation is actually obtained by preparing a plurality of calculation results in the ROM and reading them out.
Wdr = round (√ (1+ | DY | 2 ) × LW, 0)
(2)直線の左端点のX座標XLr、右端点のX座標XRrの計算
XLrは奇数幅と偶数幅および描画領域で求め方が異なる。
○描画領域0,2
奇数幅 XLr=(LSX+0.5)+((YN+0.5)-(LSY+0.5)-Wdr/2)×DX
偶数幅 XLr=LSX +((YN+0.5)- LSY )-Wdr/2)×DX
○描画領域1,3
奇数幅 XLr=(LSX+0.5)+((YN+0.5)- LSY+0.5)+Wdr/2)×DX
偶数幅 XLr= LSX +((YN+0.5)- LSY )+Wdr/2)×DX
XRrも奇数幅と偶数幅および描画領域で求め方が異なる。
○描画領域0,2
奇数幅 XRr=(LSX+0.5)+((YN+0.5)-(LSY+0.5)+Wdr/2)×DX
偶数幅 XRr=LSX +((YN+0.5)- LSY )+Wdr/2)×DX
○描画領域1,3
奇数幅 XRr=(LSX+0.5)+((YN+0.5)- LSY+0.5)-Wdr/2)×DX
偶数幅 XRr= LSX +((YN+0.5)- LSY )-Wdr/2)×DX
(2) Calculation of the X coordinate XLr of the left end point of the straight line and the X coordinate XRr of the right end point
XLr is obtained differently for odd and even widths and drawing areas.
Odd width XLr = (LSX + 0.5) + ((YN + 0.5)-(LSY + 0.5) -Wdr / 2) × DX
Even width XLr = LSX + ((YN + 0.5)-LSY) -Wdr / 2) × DX
Odd width XLr = (LSX + 0.5) + ((YN + 0.5)-LSY + 0.5) + Wdr / 2) × DX
Even width XLr = LSX + ((YN + 0.5)-LSY) + Wdr / 2) × DX
XRr is also obtained differently for odd and even widths and the drawing area.
Odd width XRr = (LSX + 0.5) + ((YN + 0.5)-(LSY + 0.5) + Wdr / 2) × DX
Even width XRr = LSX + ((YN + 0.5)-LSY) + Wdr / 2) × DX
Odd width XRr = (LSX + 0.5) + ((YN + 0.5)-LSY + 0.5) -Wdr / 2) × DX
Even width XRr = LSX + ((YN + 0.5)-LSY) -Wdr / 2) × DX
(3)X方向描画制限値XMAX、XMINの計算
この計算は前述した(S8)垂直方向直線描画の項目(4)と全く同じである。
(4)描画開始ドット(DRS)及び描画終了ドット(DRE)の計算
この計算も前述した(S8)垂直方向直線描画の項目(5)と全く同じである。
(5)ラインバッファヘの描画
DRSからDREまでのドットに対応したラインバッファのアドレスに、指定された線色データを書き込む(図15のハッチング参照)。ただし、DREの1つ前のドットまでで、DREのドットは含まれない。DRS≧DREであった場合はラインバッファにデータを書き込まない。
(3) Calculation of X-direction drawing limit values XMAX and XMIN This calculation is exactly the same as item (4) of (S8) vertical straight line drawing described above.
(4) Calculation of drawing start dot (DRS) and drawing end dot (DRE) This calculation is also exactly the same as item (5) of (S8) vertical line drawing described above.
(5) Drawing to the line buffer
The designated line color data is written to the address of the line buffer corresponding to the dots from DRS to DRE (see hatching in FIG. 15). However, the dot up to the dot before the DRE is not included. When DRS ≧ DRE, data is not written to the line buffer.
(S10)垂直直線描画
垂直直線描画(LEXーLSX=O LEY-LSY≠0)の場合は以下の手順で描画を行う。
(1)Y方向描画範囲の計算
垂直直線描画の場合のY方向描画範囲は他の描画方法と異なり、次式によって計算されるYmin、Ymaxが、Ymin≦YN<Ymaxの時のみ描画を実行する。Ymin、Ymaxの計算は奇数幅と偶数幅で異なる。
奇数幅 Ymin = min(LSY,LEY) + 1
Ymax = max(LSY,LEY) + 1
偶数幅 Ymin = min(LSY,LEY)
Ymax - max(LSY,LEY)
(S10) Vertical straight line drawing In the case of vertical straight line drawing (LEX-LSX = OLEY-LSY ≠ 0), drawing is performed according to the following procedure.
(1) Y-direction drawing range calculation The Y-direction drawing range for vertical straight line drawing is different from other drawing methods, and drawing is performed only when Ymin and Ymax calculated by the following formula are Ymin ≦ YN <Ymax. . Ymin and Ymax calculations are different for odd and even widths.
Odd width Ymin = min (LSY, LEY) + 1
Ymax = max (LSY, LEY) + 1
Even width Ymin = min (LSY, LEY)
Ymax-max (LSY, LEY)
(2)描画開始ドットDRS及び描画終了ドットDREの計算
DRS、DREの計算は奇数幅と偶数幅で異なる。
奇数幅 DRS = LSX+0.5-LW/2
ORE = LSX+0.5+LW/2
偶数幅 DRS = LSX-LW/2
ORE = LSX+LW/2
(3)ラインバッファヘの描画
DRSからDREまでのドットに対応したラインバッファのアドレスに、指定された線色データを書き込む。ただし、DREの1つ前のドットまでで、DREのドットは含まれない。
(2) Calculation of drawing start dot DRS and drawing end dot DRE
The calculation of DRS and DRE is different for odd width and even width.
Odd width DRS = LSX + 0.5-LW / 2
ORE = LSX + 0.5 + LW / 2
Even width DRS = LSX-LW / 2
ORE = LSX + LW / 2
(3) Drawing to the line buffer
Write the specified line color data to the line buffer address corresponding to the dots from DRS to DRE. However, the dot up to the dot before the DRE is not included.
(S11)水平直線描画
水平直線描画(LEX-LSX≠O LEY-LSY=0)の場合以下の手順で描画を行う。
(1)描画開始ドットDRS及び描画終了ドットDREの計算
DRS、DREの計算は奇数幅と偶数幅で異なる。
奇数幅 DRS = min(LSX,LEX)+1
DRE = max(LSX,LEX)+1
偶数幅 DRS = min(LSX,LEX)
DRE = nax(LSX,LEX)
(2)ラインバッファヘの描画
DRSからDREまでのドットに対応したラインバッファのアドレスに、指定された線色データを書き込む。ただし、DREの1つ前のドットまでで、DREのドットは含まれない。
(S11) Horizontal straight line drawing In the case of horizontal straight line drawing (LEX-LSX ≠ O LEY-LSY = 0), drawing is performed according to the following procedure.
(1) Calculation of drawing start dot DRS and drawing end dot DRE
The calculation of DRS and DRE is different for odd width and even width.
Odd width DRS = min (LSX, LEX) +1
DRE = max (LSX, LEX) +1
Even width DRS = min (LSX, LEX)
DRE = nax (LSX, LEX)
(2) Drawing to the line buffer
Write the specified line color data to the line buffer address corresponding to the dots from DRS to DRE. However, the dot up to the dot before the DRE is not included.
ディスプレイに幅のある直線を表示する場合に使用される。 Used when displaying a wide straight line on the display.
3…CPU、4…モニタ、15…汎用テーブル、15b…直線属性テーブル、20a、20b…ラインバッファ、22…直線プレーンジェネレータ、23…直線レンダリングプロセッサ、RB…直線描画ブロック。
DESCRIPTION OF
Claims (6)
前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を計算し、前記走査線が描画範囲外であった時直線の描画を中止する第1の処理と、
前記走査線が描画範囲内であった時、前記走査線と直線の左側線、右側線との各交点の座標を求め、求めた座標値に基づいて描画ドットを決定する第2の処理と、
決定された描画ドットに対応する前記ラインバッファの記憶位置に表示データを書き込む第3の処理と、
を有することを特徴とする画像処理方法。 In a line buffer having a storage position corresponding to each display dot of the scanning line of the display device, linear display data is written before the scanning of the scanning line is started, and the written display data is matched with the scanning timing of the scanning line. In an image processing method for outputting to the display device and displaying the straight line,
A first process of calculating a vertical drawing range of the straight line based on a start point coordinate, an end point coordinate, and a line width of the straight line, and stopping drawing a straight line when the scanning line is outside the drawing range;
A second process for determining coordinates of intersections between the scanning line and the left and right lines of the straight line when the scanning line is within a drawing range, and determining a drawing dot based on the obtained coordinate value;
A third process of writing display data to the storage position of the line buffer corresponding to the determined drawing dot;
An image processing method comprising:
前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を計算し、前記走査線が描画範囲外であった時直線の描画を中止する第1の処理と、
前記走査線が描画範囲内であった時、前記直線の傾きを前記始点座標および終点座標に基づいて計算する第2の処理と、
前記直線の傾きが走査線に対し45度〜135度であった場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記直線の中心線と前記走査線の交点の座標を求めると共に、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線方向長さを計算し、前記交点座標および前記走査線方向長さから前記走査線と前記直線の左側線、右側線との各交点の座標を求める第3の処理と、
前記直線の傾きが前記走査線に対し0度〜45度または135度〜180度であった場合に、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線垂直方向長さを計算し、前記直線の始点座標、終点座標、前記走査線垂直方向長さおよび前記走査線の座標から前記走査線と前記直線の左側線、右側線との各交点の座標を求める第4の処理と、
前記第3または第4の処理によって求めた座標値に基づいて描画ドットを決定する第5の処理と、
決定された描画ドットに対応するラインバッファの記憶位置に表示データを書き込む第6の処理と、
を有することを特徴とする画像処理方法。 In a line buffer having a storage position corresponding to each display dot of the scanning line of the display device, linear display data is written before the scanning of the scanning line is started, and the written display data is matched with the scanning timing of the scanning line. In an image processing method for outputting to the display device and displaying the straight line,
A first process of calculating a vertical drawing range of the straight line based on a start point coordinate, an end point coordinate, and a line width of the straight line, and stopping drawing a straight line when the scanning line is outside the drawing range;
A second process for calculating the inclination of the straight line based on the start point coordinate and the end point coordinate when the scanning line is within the drawing range;
When the inclination of the straight line is 45 degrees to 135 degrees with respect to the scanning line, the coordinates of the intersection of the straight line center line and the scanning line based on the start point coordinates, the end point coordinates of the straight line, and the coordinates of the scanning line And calculating the length of the straight line in the scanning line direction based on the start point coordinate, the end point coordinate, and the line width of the straight line, and calculating the left line of the scanning line and the straight line from the intersection point coordinate and the length of the scanning line direction. A third process for determining the coordinates of each intersection with the right-hand line;
When the inclination of the straight line is 0 degree to 45 degree or 135 degree to 180 degree with respect to the scanning line, the length of the straight line in the vertical direction of the scanning line based on the start point coordinate, end point coordinate, and line width of the straight line And calculating the coordinates of the intersections of the scanning line and the left line and right line of the straight line from the start point coordinate, the end point coordinate, the vertical length of the scanning line and the coordinate of the scanning line. Processing,
A fifth process for determining a drawing dot based on the coordinate value obtained by the third or fourth process;
A sixth process of writing display data to the storage position of the line buffer corresponding to the determined drawing dot;
An image processing method comprising:
前記走査線が前記端点範囲を通過する場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記走査線方向の描画ドットの限界値を求める第8の処理と、
を有し、前記第6の処理は、前記第7の処理の結果が「通過」であった場合に、前記ラインバッファの記憶位置に表示データを書き込む際において前記第8の処理によって求められた限界値の外の描画ドットの書き込みを行わないことを特徴とする請求項2に記載の画像処理方法。 A seventh process for determining whether or not the scanning line passes through a predetermined end point range of the straight line;
An eighth process of obtaining a limit value of drawing dots in the scanning line direction based on the start point coordinate, the end point coordinate, and the coordinate of the scan line when the scan line passes through the end point range;
The sixth process is obtained by the eighth process when the display data is written to the storage position of the line buffer when the result of the seventh process is “pass”. 3. The image processing method according to claim 2, wherein writing of drawing dots outside the limit value is not performed.
前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を演算する演算手段と、
前記走査線が前記演算手段によって求められた描画範囲内であった時直線描画の指示を出力する制御手段と、
前記制御手段からの指示を受け、前記走査線と前記直線の左側線、右側線との各交点の座標を求める交点座標演算手段と、
前記交点座標演算手段によって求められた座標値に基づいて描画ドットを決定する描画ドット決定手段と、
決定された描画ドットに対応する前記ラインバッファの記憶位置に表示データを書き込む書込手段と、
を具備することを特徴とする画像処理装置。 In a line buffer having a storage position corresponding to each display dot of the scanning line of the display device, linear display data is written before the scanning of the scanning line is started, and the written display data is matched with the scanning timing of the scanning line. In the image processing apparatus that outputs to the display device and displays the straight line,
A calculation means for calculating a vertical drawing range of the straight line based on a start point coordinate, an end point coordinate and a line width of the straight line;
Control means for outputting a straight line drawing instruction when the scanning line is within the drawing range obtained by the computing means;
Intersection coordinate calculation means for receiving an instruction from the control means and obtaining coordinates of each intersection between the scanning line and the left side line and the right side line of the straight line;
Drawing dot determination means for determining a drawing dot based on the coordinate value obtained by the intersection coordinate calculation means;
Writing means for writing display data to the storage position of the line buffer corresponding to the determined drawing dot;
An image processing apparatus comprising:
前記直線の始点座標、終点座標および線幅に基づいて前記直線の垂直方向の描画範囲を演算する第1の演算手段と、
前記走査線が前記第1の演算手段によって演算された描画範囲内であった時直線描画の指示を出力する制御手段と、
前記直線描画の指示を受けて前記直線の始点座標および終点座標に基づいて前記直線の傾きを演算する第2の演算手段と、
前記直線の傾きが走査線に対し45度〜135度であった場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記直線の中心線と前記走査線の交点の座標を求めると共に、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線方向長さを計算し、前記交点座標および前記走査線方向長さから前記走査線と直線の左側線、右側線との各交点の座標を求める第3の演算手段と、
前記直線の傾きが走査線に対し0度〜45度または135度〜180度であった場合は、前記直線の始点座標、終点座標および線幅に基づいて前記直線の走査線垂直方向長さを計算し、前記直線の始点座標、終点座標、前記走査線垂直方向長さおよび前記走査線の座標から前記走査線と前記直線の左側線、右側線との各交点の座標を求める第4の演算手段と、
前記第3または第4の演算手段によって求められた座標値に基づいて描画ドットを決定する描画ドット決定手段と、
決定された描画ドットに対応するラインバッファの記憶位置に表示データを書き込む書込手段と、
を具備することを特徴とする画像処理装置。 In a line buffer having a storage position corresponding to each display dot of the scanning line of the display device, linear display data is written before the scanning of the scanning line is started, and the written display data is matched with the scanning timing of the scanning line. In the image processing apparatus that outputs to the display device and displays the straight line,
First calculating means for calculating a vertical drawing range of the straight line based on a start point coordinate, an end point coordinate and a line width of the straight line;
Control means for outputting a straight line drawing instruction when the scanning line is within a drawing range calculated by the first calculating means;
Second calculating means for calculating an inclination of the straight line based on a start point coordinate and an end point coordinate of the straight line in response to the line drawing instruction;
When the inclination of the straight line is 45 degrees to 135 degrees with respect to the scanning line, the coordinates of the intersection of the straight line center line and the scanning line based on the start point coordinates, the end point coordinates of the straight line, and the coordinates of the scanning line And calculating the scanning line direction length of the straight line based on the start point coordinate, the end point coordinate and the line width of the straight line, the left line of the scanning line and the straight line from the intersection point coordinate and the scanning line direction length, A third computing means for obtaining coordinates of each intersection with the right side line;
When the inclination of the straight line is 0 to 45 degrees or 135 to 180 degrees with respect to the scanning line, the length of the straight line in the scanning line vertical direction is determined based on the start point coordinates, end point coordinates, and line width of the straight line. A fourth calculation that calculates and calculates the coordinates of each intersection of the scanning line and the left and right lines of the straight line from the start point and end point coordinates of the straight line, the vertical length of the scanning line, and the coordinates of the scanning line Means,
Drawing dot determining means for determining a drawing dot based on the coordinate value obtained by the third or fourth calculating means;
Writing means for writing display data to the storage position of the line buffer corresponding to the determined drawing dot;
An image processing apparatus comprising:
前記走査線が前記端点範囲を通過する場合に、前記直線の始点座標、終点座標および前記走査線の座標に基づいて前記走査線方向の描画ドットの限界値を求める第5の演算手段と、
を有し、前記書込手段は、前記判断手段の結果が「通過」であった場合に、前記ラインバッファの記憶位置に表示データを書き込む際において前記第5の演算手段によって求められた限界値の外の描画ドットの書き込みを行わないことを特徴とする請求項5に記載の画像処理装置。 Determining means for determining whether or not the scanning line passes through a predetermined end point range of the straight line;
Fifth calculation means for obtaining a limit value of drawing dots in the scanning line direction based on the start point coordinates, end point coordinates of the straight line, and coordinates of the scanning line when the scanning line passes through the end point range;
The writing means has a limit value obtained by the fifth computing means when the display data is written to the storage position of the line buffer when the result of the judging means is “pass”. The image processing apparatus according to claim 5, wherein the drawing dots other than the above are not written.
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004063889A JP4320604B2 (en) | 2004-03-08 | 2004-03-08 | Image processing method and image processing apparatus |
US11/070,941 US7439980B2 (en) | 2004-03-08 | 2005-03-03 | Image processing method and apparatus |
US12/283,421 US20090051689A1 (en) | 2004-03-08 | 2008-09-11 | Image processing method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004063889A JP4320604B2 (en) | 2004-03-08 | 2004-03-08 | Image processing method and image processing apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2005251076A true JP2005251076A (en) | 2005-09-15 |
JP4320604B2 JP4320604B2 (en) | 2009-08-26 |
Family
ID=35031472
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004063889A Expired - Fee Related JP4320604B2 (en) | 2004-03-08 | 2004-03-08 | Image processing method and image processing apparatus |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4320604B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005257886A (en) * | 2004-03-10 | 2005-09-22 | Yamaha Corp | Image processing method and image processing device |
-
2004
- 2004-03-08 JP JP2004063889A patent/JP4320604B2/en not_active Expired - Fee Related
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005257886A (en) * | 2004-03-10 | 2005-09-22 | Yamaha Corp | Image processing method and image processing device |
Also Published As
Publication number | Publication date |
---|---|
JP4320604B2 (en) | 2009-08-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JPH07146952A (en) | Three-dimensional image processor | |
JP5172640B2 (en) | Vector drawing equipment | |
US6215501B1 (en) | Method and filling a polygon and recording medium | |
US7439980B2 (en) | Image processing method and apparatus | |
JP4320604B2 (en) | Image processing method and image processing apparatus | |
US20100134509A1 (en) | Image rendering processing apparatus | |
JP2002140063A (en) | Graphics drawing device | |
JP3898426B2 (en) | Graphic drawing device | |
JP4325812B2 (en) | Vector image drawing circuit and vector image drawing method | |
JP4466234B2 (en) | Image processing method and apparatus | |
JP3872056B2 (en) | Drawing method | |
EP2346001A1 (en) | Figure drawing device, anti-aliasing method, and storage medium | |
JP2011028641A (en) | Image processing device and image processing method | |
JP2005257886A (en) | Image processing method and image processing device | |
US7667714B2 (en) | Patterned polygon rendering apparatus | |
JP2614111B2 (en) | A method for detecting the correlation between a straight line display element and a rectangular window | |
JP4666480B2 (en) | Line drawing device | |
JP2611599B2 (en) | Computer graphics data processing method and apparatus | |
JP2913635B2 (en) | Drawing method in bitmap display system | |
JPS61267096A (en) | Smear drawing display unit for polygonal graphic | |
JP3154343B2 (en) | How to fill in polygonal shapes | |
JP3211591B2 (en) | Image processing device | |
JP2903514B2 (en) | High-speed drawing method | |
JP2007286942A (en) | Method for generating drawing data and data processor | |
JP4461965B2 (en) | CHARACTER IMAGE GENERATION DEVICE, CHARACTER IMAGE GENERATION PROGRAM, AND CHARACTER IMAGE GENERATION METHOD |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20060524 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20090202 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090210 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090408 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20090507 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20090520 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120612 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120612 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130612 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140612 Year of fee payment: 5 |
|
LAPS | Cancellation because of no payment of annual fees |