JP4983570B2 - Image processing apparatus and program - Google Patents
Image processing apparatus and program Download PDFInfo
- Publication number
- JP4983570B2 JP4983570B2 JP2007307006A JP2007307006A JP4983570B2 JP 4983570 B2 JP4983570 B2 JP 4983570B2 JP 2007307006 A JP2007307006 A JP 2007307006A JP 2007307006 A JP2007307006 A JP 2007307006A JP 4983570 B2 JP4983570 B2 JP 4983570B2
- Authority
- JP
- Japan
- Prior art keywords
- sprite
- pixels
- vertices
- rotation
- horizontal
- 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.)
- Active
Links
Images
Landscapes
- Processing Or Creating Images (AREA)
- Image Processing (AREA)
- Editing Of Facsimile Originals (AREA)
- Controls And Circuits For Display Device (AREA)
Description
この発明は、回転処理を伴う描画処理機能を備えた画像処理装置およびプログラムに関する。 The present invention relates to an image processing apparatus and a program provided with a drawing processing function involving rotation processing.
スプライトの画像をフレームメモリ内にマッピングする描画処理機能を備えた画像処理装置が知られている。この種の画像処理装置の中には、マッピングの際にスプライトの画像を回転させる機能を備えたものがある。図5は、従来技術の下で行われていたスプライトの回転処理の例を示すフローチャートである。 An image processing apparatus having a drawing processing function for mapping a sprite image in a frame memory is known. Some image processing apparatuses of this type have a function of rotating a sprite image during mapping. FIG. 5 is a flowchart showing an example of sprite rotation processing performed under the prior art.
この回転処理では、図6に示すスプライトの画素数SIZEXおよびSIZEYを用いる。ここで、画素数SIZEYは、表示画面を構成する画素平面上にスプライトを回転させないで投影した場合においてスプライトが占める領域のX方向(水平方向)の画素数、画素数SIZEYは同領域のY方向(垂直方向)の画素数である。そして、回転処理では、まず、X方向の画素数SIZEXが偶数か奇数かを判断する(ステップS1)。そして、画素数SIZEXが奇数である場合には、次式に従って、画素平面内におけるスプライトの頂点A、B、CおよびDの各X座標DAX、DBX、DCXおよびDDX(図6参照)を算出する(ステップS2)。
DAX=−SIZEX/2+0.5 ……(1)
DBX=−SIZEX/2+0.5 ……(2)
DCX= SIZEX/2−0.5 ……(3)
DDX= SIZEX/2−0.5 ……(4)
In this rotation processing, the sprite pixel numbers SIZEX and SIZEY shown in FIG. 6 are used. Here, the number of pixels SIZEY is the number of pixels in the X direction (horizontal direction) of the area occupied by the sprite when projected without rotating the sprite on the pixel plane constituting the display screen, and the number of pixels SIZEY is the Y direction of the area. This is the number of pixels in the (vertical direction). In the rotation process, first, it is determined whether the number of pixels SIZEX in the X direction is an even number or an odd number (step S1). When the number of pixels SIZEX is an odd number, the X coordinates DAX, DBX, DCX, and DDX (see FIG. 6) of the vertices A, B, C, and D of the sprite in the pixel plane are calculated according to the following equation. (Step S2).
DAX = -SIZE / 2 + 0.5 (1)
DBX = −SIZEX / 2 + 0.5 (2)
DCX = SIZE / 2−0.5 (3)
DDX = SIZEEX / 2-0.5 (4)
一方、画素数SIZEXが偶数である場合には、次式に従って、画素平面内におけるスプライトの頂点A、B、CおよびDの各X座標DAX、DBX、DCXおよびDDXを算出する(ステップS3)。
DAX=−SIZEX/2 ……(5)
DBX=−SIZEX/2 ……(6)
DCX= SIZEX/2−1 ……(7)
DDX= SIZEX/2−1 ……(8)
On the other hand, if the number of pixels SIZEX is an even number, the X coordinates DAX, DBX, DCX, and DDX of the vertices A, B, C, and D of the sprite in the pixel plane are calculated according to the following equation (step S3).
DAX = -SIZE / 2 (5)
DBX = −SIZEX / 2 (6)
DCX = SIZE / 2-1 (7)
DDX = SIZEEX / 2-1 (8)
次に、Y方向の画素数SIZEYが偶数か奇数かを判断する(ステップS4)。そして、画素数SIZEYが奇数である場合には、次式に従って、画素平面内におけるスプライトの頂点A、B、CおよびDの各Y座標DAY、DBY、DCYおよびDDYを算出する(ステップS5)。
DAY=−SIZEY/2+0.5 ……(9)
DBY= SIZEY/2−0.5 ……(10)
DCY= SIZEY/2−0.5 ……(11)
DDY=−SIZEY/2+0.5 ……(12)
Next, it is determined whether the number of pixels SIZEY in the Y direction is an even number or an odd number (step S4). If the number of pixels SIZEY is an odd number, the Y coordinates DAY, DBY, DCY, and DDY of the vertices A, B, C, and D of the sprite in the pixel plane are calculated according to the following equation (step S5).
DAY = −SIZE / 2 + 0.5 (9)
DBY = SIZE / 2-0.5 (10)
DCY = SIZE / 2−0.5 (11)
DDY = -SIZE / 2 + 0.5 (12)
一方、画素数SIZEYが偶数である場合には、次式に従って、画素平面内におけるスプライトの頂点A、B、CおよびDの各Y座標DAY、DBY、DCYおよびDDYを算出する(ステップS6)。
DAY=−SIZEY/2 ……(13)
DBY= SIZEY/2−1 ……(14)
DCY= SIZEY/2−1 ……(15)
DDY=−SIZEY/2 ……(16)
On the other hand, if the number of pixels SIZE is even, the Y coordinates DAY, DBY, DCY, and DDY of the vertices A, B, C, and D of the sprite in the pixel plane are calculated according to the following equation (step S6).
DAY = -SIZE / 2 (13)
DBY = SIZE / 2-1 (14)
DCY = SIZE / 2-1 (15)
DDY = -SIZE / 2 (16)
そして、このようにして求めたスプライトの4頂点のX座標およびY座標を用いて周知の回転アフィン変換を実行する(ステップS7)。具体的には、次式にスプライトの回転角度θと各頂点のX座標およびY座標を代入し、スプライトの回転後の各頂点の座標X’およびY’を算出する。
X’=X*COSθ+Y*SINθ ……(17)
Y’=Y*COSθ−X*SINθ ……(18)
Then, a known rotational affine transformation is executed using the X and Y coordinates of the four vertices of the sprite thus obtained (step S7). Specifically, the sprite rotation angle θ and the X and Y coordinates of each vertex are substituted into the following equation to calculate the coordinates X ′ and Y ′ of each vertex after the sprite is rotated.
X ′ = X * COSθ + Y * SINθ (17)
Y ′ = Y * COSθ−X * SINθ (18)
そして、画像処理装置は、マッピング処理等の後続の処理を実行する。ここで、マッピング処理では、表示画面を構成する画素平面内においてスプライトの4頂点の各位置が上述のようにして算出された各座標X’、Y’に対応した位置となるように、スプライトを画素平面に投影した場合において、スプライトの画像を構成することとなる画素平面内の画素を求め、それらの画素により回転後のスプライトの画像をリサンプリングした画像データをフレームメモリに書き込む。これにより回転後のスプライトの画像が表示装置に表示されることとなる。なお、回転アフィン変換を用いた画像の回転処理については例えば特許文献1に開示されている。
ところで、上述した従来の画像処理装置は、スプライトの水平方向および垂直方向の各画素数の少なくとも一方が偶数である場合に、回転に伴って、スプライトの回転対称の中心がずれ、あるいはスプライトの頂点の回転軌跡がぶれる、という問題があった。以下、図7を参照し、この問題について詳述する。 By the way, in the conventional image processing apparatus described above, when at least one of the number of pixels in the horizontal direction and the vertical direction of the sprite is an even number, the center of rotational symmetry of the sprite is shifted or the vertex of the sprite is accompanied by the rotation. There was a problem that the rotation trajectory was blurred. Hereinafter, this problem will be described in detail with reference to FIG.
まず、比較のため、スプライトの画素数SIZEXおよびSIZEYがいずれも奇数である場合について説明する。この場合、図5におけるステップS2およびS5が実行されるため、4頂点のX座標の絶対値が皆等しくなり、Y座標の絶対値も皆等しくなる。そして、このように4頂点の座標が決定されたスプライトの回転対称の中心Qは、図7(a)に例示するように、画素平面においてX方向およびY方向の各アドレスがいずれも0である画素O(0、0)の中心に位置することとなる。この回転対称の中心Qが画素O(0、0)の中心に配置されたスプライトの4頂点は、図7(b)に示すように、スプライトが回転すると、画素平面内において同一の円軌道に沿って移動する。このように、スプライトの画素数SIZEXおよびSIZEYがいずれも奇数である場合には、回転対称の中心のずれおよび回転軌跡のぶれの問題は生じない。 First, for comparison, a case will be described where both the sprite pixel numbers SIZEX and SIZEY are odd numbers. In this case, since steps S2 and S5 in FIG. 5 are executed, the absolute values of the X coordinates of the four vertices are all equal, and the absolute values of the Y coordinates are also equal. In addition, the rotationally symmetrical center Q of the sprites for which the coordinates of the four vertices are determined in this way is 0 in each address in the X direction and the Y direction on the pixel plane as illustrated in FIG. 7A. It is located at the center of the pixel O (0, 0). As shown in FIG. 7B, the four vertices of the sprite in which the center Q of the rotational symmetry is arranged at the center of the pixel O (0, 0) have the same circular orbit in the pixel plane as the sprite rotates. Move along. As described above, when the number of pixels of the sprite SIZEX and SIZEY is an odd number, the problem of the rotational symmetry center shift and the rotation locus blurring does not occur.
これに対し、例えばスプライトの画素数SIZEXおよびSIZEYがいずれも偶数である場合、図5におけるステップS3およびS6が実行されるため、頂点AおよびBのX座標の絶対値は頂点CおよびDのX座標の絶対値よりも「1」だけ大きくなり、頂点AおよびDのY座標の絶対値は頂点BおよびCのY座標の絶対値よりも「1」だけ大きくなる。そして、このように4頂点の座標が決定されたスプライトの回転対称の中心Qは、図7(c)に示すように、画素O(0、0)を他の画素から隔てる境界をなす矩形の左上の頂点に位置することとなる。このようにスプライトの回転対称の中心Qが画素の中心からずれた位置に配置されると、図7(d)に示すように、スプライトの回転処理により、スプライトの回転対称の中心Qは画素O(0、0)の中心廻りに回転し、回転対称の中心Qのずれの問題が生じる。また、4頂点のX座標の絶対値が不揃いとなり、Y座標の絶対値が不揃いとなるため、スプライトの回転処理により、スプライトの4頂点の回転軌跡のぶれの問題が生じる。 On the other hand, for example, when the number of sprite pixels SIZEX and SIZEY are both even numbers, steps S3 and S6 in FIG. 5 are executed, so that the absolute values of the X coordinates of the vertices A and B are X of the vertices C and D. The absolute value of the coordinates is larger by “1”, and the absolute values of the Y coordinates of the vertices A and D are larger by “1” than the absolute values of the Y coordinates of the vertices B and C. Then, the rotationally symmetrical center Q of the sprites whose coordinates of the four vertices are determined in this way is a rectangular shape that forms a boundary separating the pixel O (0, 0) from other pixels as shown in FIG. 7C. It will be located at the top left vertex. When the rotationally symmetrical center Q of the sprite is arranged at a position shifted from the center of the pixel in this way, as shown in FIG. Rotation around the center of (0, 0) causes a problem of deviation of the rotationally symmetrical center Q. In addition, since the absolute values of the X coordinates of the four vertices are not uniform and the absolute values of the Y coordinates are not uniform, the sprite rotation process causes a problem of fluctuation of the rotation trajectory of the four vertices of the sprite.
スプライトの画素数SIZEXおよびSIZEYの一方が偶数である場合も同様である。この場合も4頂点のX座標の絶対値またはY座標の絶対値の一方が不揃いとなる。従って、スプライトは、回転対称の中心Qを画素O(0、0)の中心に対して偏心させた状態で回転する。より具体的には、スプライトの回転対称の中心Qは、画素O(0、0)の中心の廻りに半径0.5画素ピッチの円軌道を描いて回転することとなり、回転対称の中心Qのずれの問題が生じる。また、スプライトの4頂点のX座標の絶対値またはY座標の絶対値の一方が不揃いであるため、スプライトの4頂点の回転軌跡のぶれの問題が生じる。 The same applies when one of the sprite pixel numbers SIZEX and SIZEY is an even number. Also in this case, one of the absolute values of the X coordinates and the Y coordinates of the four vertices is not uniform. Therefore, the sprite rotates in a state where the rotationally symmetrical center Q is decentered with respect to the center of the pixel O (0, 0). More specifically, the rotationally symmetrical center Q of the sprite is rotated by drawing a circular orbit having a radius of 0.5 pixel pitch around the center of the pixel O (0, 0). A problem of misalignment occurs. In addition, since one of the absolute values of the X coordinate and the Y coordinate of the four vertices of the sprite is not uniform, there is a problem of blurring of the rotation locus of the four vertices of the sprite.
この発明は、以上説明した事情に鑑みてなされたものであり、回転処理を伴うスプライトの描画処理において、スプライトの回転対称の中心のずれおよび頂点の回転軌跡のぶれを少なくする技術的手段を提供することを目的としている。 The present invention has been made in view of the circumstances described above, and provides technical means for reducing the sprite's rotational symmetry center shift and blurring of the vertex's rotational trajectory in sprite drawing processing involving rotation processing. The purpose is to do.
この発明は、処理対象であるスプライトの水平方向および垂直方向の各画素数に基づき、前記スプライトの回転対称の中心を基準とした前記スプライトの4頂点の水平方向および垂直方向の各座標を算出する画素数/座標変換手段と、前記画素数/座標変換手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標を用いて、前記回転対称の中心廻りに前記スプライトを回転させた場合の前記スプライトの4頂点の水平方向および垂直方向の各座標を算出する回転処理手段と、前記回転処理手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標から画素平面における回転後のスプライトの4頂点の水平方向および垂直方向の座標を算出する手段であって、その算出過程において、前記スプライトの水平方向の画素数の奇/偶および垂直方向の画素数の奇/偶の組み合わせに応じて、前記回転後のスプライトの回転に伴う回転対称の中心のずれを少なくする座標補正処理を前記回転処理手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標に施す座標補正手段と、前記画素平面内において前記スプライトの4頂点の各位置が前記座標補正手段により得られた回転後のスプライトの4頂点の各座標に対応した位置となるように、前記スプライトを前記画素平面に投影した場合において、前記スプライトの画像を構成することとなる前記画素平面内の画素を求め、それらの画素により前記スプライトの画像を示す画像データをメモリに書き込むマッピング処理手段とを具備することを特徴とする画像処理装置およびコンピュータを上記各手段として機能させるプログラムを提供する。 The present invention calculates the horizontal and vertical coordinates of the four vertices of the sprite based on the rotational symmetry center of the sprite based on the number of pixels in the horizontal and vertical directions of the sprite to be processed. The sprite was rotated around the rotationally symmetric center using the horizontal / vertical coordinates of the four vertices of the sprite obtained by the number of pixels / coordinate conversion means and the number of pixels / coordinate conversion means. Rotation processing means for calculating the horizontal and vertical coordinates of the four vertices of the sprite in the case, and in the pixel plane from the horizontal and vertical coordinates of the four vertices of the sprite obtained by the rotation processing means. Means for calculating the horizontal and vertical coordinates of the four vertices of the sprite after rotation; The coordinate correction processing for reducing the rotation of the center of rotational symmetry accompanying the rotation of the sprite after the rotation according to the combination of the odd / even number of pixels in the horizontal direction and the odd / even number of pixels in the vertical direction. Coordinate correction means applied to the horizontal and vertical coordinates of the four vertices of the sprite obtained by the processing means, and the rotation obtained by the coordinate correction means for each position of the four vertices of the sprite in the pixel plane When the sprite is projected onto the pixel plane so as to correspond to the coordinates of the four vertices of the later sprite, pixels in the pixel plane that will form the image of the sprite are obtained. And a mapping processing means for writing image data indicating the image of the sprite into a memory by using the pixels. The computer provides a program to function as the respective means.
かかる発明によれば、画素数/座標変換手段により得られるスプライトの4頂点の水平方向の座標の絶対値が揃い、かつ、垂直方向の座標の絶対値が揃うので、スプライトの回転の際にスプライトの4頂点の回転軌跡のぶれをなくすことができる。また、回転処理手段により得られたスプライトの4頂点の水平方向および垂直方向の座標に対し、スプライトの水平方向の画素数の奇/偶および垂直方向の画素数の奇/偶の組み合わせに応じて、回転後のスプライトの回転対称の中心のずれを少なくする座標補正処理が実行される。従って、スプライトの回転に伴う回転対称の中心のずれを少なくすることができる。 According to this invention, since the absolute values of the horizontal coordinates of the four vertices of the sprite obtained by the number of pixels / coordinate conversion means are aligned and the absolute values of the coordinates of the vertical direction are aligned, the sprite is rotated when the sprite is rotated. It is possible to eliminate the fluctuation of the rotation locus of the four vertices. Further, with respect to the horizontal and vertical coordinates of the four vertices of the sprite obtained by the rotation processing means, depending on the combination of the odd / even number of pixels in the horizontal direction of the sprite and the odd / even number of pixels in the vertical direction. Then, coordinate correction processing for reducing the shift of the rotationally symmetric center of the sprite after rotation is executed. Therefore, it is possible to reduce the shift of the rotationally symmetric center accompanying the rotation of the sprite.
以下、図面を参照し、この発明の実施の形態を説明する。
図1は、この発明の一実施形態である画像処理装置の構成を示すブロック図である。図1に示すように、本実施形態における画像処理装置は、CPU1と、スプライトメモリ2と、描画処理部3と、フレームメモリ6と、表示制御部7と、表示装置8とを有している。ここで、フレームメモリ6は、表示装置8に表示する画像データを記憶するメモリであり、RAM等により構成されている。表示制御部7は、一定時間長の垂直走査周期毎にフレームメモリ6に記憶された画像データを表示装置8に表示する制御を繰り返す。表示装置8は、例えば液晶パネルとその駆動装置により構成されている。
Embodiments of the present invention will be described below with reference to the drawings.
FIG. 1 is a block diagram showing a configuration of an image processing apparatus according to an embodiment of the present invention. As shown in FIG. 1, the image processing apparatus according to the present embodiment includes a
スプライトメモリ2は、ゲームのキャラクタ等のスプライトの画像データを記憶するメモリであり、例えばROMにより構成されている。描画処理部3は、CPU1からの指示に従い、スプライトメモリ2に記憶されたスプライトの画像データをフレームメモリ6内の表示対象の画像データに反映させる描画処理を実行する装置である。
The
本実施形態における描画処理部3は、CPU1からの指示に従い、スプライトを回転させ、その画像データをフレームメモリ6に書き込む回転処理機能を備えている。そして、描画処理部3は、この回転処理機能を実現するための手段として、座標演算部4とマッピング処理部5とを有する。
The
ここで、座標演算部4は、描画対象であるスプライトのX方向の画素数SIZEX、Y方向の画素数YSIZEYおよび回転角度θに関する指示をCPU1から受け取り、画素平面内においてスプライトを角度θだけ回転させた場合の4頂点A、B、CおよびDのX、Y座標を算出する手段である。
Here, the coordinate
マッピング処理部5は、マッピング処理を実行する手段である。このマッピング処理において、マッピング処理部5は、描画対象であるスプライトの画像データのスプライトメモリ2内でのアドレスと画素平面内におけるスプライトの位置を指示する配置情報(例えばスプライトの中心の位置)をCPU1から受け取るとともに、回転後のスプライトの4頂点の画素平面内でのX、Y座標を座標演算部4から受け取る。そして、マッピング処理部5は、スプライトの4頂点の各位置が座標演算部4によって算出されたX、Y座標に対応した各位置となるように、回転後のスプライトを画素平面に投影した場合において、スプライトの画像を構成することとなる画素平面内の各画素を求める。そして、スプライトメモリ2から描画対象であるスプライトの画像データを読み出し、この画像データを用いて、回転後のスプライトの画像を構成する画素平面内の各画素の画像データを算出し、かつ、CPU1からの配置情報が示す位置をスプライトが占めるようにこの画像データの位置調整を行い、位置調整後の画像データをフレームメモリに書き込む。
The
本実施形態において、座標演算部4は、画素数/座標変換部41と、回転処理部42と、座標補正部43とを有する。図2は、この座標演算部4の各部が実行する処理内容を示す図である。
In the present embodiment, the coordinate
画素数/座標変換部41は、図2に示す画素数/座標変換処理を実行する。この画素数/座標変換処理では、処理対象であるスプライトのX方向およびY方向の各画素数SIZEXおよびSIZEYを用い、スプライトの回転対称の中心Qを画素平面内においてX方向のアドレスおよびY方向のアドレスがいずれも0である画素O(0、0)の中心に位置させた場合のスプライトの4頂点A、B、C、DのX方向の各座標DAX、DBX、DCXおよびDDXとY方向の各座標DAY、DBY、DCYおよびDDYを次式により算出する。
DAX=−SIZEX/2+0.5 ……(19)
DAY=−SIZEY/2+0.5 ……(20)
DBX=−SIZEX/2+0.5 ……(21)
DBY= SIZEY/2−0.5 ……(22)
DCX= SIZEX/2−0.5 ……(23)
DCY= SIZEY/2−0.5 ……(24)
DDX= SIZEX/2−0.5 ……(25)
DDY=−SIZEY/2+0.5 ……(26)
The pixel number / coordinate
DAX = -SIZE / 2 + 0.5 (19)
DAY = -SIZE / 2 + 0.5 (20)
DBX = −SIZEX / 2 + 0.5 (21)
DBY = SIZE / 2-0.5 (22)
DCX = SIZE / 2−0.5 (23)
DCY = SIZEY / 2-0.5 (24)
DDX = SIZEX / 2-0.5 (25)
DDY = -SIZE / 2 + 0.5 (26)
回転処理部42は、図2に示す回転処理を実行する。この回転処理では、画素数/座標変換処理により得られたスプライトの4頂点のX方向の各座標DAX、DBX、DCXおよびDDXとY方向の各座標DAY、DBY、DCYおよびDDYを用い、画素O(0、0)の中心廻りにスプライトを角度θだけ回転させた場合のスプライトの4頂点のX方向の各座標DAX_ROT、DBX_ROT、DCX_ROTおよびDDX_ROTとY方向の各座標DAY_ROT、DBY_ROT、DCY_ROTおよびDDY_ROTを次の回転アフィン変換式に従って算出する。
DAX_ROT= DAX・COSθ+DAY・SINθ ……(27)
DAY_ROT= DAY・COSθ−DAX・SINθ ……(28)
DBX_ROT= DBX・COSθ+DBY・SINθ ……(29)
DBY_ROT= DBY・COSθ−DBX・SINθ ……(30)
DCX_ROT= DCX・COSθ+DCY・SINθ ……(31)
DCY_ROT= DCY・COSθ−DCX・SINθ ……(32)
DDX_ROT= DDX・COSθ+DDY・SINθ ……(33)
DDY_ROT= DDY・COSθ−DDX・SINθ ……(34)
The
DAX_ROT = DAX / COSθ + DAY / SINθ (27)
DAY_ROT = DAY · COSθ−DAX · SINθ (28)
DBX_ROT = DBX · COSθ + DBY · SINθ (29)
DBY_ROT = DBY · COSθ−DBX · SINθ (30)
DCX_ROT = DCX · COSθ + DCY · SINθ (31)
DCY_ROT = DCY · COSθ−DCX · SINθ (32)
DDX_ROT = DDX · COSθ + DDY · SINθ (33)
DDY_ROT = DDY · COSθ−DDX · SINθ (34)
座標補正部43は、図2に示す座標補正処理を実行する。この座標補正処理では、回転処理により得られたスプライトの4頂点のX方向の各座標DAX_ROT、DBX_ROT、DCX_ROTおよびDDX_ROTとY方向の各座標DAY_ROT、DBY_ROT、DCY_ROTおよびDDY_ROTから画素平面における回転後のスプライトの4頂点のX方向の各座標DAX_ROT’、DBX_ROT’、DCX_ROT’およびDDX_ROT’とY方向の各座標DAY_ROT’、DBY_ROT’、DCY_ROT’およびDDY_ROT’を算出する。その際、座標補正処理では、X方向の画素数SIZEXの奇/偶およびY方向の画素数SIZEYの奇/偶の組み合わせに応じて、スプライトの回転に伴う回転対称の中心Qのずれを少なくするための補正を、回転処理により得られたスプライトの4頂点のX方向の各座標DAX_ROT、DBX_ROT、DCX_ROTおよびDDX_ROTとY方向の各座標DAY_ROT、DBY_ROT、DCY_ROTおよびDDY_ROTに施す。
The coordinate
具体的には、X方向の画素数SIZEXおよびY方向の画素数SIZEYがいずれも奇数である場合には、X方向の補正値ROT_ADJXおよびY方向の補正値ROT_ADJYをいずれも0とする。また、X方向の画素数SIZEXおよびY方向の画素数SIZEYがいずれも偶数である場合には、X方向の補正値ROT_ADJXおよびY方向の補正値ROT_ADJYをいずれも0.5とする。また、X方向の画素数SIZEXが奇数であり、Y方向の画素数SIZEYが偶数である場合には、X方向の補正値ROT_ADJXはSINθ/2の絶対値Abs(SINθ)/2とし、Y方向の補正値ROT_ADJYはCOSθ/2の絶対値Abs(COSθ)/2とする。また、X方向の画素数SIZEXが偶数であり、Y方向の画素数SIZEYが奇数である場合には、X方向の補正値ROT_ADJXはAbs(COSθ)/2とし、Y方向の補正値ROT_ADJYはAbs(SINθ)/2とするのである。 Specifically, when the number of pixels in the X direction SIZEX and the number of pixels in the Y direction SIZEY are both odd numbers, the correction value ROT_ADJX in the X direction and the correction value ROT_ADJY in the Y direction are both set to zero. When the number of pixels in the X direction SIZEX and the number of pixels in the Y direction SIZEY are both even numbers, the correction value ROT_ADJX in the X direction and the correction value ROT_ADJY in the Y direction are both set to 0.5. Further, when the number of pixels in the X direction SIZEX is an odd number and the number of pixels in the Y direction SIZEY is an even number, the correction value ROT_ADJX in the X direction is set to the absolute value Abs (SINθ) / 2 of SINθ / 2, and the Y direction The correction value ROT_ADJY is an absolute value Abs (COSθ) / 2 of COSθ / 2. Further, when the number of pixels in the X direction SIZEX is an even number and the number of pixels in the Y direction SIZEY is an odd number, the correction value ROT_ADJX in the X direction is Abs (COSθ) / 2, and the correction value ROT_ADJY in the Y direction is Abs. (SINθ) / 2.
そして、座標補正処理では、次式に従い、画素平面内における回転後のスプライトの4頂点のX方向の各座標DAX_ROT’、DBX_ROT’、DCX_ROT’およびDDX_ROT’とY方向の各座標DAY_ROT’、DBY_ROT’、DCY_ROT’およびDDY_ROT’を算出する。
DAX_ROT’=DAX_ROT−ROT_ADJX ……(35)
DAY_ROT’=DAY_ROT−ROT_ADJY ……(36)
DBX_ROT’=DBX_ROT−ROT_ADJX ……(37)
DBY_ROT’=DBY_ROT−ROT_ADJY ……(38)
DCX_ROT’=DCX_ROT−ROT_ADJX ……(39)
DCY_ROT’=DCY_ROT−ROT_ADJY ……(40)
DDX_ROT’=DDX_ROT−ROT_ADJX ……(41)
DDY_ROT’=DDY_ROT−ROT_ADJY ……(42)
In the coordinate correction process, the X-direction coordinates DAX_ROT ′, DBX_ROT ′, DCX_ROT ′ and DDX_ROT ′ of the four vertices of the sprite after rotation in the pixel plane and the Y-direction coordinates DAY_ROT ′ and DBY_ROT ′ are determined according to the following formula. , DCY_ROT ′ and DDY_ROT ′ are calculated.
DAX_ROT '= DAX_ROT-ROT_ADJX (35)
DAY_ROT '= DAY_ROT-ROT_ADJY (36)
DBX_ROT ′ = DBX_ROT−ROT_ADJX (37)
DBY_ROT ′ = DBY_ROT−ROT_ADJY (38)
DCX_ROT ′ = DCX_ROT−ROT_ADJX (39)
DCY_ROT ′ = DCY_ROT−ROT_ADJY (40)
DDX_ROT ′ = DDX_ROT−ROT_ADJX (41)
DDY_ROT ′ = DDY_ROT−ROT_ADJY (42)
マッピング処理部5は、このようにして得られた補正後におけるスプライトの4頂点のX、Y座標を用いて、上述したマッピング処理を実行する。以上が本実施形態による画像処理装置の詳細である。
The
次に具体例を挙げ、本実施形態の動作を説明する。図3は、スプライトのX方向の画素数SIZEXが偶数2m(mは整数)であり、Y方向の画素数SIZEYが偶数2n(nは整数)である場合の本実施形態の動作を、図4は、スプライトのX方向の画素数SIZEXが偶数2m(mは整数)であり、Y方向の画素数SIZEYが奇数2n+1(nは整数)である場合の本実施形態の動作を示している。さらに詳述すると、図3(a)、(b)、(c)および(d)と図4(a)、(b)、(c)および(d)は、本実施形態において回転角度θが0°、90°、180°および270°の各場合における座標補正処理後のスプライトの画素平面内での位置を示している。また、図3(a)’、(b)’、(c)’および(d)’と図4(a)’、(b)’、(c)’および(d)’において、破線により示す図形は回転処理後、座標補正処理前のスプライトの画素平面内での位置を示している。なお、図3(a)’、(b)’、(c)’および(d)’等では、座標補正処理前後におけるスプライトの位置の移動を分かりやすくするため、座標補正処理後のスプライトが実線により示されている。 Next, a specific example is given and operation | movement of this embodiment is demonstrated. FIG. 3 shows the operation of this embodiment when the number of pixels SIZEX in the X direction of the sprite is an even number 2m (m is an integer) and the number of pixels SIZE in the Y direction is an even number 2n (n is an integer). Shows the operation of the present embodiment when the number of pixels in the X direction SIZEX is an even number 2m (m is an integer) and the number of pixels SIZEY in the Y direction is an odd number 2n + 1 (n is an integer). More specifically, FIGS. 3 (a), (b), (c) and (d) and FIGS. 4 (a), (b), (c) and (d) show that the rotation angle θ in this embodiment is The position in the pixel plane of the sprite after the coordinate correction process in each case of 0 °, 90 °, 180 °, and 270 ° is shown. 3 (a) ′, (b) ′, (c) ′ and (d) ′ and FIGS. 4 (a) ′, (b) ′, (c) ′ and (d) ′, they are indicated by broken lines. The figure shows the position of the sprite in the pixel plane after the rotation process and before the coordinate correction process. In FIGS. 3A ', (b)', (c) ', and (d)', etc., the sprite after the coordinate correction processing is shown as a solid line in order to make the movement of the sprite position before and after the coordinate correction processing easier to understand. Is indicated by
画素数SIZEXおよびSIZEYの両方が偶数であり、SIZEX=2m、SIZEY=2nであると、画素数/座標変換処理では、上記式(19)〜(26)にSIZEXおよびSIZEYを代入して得られる4頂点のX座標の絶対値がいずれもm−0.5となり、4頂点のY座標の絶対値がいずれもn−0.5となる。このようにして算出される4頂点の座標は、図3(a)’に示すように、スプライトの回転対称の中心Qを画素平面における画素O(0、0)の中心に位置させたときのスプライトの4頂点の座標に相当する。本実施形態における回転処理では、このようにスプライトの回転対称の中心Qを画素O(0、0)の中心に位置させて角度θだけスプライトを回転させた場合において、画素O(0、0)の中心から見た4頂点のX方向の各座標DAX_ROT、DBX_ROT、DCX_ROTおよびDDX_ROTとY方向の各座標DAY_ROT、DBY_ROT、DCY_ROTおよびDDY_ROTが算出される。 If both the number of pixels SIZEX and SIZEY are even numbers, SIZEX = 2m, and SIZEY = 2n, the number of pixels / coordinate conversion process is obtained by substituting SIZEX and SIZEEY into the above formulas (19) to (26). The absolute values of the X coordinates of the four vertices are all m-0.5, and the absolute values of the Y coordinates of the four vertices are all n-0.5. The coordinates of the four vertices calculated in this way are obtained when the center Q of the sprite's rotational symmetry is positioned at the center of the pixel O (0, 0) in the pixel plane, as shown in FIG. It corresponds to the coordinates of the four vertices of the sprite. In the rotation processing in the present embodiment, when the sprite rotationally symmetrical center Q is positioned at the center of the pixel O (0,0) and the sprite is rotated by the angle θ, the pixel O (0,0) The coordinates DAX_ROT, DBX_ROT, DCX_ROT and DDX_ROT in the X direction and the coordinates DAY_ROT, DBY_ROT, DCY_ROT and DDY_ROT in the Y direction of the four vertices viewed from the center of the image are calculated.
そして、座標補正処理では、X方向の補正値ROT_ADJXおよびY方向の補正値ROT_ADJYがいずれも0.5とされる。そして、前掲式(35)〜(42)の演算により、補正後の4頂点のX方向の各座標DAX_ROT’、DBX_ROT’、DCX_ROT’およびDDX_ROT’とY方向の各座標DAY_ROT’、DBY_ROT’、DCY_ROT’およびDDY_ROT’が算出される。 In the coordinate correction process, both the X-direction correction value ROT_ADJX and the Y-direction correction value ROT_ADJY are set to 0.5. Then, the X-direction coordinates DAX_ROT ′, DBX_ROT ′, DCX_ROT ′ and DDX_ROT ′ and the Y-direction coordinates DAY_ROT ′, DBY_ROT ′, DCY_ROT of the four vertices after correction are calculated by the calculations of the above equations (35) to (42). 'And DDY_ROT' are calculated.
これらの4頂点の座標は、図3(a)〜(d)に示すように、画素平面内において原点の画素O(0、0)を他の画素から隔てる境界である矩形の左上の頂点にスプライトの回転対称の中心Qを位置させたときのスプライトの4頂点の座標となる。なお、図3(a)〜(d)には、回転角度θが0°、90°、180°、270°の各場合におけるスプライトの配置状態が示されているが、他の回転角度の場合も同様であり、前掲式(35)〜(42)の演算により得られる4頂点の座標は、原点の画素O(0、0)を他の画素から隔てる境界である矩形の左上の頂点にスプライトの回転対称の中心Qを位置させたときのスプライトの4頂点の座標となる。 As shown in FIGS. 3A to 3D, the coordinates of these four vertices are the upper left vertex of a rectangle that is a boundary separating the origin pixel O (0, 0) from other pixels in the pixel plane. This is the coordinates of the four vertices of the sprite when the rotationally symmetrical center Q of the sprite is positioned. FIGS. 3A to 3D show the sprite arrangement state in each of the rotation angles θ of 0 °, 90 °, 180 °, and 270 °, but in the case of other rotation angles. The coordinates of the four vertices obtained by the calculations of the above equations (35) to (42) are sprites at the upper left vertex of the rectangle that is the boundary separating the origin pixel O (0, 0) from other pixels. Are the coordinates of the four vertices of the sprite when the rotationally symmetrical center Q is located.
以上のように、本実施形態において画素数SIZEXおよびSIZEYの両方が偶数である場合には、画素平面において画素O(0、0)を他の画素から隔てる境界である矩形の左上の頂点に常に回転対称の中心Qを位置させて、スプライトを回転させることができる。従って、スプライトの回転時に、回転対称の中心のぶれがなく、回転軌跡がぶれることもない。 As described above, in the present embodiment, when both the number of pixels SIZEX and SIZEY are an even number, the pixel plane always has an upper left vertex of a rectangle that is a boundary separating the pixel O (0, 0) from other pixels. The sprite can be rotated by positioning the rotationally symmetrical center Q. Therefore, when the sprite is rotated, there is no shake at the center of rotational symmetry, and the rotation locus is not shaken.
次にX方向の画素数SIZEXが偶数2mであり、Y方向の画素数SIZEYが奇数2n+1である場合について説明する。この場合、画素数/座標変換処理、回転処理の内容は、画素数SIZEXおよびSIZEYの両方が偶数である場合と基本的に同様である。すなわち、画素数/座標変換処理および回転処理を経ることにより、スプライトの回転対称の中心Qを画素O(0、0)の中心に位置させて角度θだけスプライトを回転させた場合において、画素O(0、0)の中心から見た4頂点のX方向の各座標DAX_ROT、DBX_ROT、DCX_ROTおよびDDX_ROTとY方向の各座標DAY_ROT、DBY_ROT、DCY_ROTおよびDDY_ROTが得られる。 Next, a case where the number of pixels in the X direction SIZEX is an even number 2m and the number of pixels in the Y direction SIZEY is an odd number 2n + 1 will be described. In this case, the contents of the pixel number / coordinate conversion process and the rotation process are basically the same as the case where both the pixel numbers SIZEX and SIZEY are even numbers. That is, when the sprite is rotated by the angle θ by positioning the center Q of the rotational symmetry of the sprite at the center of the pixel O (0, 0) through the pixel number / coordinate conversion process and the rotation process, the pixel O The coordinates DAX_ROT, DBX_ROT, DCX_ROT and DDX_ROT in the X direction of the four vertices viewed from the center of (0, 0) and the coordinates DAY_ROT, DBY_ROT, DCY_ROT and DDY_ROT in the Y direction are obtained.
しかし、X方向の画素数SIZEXが偶数2mであり、Y方向の画素数SIZEYが奇数2n+1である場合、座標補正処理の態様は、画素数SIZEXおよびSIZEYの両方が偶数である場合とは異なったものとなる。さらに詳述すると次の通りである。 However, when the number of pixels SIZEX in the X direction is an even number 2m and the number of pixels SIZEY in the Y direction is an odd number 2n + 1, the mode of coordinate correction processing is different from the case where both the number of pixels SIZEX and SIZEY are even numbers. It will be a thing. Further details are as follows.
まず、画素数SIZEXおよびSIZEYの両方が偶数である場合、如何なる回転角度θにおいても、回転後のスプライトの回転対称の中心Qは、画素O(0、0)を他の画素から隔てる境界をなす矩形の左上の頂点に位置する(図3(a)〜(d)参照)。 First, when both the number of pixels SIZEX and SIZEY are even numbers, the rotationally symmetrical center Q of the sprite after rotation forms a boundary that separates the pixel O (0, 0) from other pixels at any rotation angle θ. It is located at the top left corner of the rectangle (see FIGS. 3A to 3D).
これに対し、X方向の画素数SIZEXが偶数であり、Y方向の画素数SIZEYが奇数である場合には、回転後のスプライトの回転対称の中心Qがとるべき位置は回転角度θにより異なったものとなる。例えば回転角度θが0°および180°の各場合、回転後のスプライトの回転対称の中心Qは、図4(a)および(c)に示すように、画素平面内において画素O(0、0)を他の画素から隔てる境界である矩形の左辺中央の点に位置する必要がある。また、回転角度θが90°および270°の各場合、回転後のスプライトの回転対称の中心Qは、図4(b)および(d)に示すように、画素平面内において画素O(0、0)を他の画素から隔てる境界である矩形の上辺中央の点に位置する必要がある。 On the other hand, when the number of pixels SIZEX in the X direction is an even number and the number of pixels SIZEY in the Y direction is an odd number, the position of the rotational symmetry center Q of the sprite after rotation differs depending on the rotation angle θ. It will be a thing. For example, when the rotation angle θ is 0 ° and 180 °, the rotationally symmetrical center Q of the sprite after rotation is the pixel O (0, 0) in the pixel plane as shown in FIGS. ) Must be positioned at the center point of the left side of the rectangle, which is the boundary separating the other pixels. In each of the rotation angles θ of 90 ° and 270 °, the rotationally symmetrical center Q of the sprite after rotation is the pixel O (0, 0, 0 in the pixel plane as shown in FIGS. 4B and 4D. 0) must be located at the center point of the upper side of the rectangle which is the boundary separating the other pixels.
これは、回転を伴わないスプライトの描画処理では、X方向の画素数SIZEXが偶数であり、かつ、Y方向の画素数SIZEYが奇数であるスプライトは図4(a)および(c)に示すように画素平面上に配置し、X方向の画素数SIZEXが奇数であり、かつ、Y方向の画素数SIZEYが偶数であるスプライトは図4(b)および(d)に示すように画素平面上に配置するので、回転を伴うスプライトの描画処理でもスプライトの回転対称の中心Qの配置方法をこれに合わせるためである。このようにスプライトの回転対称の中心Qの配置方法を回転を伴わないスプライトの描画処理と回転を伴うスプライトの描画処理とで同じにしておくことにより、幾つかの利点が得られる。まず、回転を伴う描画処理により画素平面上に配置されるスプライトと、回転を伴わない描画処理により画素平面上に配置されるスプライトとが混在する場合に、両スプライトの位置関係を意図したものにするのが容易になる。また、スプライトが回転していない状態から回転を開始するような場合の描画を行う場合に、スプライトの回転開始の際にスプライトの位置が不連続に変化するのを回避することができる。 This is because, in sprite rendering processing without rotation, sprites having an even number of pixels in the X direction SIZEX and an odd number of pixels in the Y direction SIZEY are shown in FIGS. 4 (a) and 4 (c). Are arranged on the pixel plane, and the sprite having the odd number of pixels SIZEX in the X direction and the even number of pixels SIZEY in the Y direction is arranged on the pixel plane as shown in FIGS. 4B and 4D. This is because the arrangement method of the center Q of the rotational symmetry of the sprite is matched with the drawing process of the sprite accompanying the rotation. As described above, by arranging the sprite rotationally symmetrical center Q in the same manner for the sprite drawing processing without rotation and the sprite drawing processing with rotation, several advantages can be obtained. First, when a sprite placed on the pixel plane by a drawing process with rotation and a sprite placed on the pixel plane by a drawing process without rotation are mixed, the positional relationship between both sprites is intended. Easy to do. In addition, when drawing is performed when rotation starts from a state in which the sprite is not rotating, it is possible to avoid a discontinuous change in the position of the sprite when the sprite starts rotating.
以上のような理由により、X方向の画素数SIZEXが偶数であり、Y方向の画素数SIZEYが奇数である場合には、回転後のスプライトの回転対称の中心Qがとるべき位置は回転角度θにより異なったものとなる。従って、この場合の座標補正処理では、補正量ROT_ADJXおよびROT_ADJYは、回転角度θに応じて変化させる。具体的にはX方向の補正値ROT_ADJXはAbs(COSθ)/2とされ、Y方向の補正値ROT_ADJYはAbs(SINθ)/2とされ、前掲式(35)〜(42)の演算により、補正後の4頂点のX方向の各座標DAX_ROT’、DBX_ROT’、DCX_ROT’およびDDX_ROT’とY方向の各座標DAY_ROT’、DBY_ROT’、DCY_ROT’およびDDY_ROT’が算出される。 For the above reasons, when the number of pixels SIZEX in the X direction is an even number and the number of pixels SIZEY in the Y direction is an odd number, the position that the rotational symmetry center Q of the sprite after rotation should take is the rotation angle θ. It will be different. Therefore, in the coordinate correction process in this case, the correction amounts ROT_ADJX and ROT_ADJY are changed according to the rotation angle θ. Specifically, the correction value ROT_ADJX in the X direction is Abs (COSθ) / 2, and the correction value ROT_ADJY in the Y direction is Abs (SINθ) / 2, and is corrected by the calculations of the above equations (35) to (42). The coordinates DAX_ROT ′, DBX_ROT ′, DCX_ROT ′ and DDX_ROT ′ in the X direction of the subsequent four vertices and the coordinates DAY_ROT ′, DBY_ROT ′, DCY_ROT ′ and DDY_ROT ′ in the Y direction are calculated.
ここで、θ=0°、90°、180°、270°の各場合について、補正値ROT_ADJX=Abs(COSθ)/2と、補正値ROT_ADJY=Abs(SINθ)/2を計算すると、次のようになる。
θ=0° ROT_ADJX=0.5 ROT_ADJY=0
θ=90° ROT_ADJX=0 ROT_ADJY=0.5
θ=180° ROT_ADJX=0.5 ROT_ADJY=0
θ=270° ROT_ADJX=0 ROT_ADJY=0.5
Here, for each of θ = 0 °, 90 °, 180 °, and 270 °, the correction value ROT_ADJX = Abs (COSθ) / 2 and the correction value ROT_ADJY = Abs (SINθ) / 2 are calculated as follows. become.
θ = 0 ° ROT_ADJX = 0.5 ROT_ADJY = 0
θ = 90 ° ROT_ADJX = 0 ROT_ADJY = 0.5
θ = 180 ° ROT_ADJX = 0.5 ROT_ADJY = 0
θ = 270 ° ROT_ADJX = 0 ROT_ADJY = 0.5
従って、座標補正処理により得られたX方向の各座標DAX_ROT’、DBX_ROT’、DCX_ROT’およびDDX_ROT’とY方向の各座標DAY_ROT’、DBY_ROT’、DCY_ROT’およびDDY_ROT’が示す各位置にスプライトの4頂点を位置させると、θ=0°、90°、180°、270°の各場合のスプライトの配置は図4(a)、(b)、(c)、(d)に示すものとなる。 Accordingly, the X-direction coordinates DAX_ROT ′, DBX_ROT ′, DCX_ROT ′ and DDX_ROT ′ obtained by the coordinate correction processing and the Y-direction coordinates DAY_ROT ′, DBY_ROT ′, DCY_ROT ′ and DDY_ROT ′ indicate four positions of the sprite. When the vertex is positioned, the sprite arrangement in each case of θ = 0 °, 90 °, 180 °, and 270 ° is as shown in FIGS. 4 (a), 4 (b), 4 (c), and 4 (d).
また、0°、90°、180°、270°以外の回転角度θにおけるスプライトの配置は、θ=0°、90°、180°、270°の各場合のスプライトの配置との連続性が保たれたものとなる。 In addition, the sprite arrangement at rotation angles θ other than 0 °, 90 °, 180 °, and 270 ° maintains continuity with the sprite arrangement in each of θ = 0 °, 90 °, 180 °, and 270 °. It will be drunk.
まず、回転角度θが0°から90°まで変化する場合には、X方向の補正値ROT_ADJX=Abs(COSθ)/2は、角度θの増加に応じて0.5から0まで余弦曲線を描いて連続的に減少し、Y方向の補正値ROT_ADJY=Abs(SINθ)/2は、角度θの増加に応じて0から0.5まで正弦曲線を描いて連続的に増加する。このため、スプライトの回転対称の中心Qの位置は、回転角度θが0°から90°まで変化する間、画素O(0、0)の中心廻りの半径0.5画素ピッチの円周に沿って、画素O(0、0)の他の画素との境界である矩形の左辺中央から上辺中央に移動する。 First, when the rotation angle θ changes from 0 ° to 90 °, the correction value ROT_ADJX = Abs (COSθ) / 2 in the X direction draws a cosine curve from 0.5 to 0 as the angle θ increases. The correction value ROT_ADJY = Abs (SINθ) / 2 in the Y direction continuously increases in a sine curve from 0 to 0.5 as the angle θ increases. For this reason, the position of the rotationally symmetrical center Q of the sprite is along the circumference of the radius 0.5 pixel pitch around the center of the pixel O (0, 0) while the rotation angle θ changes from 0 ° to 90 °. Thus, the pixel O (0, 0) moves from the center of the left side of the rectangle, which is the boundary with the other pixels, to the center of the upper side.
次に、回転角度θが90°から180°まで変化する場合には、X方向の補正値ROT_ADJX=Abs(COSθ)/2は、角度θの増加に応じて0から0.5まで余弦曲線を描いて連続的に増加し、Y方向の補正値ROT_ADJY=Abs(SINθ)/2は、角度θの増加に応じて0.5から0まで正弦曲線を描いて連続的に減少する。このため、スプライトの回転対称の中心Qの位置は、回転角度θが90°から180°まで変化する間、画素O(0、0)の中心廻りの半径0.5画素ピッチの円周に沿って、画素O(0、0)の他の画素との境界である矩形の上辺中央から左辺中央に移動する。 Next, when the rotation angle θ changes from 90 ° to 180 °, the correction value ROT_ADJX = Abs (COSθ) / 2 in the X direction is a cosine curve from 0 to 0.5 as the angle θ increases. The correction value ROT_ADJY = Abs (SINθ) / 2 in the Y direction continuously decreases while drawing a sine curve from 0.5 to 0 as the angle θ increases. For this reason, the position of the rotationally symmetrical center Q of the sprite is along the circumference of the radius 0.5 pixel pitch around the center of the pixel O (0, 0) while the rotation angle θ changes from 90 ° to 180 °. The pixel O (0, 0) moves from the center of the upper side of the rectangle, which is the boundary with the other pixels, to the center of the left side.
以下同様であり、回転角度θを連続的に変化させた場合に、スプライトの回転対称の中心Qの位置は、180°の周期で、上記矩形の上辺中央と左辺中央との間を半径0.5画素ピッチの円弧に沿って往復する。 The same applies to the following. When the rotation angle θ is continuously changed, the position of the rotationally symmetrical center Q of the sprite has a period of 180 ° with a radius of 0. It reciprocates along a 5-pixel pitch arc.
以上のように、本実施形態において、スプライトのX方向の画素数SIZEXが偶数であり、かつ、Y方向の画素数SIZEYが奇数である場合には、回転に伴うスプライトの回転対称の中心Qのずれをなくすことはできない。しかし、仮にスプライトを1回転させる場合に、従来技術の下では、スプライトの回転対称の中心Qが半径0.5画素ピッチの円に沿って1周したのに対し、本実施形態においてスプライトの回転対称の中心Qは半径0.5画素ピッチの円の1/4周相当の区間を往復するに過ぎない。このように本実施形態では、スプライトの回転対称の中心Qのずれを従来よりも小さくすることができる。また、本実施形態では、回転処理の際、スプライトの4頂点のX方向の座標の絶対値が揃い、かつ、4頂点のY方向の座標の絶対値も揃うので、スプライトの4頂点の回転軌跡のぶれの問題が生じない。 As described above, in this embodiment, when the number of pixels SIZEX in the X direction of the sprite is an even number and the number of pixels SIZEY in the Y direction is an odd number, the center Q of the rotational symmetry of the sprite accompanying the rotation The gap cannot be eliminated. However, if the sprite is rotated once, under the prior art, the rotationally symmetrical center Q of the sprite makes one turn along a circle having a radius of 0.5 pixel pitch. The center Q of symmetry only reciprocates in a section corresponding to a quarter of a circle having a radius of 0.5 pixel pitch. As described above, in the present embodiment, the shift of the rotationally symmetrical center Q of the sprite can be made smaller than in the prior art. In this embodiment, the absolute values of the X-direction coordinates of the four vertices of the sprite are aligned and the absolute values of the Y-direction coordinates of the four vertices are also aligned during the rotation process. There is no problem of shaking.
スプライトのX方向の画素数SIZEXが奇数であり、かつ、Y方向の画素数SIZEYが偶数である場合、座標補正処理では、補正値ROT_ADJXとしてAbs(SINθ)/2を、補正値ROT_ADJYとしてAbs(COSθ)/2を用いる。この点を除けば、スプライトのX方向の画素数SIZEXが奇数であり、かつ、Y方向の画素数SIZEYが偶数である場合の処理内容は、既に説明したスプライトのX方向の画素数SIZEXが偶数であり、かつ、Y方向の画素数SIZEYが奇数である場合の処理内容と同様である。 When the number of pixels SIZEX in the X direction of the sprite is an odd number and the number of pixels SIZEY in the Y direction is an even number, in the coordinate correction process, Abs (SINθ) / 2 is used as the correction value ROT_ADJX, and Abs is used as the correction value ROT_ADJY. COSθ) / 2 is used. Except for this point, the processing contents when the number of pixels SIZEX in the X direction of the sprite is an odd number and the number of pixels SIZEY in the Y direction are an even number are as follows. And the same processing contents as those when the number of pixels SIZEY in the Y direction is an odd number.
スプライトのX方向の画素数SIZEXが奇数であり、かつ、Y方向の画素数SIZEYが奇数である場合、座標補正処理では、補正値ROT_ADJXおよびROT_ADJYとして0を用いる。従って、従来技術と同様、回転対称の中心Qのずれおよび4頂点の回転軌跡のぶれの問題を発生させることなくスプライトを回転させることができる。 When the number of pixels SIZEX in the X direction of the sprite is an odd number and the number of pixels SIZEY in the Y direction is an odd number, 0 is used as the correction values ROT_ADJX and ROT_ADJY in the coordinate correction process. Accordingly, as in the prior art, it is possible to rotate the sprite without causing the problem of the rotational symmetry center Q shift and the fluctuation of the rotation trajectory of the four vertices.
以上のように、本実施形態によれば、スプライトを回転させて描画する場合において、スプライトの回転対称の中心Qのずれをなくし、または小さくし、かつ、4頂点の回転軌跡のぶれを発生させないでスプライトを回転させることができる。 As described above, according to the present embodiment, when the sprite is rotated and drawn, the shift of the rotational symmetry center Q of the sprite is eliminated or reduced, and the rotation locus of the four vertices is not shaken. You can rotate the sprite.
以上、この発明の一実施形態について説明したが、この発明には他にも実施形態があり得る。例えば次の通りである。
(1)画素数/座標変換部41、回転処理部42および座標補正部43を含む座標演算部4と、マッピング処理部5は、上記実施形態において説明した処理を行う専用のハードウェアであってもよいが、コンピュータにそのような処理を実行させる描画アプリケーションプログラムであってもよい。
(2)座標補正処理において用いる補正値ROT_ADJXやROT_ADJYは、Abs(SINθ)/2やAbs(COSθ)/2でなくてもよい。0.5〜0までの範囲で変化する適切なθの関数をAbs(SINθ)/2やAbs(COSθ)/2の代わりに用いて補正値ROT_ADJXやROT_ADJYを算出してもよい。
Although one embodiment of the present invention has been described above, the present invention may have other embodiments. For example:
(1) The coordinate
(2) The correction values ROT_ADJX and ROT_ADJY used in the coordinate correction process may not be Abs (SINθ) / 2 or Abs (COSθ) / 2. The correction values ROT_ADJX and ROT_ADJY may be calculated by using an appropriate θ function that changes in the range of 0.5 to 0 instead of Abs (SINθ) / 2 or Abs (COSθ) / 2.
1……CPU、2……スプライトメモリ、3……描画処理部、6……フレームメモリ、7……表示制御部、8……表示装置、4……座標演算部、5……マッピング処理部、41……画素数/座標変換部、42……回転処理部、43……座標補正部。
DESCRIPTION OF
Claims (5)
前記画素数/座標変換手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標を用いて、前記回転対称の中心廻りに前記スプライトを回転させた場合の前記スプライトの4頂点の水平方向および垂直方向の各座標を算出する回転処理手段と、
前記回転処理手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標から画素平面における回転後のスプライトの4頂点の水平方向および垂直方向の座標を算出する手段であって、その算出過程において、前記スプライトの水平方向の画素数の奇/偶および垂直方向の画素数の奇/偶の組み合わせに応じて、前記回転後のスプライトの回転に伴う回転対称の中心のずれを少なくする座標補正処理を前記回転処理手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標に施す座標補正手段と、
前記画素平面内において前記スプライトの4頂点の各位置が前記座標補正手段により得られた回転後のスプライトの4頂点の各座標に対応した位置となるように、前記スプライトを前記画素平面に投影した場合において、前記スプライトの画像を構成することとなる前記画素平面内の画素を求め、それらの画素により前記スプライトの画像を示す画像データをメモリに書き込むマッピング処理手段と
を具備することを特徴とする画像処理装置。 Number of pixels / coordinates for calculating the horizontal and vertical coordinates of the four vertices of the sprite based on the rotational symmetry center of the sprite, based on the number of horizontal and vertical pixels of the sprite to be processed Conversion means;
Using the horizontal and vertical coordinates of the four vertices of the sprite obtained by the number of pixels / coordinate conversion means, the four vertices of the sprite when the sprite is rotated around the rotational symmetry center. Rotation processing means for calculating horizontal and vertical coordinates;
Means for calculating the horizontal and vertical coordinates of the four vertices of the sprite after rotation in the pixel plane from the horizontal and vertical coordinates of the four vertices of the sprite obtained by the rotation processing means; In the calculation process, the shift of the rotational symmetry center accompanying the rotation of the sprite after the rotation is reduced in accordance with the combination of the odd / even number of pixels in the horizontal direction and the odd / even number of pixels in the vertical direction. Coordinate correction means for performing coordinate correction processing on the horizontal and vertical coordinates of the four vertices of the sprite obtained by the rotation processing means;
The sprite is projected onto the pixel plane so that the positions of the four vertices of the sprite in the pixel plane correspond to the coordinates of the four vertices of the sprite after rotation obtained by the coordinate correction means. And a mapping processing means for obtaining pixels in the pixel plane that will constitute the sprite image and writing image data indicating the sprite image in the memory by using the pixels. Image processing device.
処理対象であるスプライトの水平方向および垂直方向の各画素数に基づき、前記スプライトの回転対称の中心を基準とした前記スプライトの4頂点の水平方向および垂直方向の各座標を算出する画素数/座標変換手段と、
前記画素数/座標変換手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標を用いて、前記回転対称の中心廻りに前記スプライトを回転させた場合の前記スプライトの4頂点の水平方向および垂直方向の各座標を算出する回転処理手段と、
前記回転処理手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標から画素平面における回転後のスプライトの4頂点の水平方向および垂直方向の座標を算出する手段であって、その算出過程において、前記スプライトの水平方向の画素数の奇/偶および垂直方向の画素数の奇/偶の組み合わせに応じて、前記回転後のスプライトの回転に伴う回転対称の中心のずれを少なくする座標補正処理を前記回転処理手段により得られた前記スプライトの4頂点の水平方向および垂直方向の各座標に施す座標補正手段と、
前記画素平面内において前記スプライトの4頂点の各位置が前記座標補正手段により得られた回転後のスプライトの4頂点の各座標に対応した位置となるように、前記スプライトを前記画素平面に投影した場合において、前記スプライトの画像を構成することとなる前記画素平面内の画素を求め、それらの画素により前記スプライトの画像を示す画像データをメモリに書き込むマッピング処理手段と
して機能させることを特徴とするプログラム。 Computer
Number of pixels / coordinates for calculating the horizontal and vertical coordinates of the four vertices of the sprite based on the rotational symmetry center of the sprite, based on the number of horizontal and vertical pixels of the sprite to be processed Conversion means;
Using the horizontal and vertical coordinates of the four vertices of the sprite obtained by the number of pixels / coordinate conversion means, the four vertices of the sprite when the sprite is rotated around the rotational symmetry center. Rotation processing means for calculating horizontal and vertical coordinates;
Means for calculating the horizontal and vertical coordinates of the four vertices of the sprite after rotation in the pixel plane from the horizontal and vertical coordinates of the four vertices of the sprite obtained by the rotation processing means; In the calculation process, the shift of the rotational symmetry center accompanying the rotation of the sprite after the rotation is reduced in accordance with the combination of the odd / even number of pixels in the horizontal direction and the odd / even number of pixels in the vertical direction. Coordinate correction means for performing coordinate correction processing on the horizontal and vertical coordinates of the four vertices of the sprite obtained by the rotation processing means;
The sprite is projected onto the pixel plane so that the positions of the four vertices of the sprite in the pixel plane correspond to the coordinates of the four vertices of the sprite after rotation obtained by the coordinate correction means. In this case, the pixel plane in the pixel plane that constitutes the sprite image is obtained, and the pixel functions as a mapping processing unit that writes image data indicating the sprite image in a memory. Program to do.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007307006A JP4983570B2 (en) | 2007-11-28 | 2007-11-28 | Image processing apparatus and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2007307006A JP4983570B2 (en) | 2007-11-28 | 2007-11-28 | Image processing apparatus and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2009129403A JP2009129403A (en) | 2009-06-11 |
JP4983570B2 true JP4983570B2 (en) | 2012-07-25 |
Family
ID=40820213
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2007307006A Active JP4983570B2 (en) | 2007-11-28 | 2007-11-28 | Image processing apparatus and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4983570B2 (en) |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6256074A (en) * | 1985-09-04 | 1987-03-11 | Canon Inc | Image processing method |
JPH0887267A (en) * | 1994-09-19 | 1996-04-02 | Sega Enterp Ltd | Image processor |
JP2000076438A (en) * | 1998-09-01 | 2000-03-14 | Techno Culture:Kk | Graphic expressing method and graphic displaying method |
JP2005099313A (en) * | 2003-09-24 | 2005-04-14 | Yamaha Corp | Image drawing method and image drawing system |
-
2007
- 2007-11-28 JP JP2007307006A patent/JP4983570B2/en active Active
Also Published As
Publication number | Publication date |
---|---|
JP2009129403A (en) | 2009-06-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3438919B1 (en) | Image displaying method and head-mounted display apparatus | |
US20190043160A1 (en) | Equatorial stitching of hemispherical images in a spherical image capture system | |
US7822292B2 (en) | Rendering images under cylindrical projections | |
JP2007081562A (en) | Stereoscopic image display device, stereoscopic image display program, and stereoscopic image display method | |
EP3340164B1 (en) | Image generating device and image display control device | |
JP2007143173A (en) | Method and apparatus for preventing keystone distortion | |
TW200404267A (en) | Rotatable display with sub-pixel rendering | |
US8081197B1 (en) | System and method for angular image selection | |
JP2009044302A (en) | Image processing system, projector, program, and information storage medium | |
US20050249435A1 (en) | Apparatuses and methods for rotating an image | |
JP2007293457A (en) | Image processor | |
TW389857B (en) | Image drawing apparatus | |
JP4686624B2 (en) | Information processing apparatus, image processing method, and program | |
JP4983570B2 (en) | Image processing apparatus and program | |
JP2004032484A (en) | Projection type image display and method for converting image | |
JP5187480B2 (en) | Projector, program, information storage medium, and image generation method | |
WO2018087856A1 (en) | Image synthesis device and image synthesis method | |
US11863862B2 (en) | Device and method for image display | |
JP5093517B2 (en) | Projector, program, information storage medium, and image generation method | |
JP2006005549A (en) | Image projector, image processor and processing method | |
JP2005012407A (en) | Picture projection device and picture processing method | |
JPWO2011158344A1 (en) | Image processing method, program, image processing apparatus, and imaging apparatus | |
WO2011158343A1 (en) | Image processing method, program, image processing device, and imaging device | |
JP2007286942A (en) | Method for generating drawing data and data processor | |
JP3327961B2 (en) | Image processing device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20100921 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20111115 |
|
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: 20120327 |
|
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: 20120409 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 4983570 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20150511 Year of fee payment: 3 |