Arc

角が(x1、y1)と(x2、y2)の四角形に内接する楕円の円弧を描きます。円弧の境界は、楕円の中心から座標(x3、y3)と(x4、y4)の2つの点に延びる線で切り取られます。

void  Arc(
  int        x1,      // 四角形の左上隅のX座標
  int        y1,      // 四角形の左上隅のY座標
  int        x2,      // 四角形の右下隅のX座標
  int        y2,      // 四角形の右下隅のY座標
  int        x3,      // 円弧の境界を見つけるための最初の点のX座標
  int        y3,      // 円弧の境界を見つけるための最初の点のY座標
  int        x4,      // 円弧の境界を見つけるための2番目の点のX座標
  int        y4,      // 円弧の境界を見つけるための2番目の点のY座標
  const uint  clr      // 色
  );

パラメータ

x1

[in]  四角形の左上隅のX座標

y1

[in]  四角形の左上隅のY座標

x2

[in]  四角形の右下隅のX座標

y2

[in]  四角形の右下隅のY座標

x3

[in]  円弧の境界を取得するために、四角形の中心からの線が描画される最初の点のX座標

y3

[in]  円弧の境界を取得するために、四角形の中心からの線が描画される最初の点のY座標

x4

[in]  円弧の境界を取得するために、四角形の中心からの線が描画される2番目の点のX座標

y4

[in]  円弧の境界を取得するために、四角形の中心からの線が描画される2番目の点のY座標

clr

[in]  ARGB 形式での色。色をARGB 形式に変換するにはColorToARGB()関数を使用します。

 

半径rxとryを持つ長方形に内接し、点(x、y)を中心とする楕円の円弧を描きます。円弧の境界は、楕円の中心から角度fi3およびfi4によって形成される線によって切り取られます。

void  Arc(
  int        x,      // 楕円中心のX座標
  int        y,      // 楕円中心のY座標
  int        rx,      // X軸上の楕円半径
  int        ry,      // Y軸上の楕円半径
  int        fi3,    // 円弧の最初の境界を定義する楕円中心からの線の角度
  int        fi4,    // 円弧の2番目の境界を定義する楕円中心からの線の角度
  const uint  clr      // 色
  );

Draws an arc of an ellipse with center at point (x,y), inscribed in rectangle, with radii rx and ry, and also returns the coordinates of the arc boundaries. 円弧の境界は、楕円の中心から角度fi3およびfi4によって形成される線によって切り取られます。

void  Arc(
  int        x,      // 楕円中心のX座標
  int        y,      // 楕円中心のY座標
  int        rx,      // X軸上の楕円半径
  int        ry,      // Y軸上の楕円半径
  int        fi3,    // 円弧の最初の境界を定義する楕円中心からの線の角度
  int        fi4,    // 円弧の2番目の境界を定義する楕円中心からの線の角度
  int&       x3,      // 円弧の最初の境界のX座標
  int&       y3,      // 円弧の最初の境界のY座標
  int&       x4,      // 円弧の2番目の境界のX座標
  int&       y4,      // 円弧の2番目の境界のY座標
  const uint  clr      // 色
  );

パラメータ

x

[in]  楕円中心のX座標

y

[in]  楕円中心のY座標

rx

[in]  X軸上の楕円半径(ピクセル単位)

ry

[in]  Y軸上の楕円半径(ピクセル単位)

fi3

[in]  円弧の最初の境界を定義する角度(ラジアン単位).

fi4

[in]  円弧の2番目の境界を定義する角度(ラジアン単位).

x3

[out] 円弧の最初の境界のX座標を取得するための変数

y3

[out] 円弧の最初の境界のY座標を取得するための変数

x4

[out] 円弧の2番目の境界のX座標を取得するための変数

y4

[out] 円弧の2番目の境界のY座標を取得するための変数

clr

[in]  ARGB 形式での色。色をARGB 形式に変換するにはColorToARGB()関数を使用します。

クラスメソッドの呼び出し例:

#include <Canvas\Canvas.mqh>
CCanvas canvas;
//+------------------------------------------------------------------+
//| スクリプトプログラムを開始する関数                                          |
//+------------------------------------------------------------------+
void OnStart()
 {
  int      Width=600;
  int      Height=400;
//--- canvasを作成する
  if(!canvas.CreateBitmapLabel(0,0,"CirclesCanvas",30,30,Width,Height))
    {
    Print("Error creating canvas: ",GetLastError());
    }
//--- canvasをクリアする
  canvas.Erase(clrWhite);
//--- 長方形を描画する
  canvas.Rectangle(215-190,215-120,215+190,215+120,clrGray);
//--- 最初の円弧を描く
  canvas.Arc(215,215, 190,120,M_PI_4,2*M_PI-M_PI_4,ColorToARGB(clrRed));
  int x1,y1,x2,y2;
//--- 2番目の円弧を描く
  canvas.Arc(215,215, 190,120,2*M_PI-M_PI_4,2*M_PI+M_PI_4,x1,y1,x2,y2,ColorToARGB(clrGreen));
//--- 円弧の座標を出力する
  PrintFormat("First point of arc at (%G,%G), second point of arc at (%G,%G)",x1,y1,x2,y2);
  canvas.CircleAA(x1,y1,3, ColorToARGB(clrRed));
  canvas.CircleAA(x2,y2,3, ColorToARGB(clrBlue));
//--- 更新されたcanvasを表示する
  canvas.Update();  
 }