SCALE.H

[目次 | 型・クラス・構造体 | マクロ]

目次

型・クラス・構造体一覧

マクロ一覧


   1|/************************************************************************
   2|*  1. <<< スケール変換 (Scale) >>> 
   3|*************************************************************************/
   4|
   5|#ifndef __SCALE_H
   6|#define __SCALE_H
   7|
   8|/*----------------------------------------------------------------------
   9|[Module Property]
  10|name = Scale
  11|title = スケール変換
  12|category = グラフィック
  13|src = scale.c
  14|depend =
  15|priority =
  16|accord =
  17|----------------------------------------------------------------------*/
  18|
  19|#ifndef USES_PRIORITY_HEADER
  20|/*[START_OF_PRIORITY_HEADER]*/
  21|
  22|#define  USES_SCALE
  23|typedef struct _Scale  Scale;
  24|
  25|/*[END_OF_PRIORITY_HEADER]*/
  26|#endif /* USES_PRIORITY_HEADER */
  27|
  28|
  29| 
  30|/*-------------------------------------------------------------------------*/
  31|/* 2. <<< Interface Area ------------------------------------------------ >>> */ 
  32|/*-------------------------------------------------------------------------*/
  33|
  34| 
  35|/************************************************************************
  36|*  3. <<< スケール変換処理 [Scale] >>> 
  37|*************************************************************************/
  38|struct _Scale {
  39|  /* グラフィックス座標 */
  40|  double  GX1;  double  GY1;  /* 基準点 */
  41|  double  GX2;  double  GY2;  /* 対応点 */
  42|  double  GXP;  double  GYP;  /* 比率 */
  43|  /* 論理座標 */
  44|  double  LX1;  double  LY1;  /* 基準点 */
  45|  double  LX2;  double  LY2;  /* 対応点 */
  46|  double  LXP;  double  LYP;  /* 比率 */
  47|};
  48|
  49|void  Scale_init( Scale*, double GX1, double GY1, double GX2,
  50| double GY2, double LX1, double LY1, double LX2, double LY2 );
  51|void  Scale_setG( Scale*,
  52|  double GX1, double GY1, double GX2, double GY2 );
  53|void  Scale_setG2( Scale*,
  54|  double GX1, double GY1, double GX2, double GY2 );
  55|void  Scale_setL_1To1( Scale*,
  56|  double LX1, double LY1, double LX2, double LY2 );
  57|#if defined(USES_ERRORS) && !defined(ERRORS_CUT_DEBUG_TOOL)
  58|  void  Scale_print( Scale*, const char* title );
  59|#endif
  60|
  61|
  62| 
  63|/***********************************************************************
  64|*  4. <<< [Scale_Progre] 進捗状況を計算するツール >>> 
  65|************************************************************************/
  66|int   Scale_Progre_getPer( int startPer, int endPer, int nPos, int pos );
  67|
  68|
  69|/***********************************************************************
  70|*  5. <<< [Scale_DispPosF] 進捗状況を通知するコールバック関数型 >>>
  71|*【補足】
  72|*・現在位置が進んだときに呼ばれます。
  73|*   iPos;    現在位置(0〜10000)
  74|************************************************************************/
  75|typedef  void (*Scale_DispPosF)( void* obj, int iPos );
  76|
  77| 	
  78|/*-------------------------------------------------------------------------*/
  79|/* 6. <<< Mapping Area -------------------------------------------------- >>> */ 
  80|/*-------------------------------------------------------------------------*/
  81| 
  82|/************************************************************************
  83|*  7. <<< グラフィック X 座標から論理 X 座標を取得する [Scale_toLX()] >>> 
  84|* double  Scale_toLX( Scale*, double GX );
  85|*************************************************************************/
  86|#define  Scale_toLX( this, GX )  \
  87|    ( (this)->LXP * ( (GX) - (this)->GX1 ) + (this)->LX1 )
  88|
  89|/*************************************************************************
  90|*  8. <<< グラフィック Y 座標から論理 Y 座標へ [Scale_toLY()] >>>
  91|* double  Scale_toLY( Scale*, double GY );
  92|*************************************************************************/
  93|#define  Scale_toLY( this, GY )  \
  94|    ( (this)->LYP * ( (GY) - (this)->GY1 ) + (this)->LY1 )
  95|
  96|/*************************************************************************
  97|*  9. <<< 座標変換  論理X座標からグラフィックX座標へ [Scale_toGX()] >>>
  98|* double  Scale_toGX( Scale*, double LX );
  99|*************************************************************************/
 100|#define  Scale_toGX( this, LX )  \
 101|    ( (this)->GXP * ( (LX) - (this)->LX1 ) + (this)->GX1 )
 102|
 103|/*************************************************************************
 104|*  10. <<< 座標変換  論理Y座標からグラフィックY座標へ [Scale_toGY()] >>>
 105|* double  Scale_toGY( Scale*, double LY );
 106|*************************************************************************/
 107|#define  Scale_toGY( this, LY )  \
 108|    ( (this)->GYP * ( (LY) - (this)->LY1 ) + (this)->GY1 )
 109|
 110|/*************************************************************************
 111|*  11. <<< グラフィック座標設定 [Scale_setG()] >>>
 112|* void  Scale_setG( Scale* this, double GX1, double GY1, double GX2, double GY2);
 113|*************************************************************************/
 114|#define  Scale_setG( this, GX1, GY1, GX2, GY2 ) \
 115|  Scale_init( this, GX1, GY1, GX2, GY2, \
 116|     (this)->LX1, (this)->LY1, (this)->LX2, (this)->LY2 )
 117|
 118|
 119|/*************************************************************************
 120|*  12. <<< 論理座標設定 [Scale_setL()] >>>
 121|* void  Scale_setL( Scale* this, double LX1, double LY1, double LX2, double LY2);
 122|*************************************************************************/
 123|#define  Scale_setL( this, LX1, LY1, LX2, LY2 ) \
 124|  Scale_init( this, (this)->GX1, (this)->GY1, (this)->GX2, (this)->GY2,\
 125|			 LX1, LY1, LX2, LY2 )
 126|
 127|
 128| 
 129|#endif /* __SCALE_H */ 
 130| 
 131|